Results 1 to 3 of 3
-
20th Oct 2009, 02:07 AM #1OPMemberWebsite's:
WebSkin.orgPHP 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);
?>
Code:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /file.php on line 22
PHP Code:while($row = mysql_fetch_array($result))
.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: 5Respected: Ultima, K3V, Dlow, Hyperz, Elio, ACiD
-
20th Oct 2009, 03:00 AM #2MemberWebsite's:
warezxtc.comHere, 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);
?>
-
20th Oct 2009, 03:03 AM #3OPMemberWebsite's:
WebSkin.orgThanks - Both you and __Doc_ Fixed it,
1000 internets to you both
Someone can close this nowRespected: Ultima, K3V, Dlow, Hyperz, Elio, ACiD
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
I am noob, and need some help wit a RPD
By gt911 in forum Webmaster DiscussionReplies: 0Last Post: 6th Feb 2012, 06:10 AM -
noob here
By kushfodawin in forum IntroductionsReplies: 5Last Post: 25th Oct 2011, 11:29 PM -
A noob question
By praveer in forum General DiscussionReplies: 16Last Post: 23rd Jul 2011, 05:14 PM -
Noob here..;)
By nmpraveen in forum IntroductionsReplies: 5Last Post: 21st Jul 2010, 05:05 PM -
noob
By vken27 in forum IntroductionsReplies: 3Last Post: 14th Feb 2010, 08:21 AM
themaCreator - create posts from...
Version 3.07 released. Open older version (or...