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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php not printing my mysql output [ was what's wrong with this? ]

    it doesn't output the message and date variables, only the part that says "Posted on : " and "News : " and the "<br />"s. Help! I know that I could connect to the db correctly! also I don't get the could not query message!
    PHP Code:
    $result mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0 , 10") OR die("Could not query.");
    while (
    $row mysql_fetch_object($result)) {
    echo 
    "Posted on : ";
    echo 
    $row['date'];
    echo 
    "<br />";
    echo 
    "News : ";
    echo 
    $row['message'];
    echo 
    "<br /><br />";

    Last edited by guelphdad; 07-24-2006 at 06:55 PM.

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Please use proper thread titles, it is helpful to those looking to assist you.

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Try changing
    mysql_fetch_object
    to
    mysql_fetch_array

    I think with mysql_fetch_object you have to use pointer notation to refer to your fields whereas mysql_fetch_array you can refer to them as you have above.

  • #4
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks! that fixed it!


  •  

    Posting Permissions

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