Selecting from database... ( 6 Views )

no kitty!
  1. I'm trying to select some information from my database but when I do it only selects the first word, and nothing after that. Does anyone have any advice?

    Quote:

    $sql = "SELECT * FROM Comments WHERE Verified = '0'";
    $sql1 = mysql_query($sql);
    if (mysql_num_rows($sql1) > 0 )
    {
    while($sql2 = mysql_fetch_array($sql1))
    {
    $comment = $sql2['Comment'];
    echo "$comment";
    So for instance if the comment was "This is a good comment", it would only display "This".

    Thank you,
    Kyle

    (merve, Bulgaria)

  2. Not sure but I would check the type of field that 'comment' is. Are you sure that the entire string is being stored in the database?

    (taner, Serbia and Montenegro)

  3. It is a text field and I have checked the database with phpMyadmin and it is all there.
    Kyle

    (fadime, French Guiana)

  4. Quote:

    Originally Posted by Fender963
    It is a text field and I have checked the database with phpMyadmin and it is all there.
    Kyle

    You need a for loop. Try this one
    PHP Code:

    <?
    $query_string
    = "SELECT * FROM Comments WHERE Verified = '0'";
    $result = mysql_query($query_string);
    $column_count = mysql_num_fields($result);
    while (
    $row = mysql_fetch_row($result))
          {
          for(
    $column_num = 0;
              
    $column_num < $column_count-1;
              
    $column_num++)
          print(
    "$row[$column_num]<br>");
    ?>

    Hope this will solve your problem

    (veysel, Cocos (Keeling) Islands)



Related Topics ... (or search in 1.720.883 topics !)

not selecting database (5)
selecting in a database (1)
selecting a database (6)
selecting from database (3)
selecting information from database (2)
selecting text from database (7)
selecting information from database! (21)
selecting a table in a database (3)
problem selecting a database! (2)




copyright © 2007-2031 Pfodere.COM ( 5 Pfoyihuee Online )

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
1.4286