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!
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
echo "And the query is: '$q'. ";
$r = mysql_query($q) or die('There was an error in the query at line ' . __LINE__ . ' of the script: ' . mysql_error());
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
echo "And the query is: '$q'. ";
$r = mysql_query($q) or die('There was an error in the query at line ' . __LINE__ . ' of the script: ' . mysql_error());
There was an error in the query at line 57 of the script: 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 '' at line 1 Query: SELECT * FROM comments ORDER BY Date DESC LIMIT 0,
<?php
echo '<p>From is ' . $from . ' and max_results is ' . $max_results . '...</p>';
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
echo '<p>And the query is: ' . $q . '</p>';
if ( !$r = mysql_query($q) )
{
die('There was an error in the query at line ' . __LINE__ . ' of the script: ' . mysql_error());
}
else
{
echo '<p>The query finally succeeded...</p>';
}
?>
I suspect it has something to do with $from and $max_results.
And the query is: SELECT * FROM comments ORDER BY Date DESC LIMIT 0,
There was an error in the query at line 61 of the script: 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 '' at line 1
$result = mysql_query("SELECT * FROM settings") or die('There was an error in the query at line ' . __LINE__ . ' of the script: ' . mysql_error());
while ($row = mysql_fetch_array($result)) {
$settings[$row['name']] = $row['value'];
}