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!
Moderator: General Moderators
adamb10
Forum Commoner
Posts: 91 Joined: Sat Jun 24, 2006 7:44 pm
Post
by adamb10 » Mon Aug 14, 2006 5:30 pm
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
That error is returned. Here is index.php...
Code: Select all
<?
session_start();
//index.php
// START MEMORY BUFFER
ob_start();
//Load required files
require('sources/functions.php');
//COUNTER STSRT
$c_ip = $HTTP_COOKIE_VARS["user_ip"];
$counter_file = "sources/counter.txt";
$counter_file_line = file ($counter_file);
if (!$c_ip) {
setcookie("user_ip", $REMOTE_ADDR, time()+360000); $counter_file_line[0]++;
$cf = fopen ($counter_file, "w+");fputs($cf, "$counter_file_line[0]"); fclose($cf);
}
elseif ($c_ip != $REMOTE_ADDR){
$counter_file_line[0]++; $cf = fopen ($counter_file, "w+");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
}
//END COUNTER
//Essential Functions
db_connect();
//Query Settings Table
$result = mysql_query("SELECT * FROM settings");
while ($row = mysql_fetch_array($result)) {
$settings[$row['name']] = $row['value'];
}
//Query Colors table
$result = mysql_query("SELECT * FROM colors");
while ($row = mysql_fetch_array($result)) {
$colors[$row['name']] = $row['value'];
}
$result = mysql_query("SELECT * FROM images");
while ($row = mysql_fetch_array($result)) {
$images[$row['name']] = $row['value'];
}
$max_results = $row['maxshow'];
$from = ($page * $max_results);
$q1 = 'SELECT * FROM Bans'; //ban query
$r1 = mysql_query($q1) or die(mysql_error());
//Comment Query
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
$r = mysql_query($q) or die(mysql_error());
$hf = mysql_query("SELECT * FROM hf"); //HF Query
if (!$hf) {
die('Invalid query: ' . mysql_error());
}
//QUERY END
//CSS BEGIN
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<head>
<title>'.$row['title'].'</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a:link {
color: #'.$row['link'].';
text-decoration: none;
}
a:visited {
color: #'.$row['visitedlink'].';
text-decoration: none;
}
a:active {
color: #'.$row['activelink'].';
text-decoration: none;
}
a:hover {
color: #'.$row['hoverlink'].';
text-decoration: none;
}
body {
background-color: #'.$row['bodybg'].';
font-family: '.$row['fontfamily'].';
font-size: '.$row['fontsize'].';
color: #'.$row['font'].';
margin:0px;
';
if ($row['bodybgimage'] != "") {
echo 'background-image: url('.$row['bodybgimage'].');';
}
echo '
}
.titlebg {
background-color: #'.$row['titlebg'].';
font-family: '.$row['titlefontfamily'].';
font-size: '.$row['titlefontsize'].';
color: #'.$row['titlefont'].'; ';
if ($row['tilebgimage'] == "") {
echo '
background-image: url('.$row['titlebgimage'].');';
}
echo '
}
.windowbg {
background-color: #'.$row['windowbg'].';
font-family: '.$row['windowfontfamily'].';
font-size: '.$row['windowfontsize'].';
color: #'.$row['windowfont'].';';
if ($row['windowbgimage'] != "") {
echo 'background-image: url('.$row['windowbgimage'].');';
}
echo '
}
.windowbg2 {
background-color: #'.$row['window2bg'].';
font-family: '.$row['window2fontfamily'].';
font-size: '.$row['window2fontsize'].';
color: #'.$row['window2font'].';';
if ($row['window2bgimage'] != "") {
echo 'background-image: url('.$row['window2bgimage'].');';
}
echo '
}
.border {
background-color: #'.$row['border'].';
}
td {
font-size: 11px;
}
input,textarea {
font-family: '.$row['fontfamily'].';
font-size: 11px;
}
select {
font-family: '.$row['fontfamily'].';
font-size: 11px;
}
p{margin: 0px;}
--!>
</style>
<title>'.$row['title'].'</title>
</head>
<body>';
//CSS END
if ($_GET['action'] == "") {
getUserIp();
}
//echo out the Guestbook Header
if ($row['menubarlocation'] == "Top") {
guestbook_header();
}
echo '<br><br><br>';
require('sources/actions.php');
//Check if this really is index.php.
if ($_GET['action'] == "") {
echo '<br>'.$hf['header'].'';
if($row['posting'] == "enabled") {
if($row['kwikpost'] == "yes"){
if($row['kwikpostlocation'] == "top"){
kwikpost();
}
}
}
}
//PAGINATON STARTS HERE
if (!isset($_GET['page'])){
$page = 0;
} else {
$page = $_GET['page'];
}
if ($_GET['action'] == "") {
echo '<br><br>
<table style="width: 65%;" class="border" border="0" cellpadding="4" cellspacing="1" align="center">
<td class="titlebg" colspan="3" align="right">';
}
//COMMENT SYSTEM BEGIN
if($_GET['action'] == ""){
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM comments"),0);
// Figure out the total number of pages. Always round up using ceil()
$total_pages = floor(ceil($total_results / $max_results));
echo '<b><palign="right">Page:</b> ';
// Build Page Number Hyperlinks
if($page > 0){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";
}
for($i = 0; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
//Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a></p></td>";
}
{
while($row = mysql_fetch_array($r)){
//END PAGINATION, PROCEED TO NORMAL CODE
//TURN TABLE CONTENT TO VARIABLES FOR EASE OF USE
$date = explode("|", $row['date']);
$name = $row['name'];
$comment = $row['comment'];
$email = $row['email'];
$website = $row['website'];
$aim = $row['aim'];
$msn = $row['msn'];
$yahoo = $row['yahoo'];
$hideemail = $row['hideemail'];
$ip = $row['ip'];
$avatar = $row['avatarurl'];
$avatarheight = $row['avatarheight'];
$avatarwidth = $row['avatarwidth'];
$location = $row['location'];
if (!isset($cmd)){
echo "
<tr class=\"windowbg2\"><td style=\"width: 27%;\" valign=\"top\"><b>$name</b><br>";
if ($avatar == "") {
} else {
echo "<br><img src=\"$avatar\" width=\"$avatarwidth\" height=\"$avatarheight\"></img>";
}
if ($location !="") {
echo "<br>Location: $location";
}
//Can the user see the IP's of posters?
if(session_is_registered('ub2')){
echo "<br><br>$ip";
}
//Email Hidden?
if ($hideemail != "h") {
if ($row['links'] != "images"){
echo "<a href=\"mailto: $email\">[email]</a>";
} else {
echo '<a href="mailto: '.$email.'"><img src="'.$row['email'].'" border="0"></a>';
}
}
//Got Aim?
if ($aim != ""){
if ($row['links'] != "images") {
echo " <a href=\"aim:goim?screenname=$aim&message=Hello\">[aim]</a>";
} else {
echo '<a href="aim:goim?screenname='.$aim.'&message=Hello"><img src="'.$row['aim'].'" border="0"></a>';
}
}
//How about MSN then?
if ($msn != ""){
if($row['links'] != "images") {
echo ' <font title="$msn" alt="'.$msn.'">[msn]</font>';
} else {
echo '<font title="$msn" alt="$msn"><img src="'.$row['msn'].'" border="0"></font>';
}
}
//Yahoo, final offer!
if ($yahoo != ""){
if ($row['links'] != "images") {
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target='.$yahoo.'">[yahoo]</a>';
} else {
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target='.$yahoo.'"><img src="'.$row['yahoo'].'" border="0">';
}
}
//Hey ladies, want my website?
if ($website != "") {
if ($row['links'] != "images") {
echo "<a href=\"$website\">[website]</a>";
} else {
echo "<a href=\"$website\"><img src=\"{$row['website']}\" border=\"0\"></a>";
}
}
echo '</td> <td valign="top">';
//DATE SYSTEM
$d = $row['date'];
$month = date("M");
$day = date("d");
$year = date("Y");
//MORE DATESYSTEN
echo 'Posted on ';
if ($date['0']==$month && $date['1']==$day && $date['3']==$year){
echo '<b>Today</b>';
} elseif ($date['0']==$month && $date['1']==$day-1 && $date['3']==$year){
echo '<b>Yesterday</b>';
} else {
echo '<b>'.$date['0'].' '.$date['1'].''.$date['2'].', '.$date['3'].'</b>';
}
echo ' at <b>'.$date['4'].'</b>';
}
echo "<br><br>";
if($row['bbcode'] == "on") {
echo emoticon(BBCode($comment));
} else {
echo emoticon($comment);
}
echo '
</td>
</tr>';
}
echo '
<table>
<br>';
//KWIK POST
if ($row['posting'] == "enabled") {
if ($row['kwikpost'] == "yes"){
if ($row['kwikpostlocation'] == "bottom"){
kwikpost();
}
}
}
echo '
'.$hf['footer'].'';
}
}
//COMMENT SYSTEM END
if($row['menubarlocation'] == "Bottom") {
echo '<br>';
guestbook_header();
}
copyright();
// FLUSH MEMORY BUFFER (CLEANER THEN LEAVING IT OUT)
ob_flush();
?>
I hate those errors as there so bland and I dunno what to do about them.
Thanks!
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Mon Aug 14, 2006 5:36 pm
change your or 'die(mysql_error())' to something like "or die('Mysql error in query at line ' . __LINE__ . ': ' . mysql_error());"
It will greatly assist you in debugging
MarK (CZ)
Forum Contributor
Posts: 239 Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:
Post
by MarK (CZ) » Mon Aug 14, 2006 5:51 pm
My guess is you're using bad values here:
Code: Select all
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
adamb10
Forum Commoner
Posts: 91 Joined: Sat Jun 24, 2006 7:44 pm
Post
by adamb10 » Mon Aug 14, 2006 6:24 pm
Doesnt make sense though. I removed a mysql function and changed the entire codebase to reflect that but the error still comes up.
adamb10
Forum Commoner
Posts: 91 Joined: Sat Jun 24, 2006 7:44 pm
Post
by adamb10 » Mon Aug 14, 2006 8:01 pm
I fixed the code a bit..
Code: Select all
<?
session_start();
//index.php
// START MEMORY BUFFER
ob_start();
//Load required files
require('sources/functions.php');
//COUNTER STSRT
$c_ip = $HTTP_COOKIE_VARS["user_ip"];
$counter_file = "sources/counter.txt";
$counter_file_line = file ($counter_file);
if (!$c_ip) {
setcookie("user_ip", $REMOTE_ADDR, time()+360000); $counter_file_line[0]++;
$cf = fopen ($counter_file, "w+");fputs($cf, "$counter_file_line[0]"); fclose($cf);
}
elseif ($c_ip != $REMOTE_ADDR){
$counter_file_line[0]++; $cf = fopen ($counter_file, "w+");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
}
//END COUNTER
//Essential Functions
db_connect();
//Query Settings Table
$result = mysql_query("SELECT * FROM settings") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$settings[$row['name']] = $row['value'];
}
//Query Colors table
$result = mysql_query("SELECT * FROM colors") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$colors[$row['name']] = $row['value'];
}
$result = mysql_query("SELECT * FROM images") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$images[$row['name']] = $row['value'];
}
$max_results = $row['maxshow'];
$from = ($page * $max_results);
$q1 = 'SELECT * FROM Bans'; //ban query
$r1 = mysql_query($q1) or die(mysql_error());
//Comment Query
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
$r = mysql_query($q) or die(mysql_error());
$result = mysql_query("SELECT * FROM hf") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$hf[$row['name']] = $row['value'];
}
//HF Query
if (!$hf) {
die('Invalid query: ' . mysql_error());
}
//QUERY END
//CSS BEGIN
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<head>
<title>'.$settings['title'].'</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a:link {
color: #'.$colors['link'].';
text-decoration: none;
}
a:visited {
color: #'.$colors['visitedlink'].';
text-decoration: none;
}
a:active {
color: #'.$colors['activelink'].';
text-decoration: none;
}
a:hover {
color: #'.$colors['hoverlink'].';
text-decoration: none;
}
body {
background-color: #'.$colors['bodybg'].';
font-family: '.$colors['fontfamily'].';
font-size: '.$colors['fontsize'].';
color: #'.$colors['font'].';
margin:0px;
';
if ($colors['bodybgimage'] != "") {
echo 'background-image: url('.$colors['bodybgimage'].');';
}
echo '
}
.titlebg {
background-color: #'.$colors['titlebg'].';
font-family: '.$colors['titlefontfamily'].';
font-size: '.$colors['titlefontsize'].';
color: #'.$colors['titlefont'].'; ';
if ($colors['tilebgimage'] == "") {
echo '
background-image: url('.$colors['titlebgimage'].');';
}
echo '
}
.windowbg {
background-color: #'.$colors['windowbg'].';
font-family: '.$colors['windowfontfamily'].';
font-size: '.$colors['windowfontsize'].';
color: #'.$colors['windowfont'].';';
if ($colors['windowbgimage'] != "") {
echo 'background-image: url('.$colors['windowbgimage'].');';
}
echo '
}
.windowbg2 {
background-color: #'.$colors['window2bg'].';
font-family: '.$colors['window2fontfamily'].';
font-size: '.$colors['window2fontsize'].';
color: #'.$colors['window2font'].';';
if ($colors['window2bgimage'] != "") {
echo 'background-image: url('.$colors['window2bgimage'].');';
}
echo '
}
.border {
background-color: #'.$colors['border'].';
}
td {
font-size: 11px;
}
input,textarea {
font-family: '.$colors['fontfamily'].';
font-size: 11px;
}
select {
font-family: '.$colors['fontfamily'].';
font-size: 11px;
}
p{margin: 0px;}
--!>
</style>
<title>'.$colors['title'].'</title>
</head>
<body>';
//CSS END
if ($_GET['action'] == "") {
getUserIp();
}
//echo out the Guestbook Header
if ($settings['menubarlocation'] == "Top") {
guestbook_header();
}
echo '<br><br><br>';
require('sources/actions.php');
//Check if this really is index.php.
if ($_GET['action'] == "") {
echo '<br>'.$hf['header'].'';
if($settings['posting'] == "enabled") {
if($settings['kwikpost'] == "yes"){
if($settings['kwikpostlocation'] == "top"){
kwikpost();
}
}
}
}
//PAGINATON STARTS HERE
if (!isset($_GET['page'])){
$page = 0;
} else {
$page = $_GET['page'];
}
if ($_GET['action'] == "") {
echo '<br><br>
<table style="width: 65%;" class="border" border="0" cellpadding="4" cellspacing="1" align="center">
<td class="titlebg" colspan="3" align="right">';
}
//COMMENT SYSTEM BEGIN
if($_GET['action'] == ""){
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM comments"),0);
// Figure out the total number of pages. Always round up using ceil()
$total_pages = floor(ceil($total_results / $max_results));
echo '<b><palign="right">Page:</b> ';
// Build Page Number Hyperlinks
if($page > 0){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";
}
for($i = 0; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
//Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a></p></td>";
}
{
while($row = mysql_fetch_array($r)){
//END PAGINATION, PROCEED TO NORMAL CODE
//TURN TABLE CONTENT TO VARIABLES FOR EASE OF USE
$date = explode("|", $row['date']);
$name = $row['name'];
$comment = $row['comment'];
$email = $row['email'];
$website = $row['website'];
$aim = $row['aim'];
$msn = $row['msn'];
$yahoo = $row['yahoo'];
$hideemail = $row['hideemail'];
$ip = $row['ip'];
$avatar = $row['avatarurl'];
$avatarheight = $row['avatarheight'];
$avatarwidth = $row['avatarwidth'];
$location = $row['location'];
if (!isset($cmd)){
echo "
<tr class=\"windowbg2\"><td style=\"width: 27%;\" valign=\"top\"><b>$name</b><br>";
if ($avatar == "") {
} else {
echo "<br><img src=\"$avatar\" width=\"$avatarwidth\" height=\"$avatarheight\"></img>";
}
if ($location !="") {
echo "<br>Location: $location";
}
//Can the user see the IP's of posters?
if(session_is_registered('ub2')){
echo "<br><br>$ip";
}
//Email Hidden?
if ($hideemail != "h") {
if ($settings['links'] != "images"){
echo "<a href=\"mailto: $email\">[email]</a>";
} else {
echo '<a href="mailto: '.$email.'"><img src="'.$images['email'].'" border="0"></a>';
}
}
//Got Aim?
if ($aim != ""){
if ($settings['links'] != "images") {
echo " <a href=\"aim:goim?screenname=$aim&message=Hello\">[aim]</a>";
} else {
echo '<a href="aim:goim?screenname='.$aim.'&message=Hello"><img src="'.$images['aim'].'" border="0"></a>';
}
}
//How about MSN then?
if ($msn != ""){
if($settings['links'] != "images") {
echo ' <font title="$msn" alt="'.$msn.'">[msn]</font>';
} else {
echo '<font title="$msn" alt="$msn"><img src="'.$images['msn'].'" border="0"></font>';
}
}
//Yahoo, final offer!
if ($yahoo != ""){
if ($settings['links'] != "images") {
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target='.$yahoo.'">[yahoo]</a>';
} else {
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target='.$yahoo.'"><img src="'.$images['yahoo'].'" border="0">';
}
}
//Hey ladies, want my website?
if ($website != "") {
if ($settings['links'] != "images") {
echo "<a href=\"$website\">[website]</a>";
} else {
echo "<a href=\"$website\"><img src=\"{$row['website']}\" border=\"0\"></a>";
}
}
echo '</td> <td valign="top">';
//DATE SYSTEM
$d = $row['date'];
$month = date("M");
$day = date("d");
$year = date("Y");
//MORE DATESYSTEN
echo 'Posted on ';
if ($date['0']==$month && $date['1']==$day && $date['3']==$year){
echo '<b>Today</b>';
} elseif ($date['0']==$month && $date['1']==$day-1 && $date['3']==$year){
echo '<b>Yesterday</b>';
} else {
echo '<b>'.$date['0'].' '.$date['1'].''.$date['2'].', '.$date['3'].'</b>';
}
echo ' at <b>'.$date['4'].'</b>';
}
echo "<br><br>";
if($settings['bbcode'] == "on") {
echo emoticon(BBCode($comment));
} else {
echo emoticon($comment);
}
echo '
</td>
</tr>';
}
echo '
<table>
<br>';
//KWIK POST
if ($settings['posting'] == "enabled") {
if ($settings['kwikpost'] == "yes"){
if ($settings['kwikpostlocation'] == "bottom"){
kwikpost();
}
}
}
echo '
'.$hf['footer'].'';
}
}
//COMMENT SYSTEM END
if($settings['menubarlocation'] == "Bottom") {
echo '<br>';
guestbook_header();
}
copyright();
// FLUSH MEMORY BUFFER (CLEANER THEN LEAVING IT OUT)
ob_flush();
?>
Same error though.
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Mon Aug 14, 2006 8:18 pm
Same error though.
Have you located the exact query which throws errors?
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Mon Aug 14, 2006 8:24 pm
remove ob_start()/ob_flush() no need for them and it will make debugging a hell of a lot easier.
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Mon Aug 14, 2006 8:41 pm
The particular error you are getting is commonly associated with either an insert query that has a blank value that the DB won't allow or when you are trying to use a single quote when there should be no single quote used. But before anyone else can do enything for you, you need to be able to pinpoint the exact query. Use Weirdan's suggestion...
Change these:
to these:
Code: Select all
or die('There was an error in the query at line ' . __LINE__ . ' of the script: ' . mysql_error());
Report back with the query so we can see what is going on.
adamb10
Forum Commoner
Posts: 91 Joined: Sat Jun 24, 2006 7:44 pm
Post
by adamb10 » Mon Aug 14, 2006 8:44 pm
The script says the error is on line 57...
lines 56-57...
Code: Select all
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
$r = mysql_query($q) or die('There was an error in the query at line ' . __LINE__ . ' of the script: ' . mysql_error());
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Aug 14, 2006 8:45 pm
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Mon Aug 14, 2006 8:53 pm
Maybe the same error. But not the same message
There was an error in the query at line 57 of the script:
And line 57 of your script is?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Aug 14, 2006 8:54 pm
Did you place that line
before the call to
mysql_query() ?
adamb10
Forum Commoner
Posts: 91 Joined: Sat Jun 24, 2006 7:44 pm
Post
by adamb10 » Mon Aug 14, 2006 8:55 pm
I posted line 57 a few posts up.
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Mon Aug 14, 2006 8:56 pm
change it to:
Code: Select all
$q = 'SELECT * FROM comments ORDER BY Date DESC LIMIT '.$from.', '.$max_results.'';
$r = mysql_query($q) or die('There was an error in the query at line ' . __LINE__ . ' of the script: ' . mysql_error() . ' Query: ' . $q);and let us know the output.
Last edited by
Jenk on Mon Aug 14, 2006 8:57 pm, edited 1 time in total.