Activity Stream
48,167 MEMBERS
62388 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 3 of 3
  1.     
    #1
    Member
    Website's:
    WebSkin.org

    Default PHP noob

    Halp me please - I'm trying to select the title of a blog and post it - but the code keeps erroring me and I don't know why :/ I've taken the code like directly from w3schools and just changed my bits

    PHP Code: 
    <?php
    $con 
    mysql_connect("localhost","*****","*****");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("*****"$con);

    $result "SELECT * FROM 'wp_posts' ".
    "ORDER BY 'post_date' DESC LIMIT 0,1";

    while(
    $row mysql_fetch_array($result))
      {
      echo 
    $row['wp_title'];
      }

    mysql_close($con);
    ?>
    And the error is
    Code: 
    Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /file.php on line 22
    Line 22 is this one
    PHP Code: 
    while($row mysql_fetch_array($result)) 
    Thanks in advance
    .Jamie Reviewed by .Jamie on . PHP noob Halp me please - I'm trying to select the title of a blog and post it - but the code keeps erroring me and I don't know why :/ I've taken the code like directly from w3schools and just changed my bits <?php $con = mysql_connect("localhost","*****","*****"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("*****", $con); Rating: 5
    Respected: Ultima, K3V, Dlow, Hyperz, Elio, ACiD

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    warezxtc.com
    Here, try this.

    PHP Code: 
    <?php
    $con 
    mysql_connect("localhost","*****","*****");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("*****"$con);

    $result mysql_query("SELECT * FROM 'wp_posts' ".
    "ORDER BY 'post_date' DESC LIMIT 0,1");

    while(
    $row mysql_fetch_array($result))
      {
      echo 
    $row['wp_title'];
      }

    mysql_close($con);
    ?>

  4.     
    #3
    Member
    Website's:
    WebSkin.org
    Thanks - Both you and __Doc_ Fixed it,

    1000 internets to you both

    Someone can close this now
    Respected: Ultima, K3V, Dlow, Hyperz, Elio, ACiD

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. I am noob, and need some help wit a RPD
    By gt911 in forum Webmaster Discussion
    Replies: 0
    Last Post: 6th Feb 2012, 06:10 AM
  2. noob here
    By kushfodawin in forum Introductions
    Replies: 5
    Last Post: 25th Oct 2011, 11:29 PM
  3. A noob question
    By praveer in forum General Discussion
    Replies: 16
    Last Post: 23rd Jul 2011, 05:14 PM
  4. Noob here..;)
    By nmpraveen in forum Introductions
    Replies: 5
    Last Post: 21st Jul 2010, 05:05 PM
  5. noob
    By vken27 in forum Introductions
    Replies: 3
    Last Post: 14th Feb 2010, 08:21 AM

Tags for this Thread

BE SOCIAL