Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts

    want to edit that php/mysql code

    PHP Code:
    <?php

      $MYSQL_HOST 
    "localhost"
      
    $MYSQL_USER "user"
      
    $MYSQL_PW "pass"
      
    $MYSQL_DB "db"

      
    $conn mysql_connect($MYSQL_HOST$MYSQL_USER$MYSQL_PW);
      
    mysql_select_db($MYSQL_DB$conn);

      
    $names "";

      
    $chatuser mysql_query("SELECT * FROM pcpin_nickname WHERE pcpin_nickname.default = 'y';");

      while(
    $row mysql_fetch_assoc($chatuser)) {
        
    $names .= $row['nickname_plain'].'     ';
      }

      
    $names substr($names0, -5);

      echo 
    ' <marquee behavior="scroll" direction="up" scrollamount="5" scrolldelay="200" onmouseover="this.scrollAmount=0" onmouseout="this.scrollAmount=5""this.scrolldelay=200">'.htmlspecialchars($names).' </marquee>';


    ?>
    i need instead of names show in a row it shows in a column means in vertical way norizontal
    also was wondering if i can make the thumbnail avatar of the pcpin chat show beside the name too

    any idea?

    thnx in advance

    maxwel
    Last edited by maxwel; 01-29-2012 at 01:25 PM.

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    PHP Code:
    <?php

      $MYSQL_HOST 
    "localhost"
      
    $MYSQL_USER "user"
      
    $MYSQL_PW "pass"
      
    $MYSQL_DB "db"

      
    $conn mysql_connect($MYSQL_HOST$MYSQL_USER$MYSQL_PW);
      
    mysql_select_db($MYSQL_DB$conn);

      
    $names "";

      
    $chatuser mysql_query("SELECT * FROM pcpin_nickname WHERE pcpin_nickname.default = 'y';");

      while(
    $row mysql_fetch_assoc($chatuser)) {
        
    $names .= '<img src="'.$row['nickname_img_path'].'" align="absmiddle">'.$row['nickname_plain'].'<br>';
      }

      
    $names substr($names0, -5);

      echo 
    ' <marquee behavior="scroll" direction="up" scrollamount="5" scrolldelay="200" onmouseover="this.scrollAmount=0" onmouseout="this.scrollAmount=5""this.scrolldelay=200">'.htmlspecialchars($names).' </marquee>';


    ?>
    that will put a line break between each of the names but the substr you've got there chopping the last 5 characters off will prob break something...

    also added the image in there for you but you'll need to modify it to the actual column name that has the path to the image

    let me know what you end up with

  • Users who have thanked jmj001 for this post:

    maxwel (01-29-2012)

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts
    thanks alot for ur fast reply but actually didn't work :/ that was the output "tony7364<br>WildLio" even 1 letter not showin of one of users :/

  • #4
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    what's the
    PHP Code:
    $names substr($names0, -5); 
    in there for?

  • Users who have thanked jmj001 for this post:

    maxwel (01-29-2012)

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts
    idk, tbh i had that code from the pcpin chat forums. i am not good with php/mysql thangs that much so idk :S i even donno how to get the image url from database tried to search db with notepad++ but i donno which is the url found the (nickname_plain) but nothing about image/avatar there that looks like (avatar_plain) or sumthing

    thanks in advance for the help so much appreciated

    EDIT:
    ok i remove the part u mentioned and seems it don miss a letter now and all letters show up but same the <br> didn't break the names i tried even </br> and <br /> instead but no use :S

    they appeared like
    tony7364</br>WildLion</br> &
    tony7364<br />WildLion<br />
    Last edited by maxwel; 01-29-2012 at 05:51 PM.

  • #6
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    ok... let's backtrack and see if we can get it to display without the image first...

    PHP Code:
    <?php

      $MYSQL_HOST 
    "localhost"
      
    $MYSQL_USER "user"
      
    $MYSQL_PW "pass"
      
    $MYSQL_DB "db"

      
    $conn mysql_connect($MYSQL_HOST$MYSQL_USER$MYSQL_PW);
      
    mysql_select_db($MYSQL_DB$conn);

      
    $names "";

      
    $chatuser mysql_query("SELECT * FROM pcpin_nickname WHERE pcpin_nickname.default = 'y';");

      while(
    $row mysql_fetch_assoc($chatuser)) {
        
    $names .= $row['nickname_plain'].'<br>';
      }

     
    // $names = substr($names, 0, -5);

      
    echo ' <marquee behavior="scroll" direction="up" scrollamount="5" scrolldelay="200" onmouseover="this.scrollAmount=0" onmouseout="this.scrollAmount=5""this.scrolldelay=200">'.htmlspecialchars($names).' </marquee>';


    ?>
    i've commented out the substr $names bit... let me know what that gives you

  • Users who have thanked jmj001 for this post:

    maxwel (01-29-2012)

  • #7
    New Coder
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts
    yea already tried what u mentioned lately it worked. i edited ma last post

  • #8
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    ok.. this time it will work... you gotta ditch htmlspecialchars, sorry... missed that

    PHP Code:
    <?php

      $MYSQL_HOST 
    "localhost"
      
    $MYSQL_USER "user"
      
    $MYSQL_PW "pass"
      
    $MYSQL_DB "db"

      
    $conn mysql_connect($MYSQL_HOST$MYSQL_USER$MYSQL_PW);
      
    mysql_select_db($MYSQL_DB$conn);

      
    $names "";

      
    $chatuser mysql_query("SELECT * FROM pcpin_nickname WHERE pcpin_nickname.default = 'y';");

      while(
    $row mysql_fetch_assoc($chatuser)) {
        
    $names .= $row['nickname_plain'].'<br>';
      }

     
    // $names = substr($names, 0, -5);

      
    echo ' <marquee behavior="scroll" direction="up" scrollamount="5" scrolldelay="200" onmouseover="this.scrollAmount=0" onmouseout="this.scrollAmount=5""this.scrolldelay=200">'.$names.' </marquee>';


    ?>

  • Users who have thanked jmj001 for this post:

    maxwel (01-29-2012)

  • #9
    New Coder
    Join Date
    Jan 2012
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts
    Perfect thank you so much and u don have to apologize ur helping me

    btw, i thanked all ur posts the least to giveback as a thank now i have to keep look for that db avatar imges but ik it might be the harderest or impossible but thanks alot bro

    Maxwel

  • #10
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    cheers, normally a database will have images listed as path... good luck..

  • Users who have thanked jmj001 for this post:

    maxwel (01-29-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •