PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am having trouble getting this code to display correctly. I recieve this error when I try to preview the page in firefox: "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\New_Blog\viewentry.php on line 34." I have provided the code from the entire page and would appreciate it if someone could point out what I am doing wrong. Thanks.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
$result = mysql_query($sql) or die(mysql_error());
Your query is not returning a result set. This could be caused by a query error, or mysql returning 0 rows. If there is no query error, check the mysql_num_rows($result) before fetching the $row.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
$result = mysql_query($sql) or die(mysql_error());
and it returned this error message: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY dateposted DESC LIMIT 1' at line 2"
$result = mysql_query($sql) or die(mysql_error());
and it returned this error message: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY dateposted DESC LIMIT 1' at line 2"
$result = mysql_query($sql) or die(mysql_error());
and it returned this error message: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY dateposted DESC LIMIT 1' at line 2"
$result = mysql_query($sql) or die(htmlentities(mysql_error().': "'.$sql.'"'));
Ok now the error reads like this:
"Warning: mysql_query() [http://www.mysql.com/doc]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY dateposted DESC LIMIT 1' at line 2 in C:\xampp\htdocs\New_Blog\viewentry.php on line 34
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BY dateposted DESC LIMIT 1' at line 2: "SELECT entries.*, categories.cat FROM entries, categories WHERE entries.cat_id = categories.id AND entries.id = 4ORDER BY dateposted DESC LIMIT 1;"