Hi, i am actually new to PHP and mySQL, my employer gave me a job to modify a code. i have tried everything but couldn't able to find a solution.
i am getting the follwoing error on my page.
"
SQL/DB Error -- [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]
"
i don't know how to remove the error. I have the following sql command at the first line..
$queryarticle="select * from products $query order by product_id desc $limit";
I can post the whole page over here if any one required to c the real problem.
Please help me as soon as possible.
Thanks in advance
Regards,
Jigzyy
SQL/DB Error in PHP --- Please Help
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: SQL/DB Error in PHP --- Please Help
Modify the MySQL query call to something like mysql_query($query) or die(mysql_error() . '<br />' . $query) and get back to us for a more comprehensible error message.
Re: SQL/DB Error in PHP --- Please Help
Here is the complete Code..
<?php
include("includes/applicationtop.php");
include("includes/functions/funcatlist.php");
include("../includes/imageresize.php");
include("includes/operations/productoperations.php");
if($remove != "")
{
$total = 0;
$queryarticle="select * from products $querry order by product_id desc $limit";
$rowarticle=$db->get_results($queryarticle,ARRAY_A);
if(isset($rowarticle))
foreach($rowarticle as $arrarticle)
{
$checkbox = "check".$arrarticle[product_id];
if(isset($_REQUEST[$checkbox]))
{
$querydel="delete from tbl_extra_field_values where productid='$arrarticle[product_id]'";
$db->query($querydel);
$querysel="select * from products where product_id='$arrarticle[product_id]'";
$rowsel=$db->get_row($querysel,ARRAY_A);
$querydeletetax="delete from tbl_product_taxes where product_fid='$arrarticle[product_id]'";
$db->query($querydeletetax);
$normalimage="uploadfiles/imgproducts/".$rowsel[product_image];
$thumbimage="uploadfiles/imgproducts/".$rowsel[product_thumbnail];
@unlink($normalimage);
@unlink($thumbimage);
$total += 1;
mysql_query("DELETE FROM products WHERE product_id = '".$arrarticle[product_id]."' ");
}
}
$msg = $total." Product(s) have been Deleted";
$msg = base64_encode($msg);
header("location:productslist.php?msg=$msg");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin Panel</title>
<style type="text/css">
@import"css/style.css";
</style>
<link rel="stylesheet" href="css/blue.css" type="text/css" title="blue">
<link rel="alternate stylesheet" type="text/css" href="css/red.css" title="red">
<link rel="alternate stylesheet" type="text/css" href="css/green.css" title="green">
<link rel="alternate stylesheet" type="text/css" href="css/pink.css" title="pink">
<script type="text/javascript" src="js/styleswitcher.js"></script>
<script type="text/javascript" src="js/validationscript.js"></script>
</head>
<body>
<center>
<table border="1" align="center" cellpadding="0" cellspacing="0" id="maintable">
<tr>
<td colspan="2" height="100"><?php include("includes/header.php")?>
</td>
</tr>
<tr>
<td colspan="2"><?php include("includes/changecolor.php")?>
</td>
</tr>
<tr>
<td class="leftmenucol1" align="left" valign="top" ><?php include("includes/leftmenu.php")?>
</td>
<td class="leftmenucol2" align="left" valign="top" ><table cellpadding="2" cellspacing="0" border="0" width="100%" id="internaltable">
<tr>
<td colspan="3"><h4>Products List</h4></td>
</tr>
<tr>
<td colspan="3" align="center" ><h2><?php echo $authauseremail;?></h2></td>
</tr>
<tr>
<td colspan="3" align="center"><form name="productreview" action="" id="productreview" method="post">
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="10" align="right" style="padding-right:5px" id="txtlebel">
<table align="left" cellpadding="2" cellspacing="2">
<tr><td> <span><a href="#" onclick="checkall3('deletecheckbox')" id="check">All</a> , <a href="#" onclick="uncheckall3('deletecheckbox')" id="uncheck">None</a></span></td>
<td> <input type="submit" name="remove" id="remove" value="Delete Selected" style="font-size:9px;color:#28710F;" /></td></tr></table>
Search: <input type="text" name="search" id="search" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;" value="<?php echo $search;?>" />
Categories:
<select name="filter" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;">
<option value="" >TOP</option>
<?php
$queryselopt="select * from categories where parent_id=1";
$arrselopt=$db->get_results($queryselopt,ARRAY_A) ;
if(isset($arrselopt))
foreach($arrselopt as $rowselopt)
{
$productcount=productcount($rowselopt[category_id]);
echo '<optgroup label='.$rowselopt[category_name].' >';
echo categorylist($rowselopt[category_id]);
echo "</optgroup>";
}
?>
</select> <input type="submit" name="go" value="Search" style="font-size:9px;color:#28710F;" /></td>
</tr>
<tr>
<td colspan="4" align="right" style="padding-right:5px"></td>
</tr>
<tr>
<td width="4%" height="22" align="left"><h4>Sr.#</h4></td>
<td width="7%" align="left"><h4>Image</h4></td>
<td width="20%" align="left"><h4>Name</h4></td>
<td width="13%" align="left"><h4>Main Category </h4></td>
<td width="11%" align="left"><h4>Quantity In Stock</h4></td>
<td width="9%" align="left"><h4>Price($)</h4></td>
<td width="6%" align="left"><h4>Clicks</h4></td>
<td width="11%" align="left"><h4>Zone Info</h4></td>
<td width="10%" align="left"><h4>Avail for sale</h4></td>
<td width="9%" align="left"><h4>Action</h4></td>
</tr>
<tr>
<td colspan="10" align="right">
<table align="center" width="100%"><tr><td width="95%" align="center" style="color:#FF0000; text-decoration:blink; font-weight:bold"><?php echo base64_decode($msg); ?></td>
<td width="5%"><img src="images/icon/add_12.gif" onClick="window.location='products.php'" alt="" title="Add Products" /></td>
</tr></table></td>
</tr>
<?php
$query="";
if($filter!="")
{
$query=" where main_category='$filter'";
}
if($search!="")
{
if($query!="")
{
$query.=" where product_name like '$search'";
}
else
{
$query.=" where product_name like '$search'";
}
}
$querypaging="select count(*) as COUNT from products $query order by product_id desc";
$query_data = $db->get_row($querypaging,ARRAY_A);
$numrows = $query_data[COUNT];
$rows_per_page = $perductperpageadmin;
$lastpage= ceil($numrows/$rows_per_page);
$pageno = (int)$pageno;
if ($pageno < 1) {
$pageno = 1;
} elseif ($pageno > $lastpage) {
$pageno = $lastpage;
}
if($numrows==0)
{
$limit = 'LIMIT ' .($pageno).',' .$rows_per_page;
$i=$pageno+1;
}
else
{
$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
$i=$rows_per_page*($pageno - 1);
}
//*************************************************************************
$querymerchantlist="select * from products $query order by product_id desc $limit";
$rowmerchantlist=$db->get_results($querymerchantlist,ARRAY_A);
if(isset($rowmerchantlist))
foreach($rowmerchantlist as $arrmerchantlist)
{
$querymaincat="select * from categories where category_id=$arrmerchantlist[main_category]";
$rowmaincat=$db->get_row($querymaincat,ARRAY_A);
if($i%2==0)
{
$class="row2";
$style = "style='color:#FFFFFF;font-size:11px'";
}
else
{
$class="";
$style = "style='font-size:11px'";
}
$i++;
?>
<tr class="<?php echo $class;?>" id="txtlebel" onmouseover="this.style.backgroundColor ='#FEEA83'" onmouseout="this.style.backgroundColor =''" <?php echo $style; ?>>
<td> <input type="checkbox" name="check<?php echo $arrmerchantlist[product_id]; ?>" value="deletecheckbox" /> <?php echo $i;?> </td>
<td>
<?php
if($arrmerchantlist[product_image]!=""){
$imgpath="uploadfiles/imgproducts/".$arrmerchantlist[product_image];
$imgpath1="uploadfiles/imgproducts/".$arrmerchantlist[product_thumbnail];
?>
<img src="uploadfiles/imgproducts/<?php echo $arrmerchantlist[product_thumbnail];?>" alt="" width="28"
onMouseMove="document.getElementById('test<?php echo $arrmerchantlist[product_id]; ?>').style.display=''"
onMouseOut="document.getElementById('test<?php echo $arrmerchantlist[product_id]; ?>').style.display='none'" />
<?php }
if($arrmerchantlist[product_image] != "")
{
if(file_exists($imgpath))
{
$myimage = getimagesize($imgpath);
}
}
?>
<div style="display:none;position:absolute; border:solid 1px;border-color:#0066FF;" id="test<?php echo $arrmerchantlist[product_id]; ?>" > <img src="<?php echo $imgpath1; ?>" alt="" /> </div></td>
<td align="left" style="padding-left:5px; padding-right:5px;"><?php echo $arrmerchantlist[product_name];?> </td>
<td align="left"> <?php echo $rowmaincat[category_name];?> </td>
<td align="left"> <input type="text" name="qtystock<?php echo $arrmerchantlist[product_id];?>"
value=" <?php echo $arrmerchantlist[qty_stock];?>" onkeypress="return keynumber(event)" size="8" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;" /></td>
<td align="left"> <input type="text" name="productprice<?php echo $arrmerchantlist[product_id];?>"
value="<?php echo $arrmerchantlist[product_price];?>" onkeypress="return keynumber(event)" size="8" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;" /></td>
<td align="left"> <?php
$sqlpclicks = "select count(*) as pcount from tbl_productclicks where cproduct_id = '$arrmerchantlist[product_id]' ";
$rowpclicks = $db->get_row($sqlpclicks, ARRAY_A);
echo $rowpclicks[pcount];
?></td>
<td align="left"> Zone
(
<?php
$str = "";
if($arrmerchantlist[zone1] == 1) { $str .= " 1,"; }
if($arrmerchantlist[zone2] == 1) { $str .= " 2,"; }
if($arrmerchantlist[zone3] == 1) { $str .= " 3 "; }
echo $str;
?>
)
</td>
<td> <input type="checkbox" value="<?php echo $arrmerchantlist[avail_status] ?>" name="chk<?php echo $arrmerchantlist[product_id];?>" <?php if($arrmerchantlist[avail_status]=='1') {?> checked="checked" <?php } ?>/> </td>
<td> <img src="images/icon/jobedit.gif" onClick="window.location='products.php?editid=<?php echo base64_encode($arrmerchantlist[product_id]);?>'" alt="" title="Edit" />
<img src="images/icon/close.gif" onClick="return confirmdeleteproduct('<?php echo base64_encode($arrmerchantlist[product_id])?>')" alt="" title="Delete"> </td>
</tr>
<?php
} ?>
<tr>
<td colspan="10" align="left"><input type="submit" name="updateallproducts" value="Update" class="txtbutton" />
<input type="hidden" name="limit" id="limit" value="<?php echo $limit; ?>" />
<input type="hidden" name="querry" value="<?php echo $query; ?>" /></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="3" align="center" id="errormsg"><?php if(isset($msg)){ echo base64_decode($msg); }?>
</td>
</tr>
<tr>
<td colspan="3" align="center" class="paging"><?php
if($numrows >$rows_per_page)
{
if ($pageno == 1) {
echo " FIRST PREV ";
} else {
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1&filter=$filter&search=$search'>FIRST</a> ";
$prevpage = $pageno-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage&filter=$filter&search=$search'>PREV</a> ";
}
//........
echo " ( Page $pageno of $lastpage ) ";
//....................
if ($pageno == $lastpage) {
echo " NEXT LAST ";
} else {
$nextpage = $pageno+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage&filter=$filter&search=$search'>NEXT</a> ";
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage&filter=$filter&search=$search'>LAST</a> ";
}
}
?>
</td>
</tr>
</table></td>
</tr>
<tr>
<td></td>
<td valign="top"><?php include("includes/footer.php")?>
</td>
</tr>
</table>
</center>
</body>
</html>
<?php
include("includes/applicationtop.php");
include("includes/functions/funcatlist.php");
include("../includes/imageresize.php");
include("includes/operations/productoperations.php");
if($remove != "")
{
$total = 0;
$queryarticle="select * from products $querry order by product_id desc $limit";
$rowarticle=$db->get_results($queryarticle,ARRAY_A);
if(isset($rowarticle))
foreach($rowarticle as $arrarticle)
{
$checkbox = "check".$arrarticle[product_id];
if(isset($_REQUEST[$checkbox]))
{
$querydel="delete from tbl_extra_field_values where productid='$arrarticle[product_id]'";
$db->query($querydel);
$querysel="select * from products where product_id='$arrarticle[product_id]'";
$rowsel=$db->get_row($querysel,ARRAY_A);
$querydeletetax="delete from tbl_product_taxes where product_fid='$arrarticle[product_id]'";
$db->query($querydeletetax);
$normalimage="uploadfiles/imgproducts/".$rowsel[product_image];
$thumbimage="uploadfiles/imgproducts/".$rowsel[product_thumbnail];
@unlink($normalimage);
@unlink($thumbimage);
$total += 1;
mysql_query("DELETE FROM products WHERE product_id = '".$arrarticle[product_id]."' ");
}
}
$msg = $total." Product(s) have been Deleted";
$msg = base64_encode($msg);
header("location:productslist.php?msg=$msg");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin Panel</title>
<style type="text/css">
@import"css/style.css";
</style>
<link rel="stylesheet" href="css/blue.css" type="text/css" title="blue">
<link rel="alternate stylesheet" type="text/css" href="css/red.css" title="red">
<link rel="alternate stylesheet" type="text/css" href="css/green.css" title="green">
<link rel="alternate stylesheet" type="text/css" href="css/pink.css" title="pink">
<script type="text/javascript" src="js/styleswitcher.js"></script>
<script type="text/javascript" src="js/validationscript.js"></script>
</head>
<body>
<center>
<table border="1" align="center" cellpadding="0" cellspacing="0" id="maintable">
<tr>
<td colspan="2" height="100"><?php include("includes/header.php")?>
</td>
</tr>
<tr>
<td colspan="2"><?php include("includes/changecolor.php")?>
</td>
</tr>
<tr>
<td class="leftmenucol1" align="left" valign="top" ><?php include("includes/leftmenu.php")?>
</td>
<td class="leftmenucol2" align="left" valign="top" ><table cellpadding="2" cellspacing="0" border="0" width="100%" id="internaltable">
<tr>
<td colspan="3"><h4>Products List</h4></td>
</tr>
<tr>
<td colspan="3" align="center" ><h2><?php echo $authauseremail;?></h2></td>
</tr>
<tr>
<td colspan="3" align="center"><form name="productreview" action="" id="productreview" method="post">
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="10" align="right" style="padding-right:5px" id="txtlebel">
<table align="left" cellpadding="2" cellspacing="2">
<tr><td> <span><a href="#" onclick="checkall3('deletecheckbox')" id="check">All</a> , <a href="#" onclick="uncheckall3('deletecheckbox')" id="uncheck">None</a></span></td>
<td> <input type="submit" name="remove" id="remove" value="Delete Selected" style="font-size:9px;color:#28710F;" /></td></tr></table>
Search: <input type="text" name="search" id="search" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;" value="<?php echo $search;?>" />
Categories:
<select name="filter" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;">
<option value="" >TOP</option>
<?php
$queryselopt="select * from categories where parent_id=1";
$arrselopt=$db->get_results($queryselopt,ARRAY_A) ;
if(isset($arrselopt))
foreach($arrselopt as $rowselopt)
{
$productcount=productcount($rowselopt[category_id]);
echo '<optgroup label='.$rowselopt[category_name].' >';
echo categorylist($rowselopt[category_id]);
echo "</optgroup>";
}
?>
</select> <input type="submit" name="go" value="Search" style="font-size:9px;color:#28710F;" /></td>
</tr>
<tr>
<td colspan="4" align="right" style="padding-right:5px"></td>
</tr>
<tr>
<td width="4%" height="22" align="left"><h4>Sr.#</h4></td>
<td width="7%" align="left"><h4>Image</h4></td>
<td width="20%" align="left"><h4>Name</h4></td>
<td width="13%" align="left"><h4>Main Category </h4></td>
<td width="11%" align="left"><h4>Quantity In Stock</h4></td>
<td width="9%" align="left"><h4>Price($)</h4></td>
<td width="6%" align="left"><h4>Clicks</h4></td>
<td width="11%" align="left"><h4>Zone Info</h4></td>
<td width="10%" align="left"><h4>Avail for sale</h4></td>
<td width="9%" align="left"><h4>Action</h4></td>
</tr>
<tr>
<td colspan="10" align="right">
<table align="center" width="100%"><tr><td width="95%" align="center" style="color:#FF0000; text-decoration:blink; font-weight:bold"><?php echo base64_decode($msg); ?></td>
<td width="5%"><img src="images/icon/add_12.gif" onClick="window.location='products.php'" alt="" title="Add Products" /></td>
</tr></table></td>
</tr>
<?php
$query="";
if($filter!="")
{
$query=" where main_category='$filter'";
}
if($search!="")
{
if($query!="")
{
$query.=" where product_name like '$search'";
}
else
{
$query.=" where product_name like '$search'";
}
}
$querypaging="select count(*) as COUNT from products $query order by product_id desc";
$query_data = $db->get_row($querypaging,ARRAY_A);
$numrows = $query_data[COUNT];
$rows_per_page = $perductperpageadmin;
$lastpage= ceil($numrows/$rows_per_page);
$pageno = (int)$pageno;
if ($pageno < 1) {
$pageno = 1;
} elseif ($pageno > $lastpage) {
$pageno = $lastpage;
}
if($numrows==0)
{
$limit = 'LIMIT ' .($pageno).',' .$rows_per_page;
$i=$pageno+1;
}
else
{
$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
$i=$rows_per_page*($pageno - 1);
}
//*************************************************************************
$querymerchantlist="select * from products $query order by product_id desc $limit";
$rowmerchantlist=$db->get_results($querymerchantlist,ARRAY_A);
if(isset($rowmerchantlist))
foreach($rowmerchantlist as $arrmerchantlist)
{
$querymaincat="select * from categories where category_id=$arrmerchantlist[main_category]";
$rowmaincat=$db->get_row($querymaincat,ARRAY_A);
if($i%2==0)
{
$class="row2";
$style = "style='color:#FFFFFF;font-size:11px'";
}
else
{
$class="";
$style = "style='font-size:11px'";
}
$i++;
?>
<tr class="<?php echo $class;?>" id="txtlebel" onmouseover="this.style.backgroundColor ='#FEEA83'" onmouseout="this.style.backgroundColor =''" <?php echo $style; ?>>
<td> <input type="checkbox" name="check<?php echo $arrmerchantlist[product_id]; ?>" value="deletecheckbox" /> <?php echo $i;?> </td>
<td>
<?php
if($arrmerchantlist[product_image]!=""){
$imgpath="uploadfiles/imgproducts/".$arrmerchantlist[product_image];
$imgpath1="uploadfiles/imgproducts/".$arrmerchantlist[product_thumbnail];
?>
<img src="uploadfiles/imgproducts/<?php echo $arrmerchantlist[product_thumbnail];?>" alt="" width="28"
onMouseMove="document.getElementById('test<?php echo $arrmerchantlist[product_id]; ?>').style.display=''"
onMouseOut="document.getElementById('test<?php echo $arrmerchantlist[product_id]; ?>').style.display='none'" />
<?php }
if($arrmerchantlist[product_image] != "")
{
if(file_exists($imgpath))
{
$myimage = getimagesize($imgpath);
}
}
?>
<div style="display:none;position:absolute; border:solid 1px;border-color:#0066FF;" id="test<?php echo $arrmerchantlist[product_id]; ?>" > <img src="<?php echo $imgpath1; ?>" alt="" /> </div></td>
<td align="left" style="padding-left:5px; padding-right:5px;"><?php echo $arrmerchantlist[product_name];?> </td>
<td align="left"> <?php echo $rowmaincat[category_name];?> </td>
<td align="left"> <input type="text" name="qtystock<?php echo $arrmerchantlist[product_id];?>"
value=" <?php echo $arrmerchantlist[qty_stock];?>" onkeypress="return keynumber(event)" size="8" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;" /></td>
<td align="left"> <input type="text" name="productprice<?php echo $arrmerchantlist[product_id];?>"
value="<?php echo $arrmerchantlist[product_price];?>" onkeypress="return keynumber(event)" size="8" style="font-size:9px; border:solid 1px; border-color:#C7E5C3;color:#28710F;" /></td>
<td align="left"> <?php
$sqlpclicks = "select count(*) as pcount from tbl_productclicks where cproduct_id = '$arrmerchantlist[product_id]' ";
$rowpclicks = $db->get_row($sqlpclicks, ARRAY_A);
echo $rowpclicks[pcount];
?></td>
<td align="left"> Zone
(
<?php
$str = "";
if($arrmerchantlist[zone1] == 1) { $str .= " 1,"; }
if($arrmerchantlist[zone2] == 1) { $str .= " 2,"; }
if($arrmerchantlist[zone3] == 1) { $str .= " 3 "; }
echo $str;
?>
)
</td>
<td> <input type="checkbox" value="<?php echo $arrmerchantlist[avail_status] ?>" name="chk<?php echo $arrmerchantlist[product_id];?>" <?php if($arrmerchantlist[avail_status]=='1') {?> checked="checked" <?php } ?>/> </td>
<td> <img src="images/icon/jobedit.gif" onClick="window.location='products.php?editid=<?php echo base64_encode($arrmerchantlist[product_id]);?>'" alt="" title="Edit" />
<img src="images/icon/close.gif" onClick="return confirmdeleteproduct('<?php echo base64_encode($arrmerchantlist[product_id])?>')" alt="" title="Delete"> </td>
</tr>
<?php
} ?>
<tr>
<td colspan="10" align="left"><input type="submit" name="updateallproducts" value="Update" class="txtbutton" />
<input type="hidden" name="limit" id="limit" value="<?php echo $limit; ?>" />
<input type="hidden" name="querry" value="<?php echo $query; ?>" /></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="3" align="center" id="errormsg"><?php if(isset($msg)){ echo base64_decode($msg); }?>
</td>
</tr>
<tr>
<td colspan="3" align="center" class="paging"><?php
if($numrows >$rows_per_page)
{
if ($pageno == 1) {
echo " FIRST PREV ";
} else {
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1&filter=$filter&search=$search'>FIRST</a> ";
$prevpage = $pageno-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage&filter=$filter&search=$search'>PREV</a> ";
}
//........
echo " ( Page $pageno of $lastpage ) ";
//....................
if ($pageno == $lastpage) {
echo " NEXT LAST ";
} else {
$nextpage = $pageno+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage&filter=$filter&search=$search'>NEXT</a> ";
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage&filter=$filter&search=$search'>LAST</a> ";
}
}
?>
</td>
</tr>
</table></td>
</tr>
<tr>
<td></td>
<td valign="top"><?php include("includes/footer.php")?>
</td>
</tr>
</table>
</center>
</body>
</html>
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: SQL/DB Error in PHP --- Please Help
Ok, I'm not reading all that. You're probably best off finding out if you can track errors with whatever database interaction class you're using. If not, hard-code what I suggested earlier into the class code.
You need some way of ouputting the complete query which caused the error, because it will probably be something to do with the syntax of that query.
You need some way of ouputting the complete query which caused the error, because it will probably be something to do with the syntax of that query.