Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Senior Member Eddy Bones's Avatar
    Join Date
    Jan 2004
    Location
    Washington, USA
    Posts
    1,054
    Member #
    4651
    Hi all,

    I've been having some problems with my blog system. I'll begin with the one that's bugging me the most, though undoubtedly there will be more to follow later.

    I'm simply trying to display a series of 5 posts, but I get this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource...

    The code:
    PHP Code:
    $con mysql_connect("localhost""XXXXX""XXXXX");
    mysql_select_db("XXXXX");
    $sql "select title, date_format(date, '%W, %M %e, %Y at %l:%S %p') as fmt_time, content from post order by id desc limit 0, 5";
    $res mysql_query($sql);
    if(
    $res == 0) {
    $display "<p class=\"notice\">Notice:</p>
      <p class=\"content\">There are no posts to display at this time.</p>"
    ;
      }
    while(
    $info mysql_fetch_array($res)) {
        
    $title stripslashes($info[title]);
        
    $content nl2br($info[content]);
        
    $time $info[fmt_time];

        
    $display .= "<p class=\"date\">$time</p>
        <p class=\"title\">
    $title</p>
        <p class=\"content\">
    $content</p>
        <div class=\"spacer\">&nbsp;</div> \n"
    ;
        } 
    And when I get that sorted out (because it works on my test server, but not my live host) I'm sure I'll get errors that say I'm using undefined variables or assumed variables. Don't know what that's about.

    So, is my code just bad? What can I do about this?

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:45 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com