renjith
03-10-2008, 12:47 AM
Please help me
This code shows an 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 '' at line 1
The code is given
<?php
include("config1.php");
$id=$_REQUEST['id'];
$q="Select SQL_CALC_FOUND_ROWS * from `vid_table` WHERE vid_id=$id";
$rs=mysql_query($q) or die(mysql_error());
while ($row=mysql_fetch_array($rs))
{
$cat = $row[2];
}
$ql="Select SQL_CALC_FOUND_ROWS * from `vid_table` WHERE vid_cat = '$cat'";
$rs1=mysql_query($ql) or die(mysql_error());
$i=0;
while ($row=mysql_fetch_array($rs1))
{
$id[$i] = $row[0];
$thum[$i] = "flvfiles/".$row[1];
$thumb[$i] = $thum[$i].'.png';
$fil[$i] = "flvfiles/".$row[1];
$file[$i] = $fil[$i].'.flv';
$cat[$i] = $row[2];
$i=$i + 1;
}
$i=$i-1;
?>
Here, the datatype $cat is VARCHAR.It shows the same error even when I give the value directly as this,
$ql="Select SQL_CALC_FOUND_ROWS * from `vid_table` WHERE vid_cat = 'new'";
This code shows an 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 '' at line 1
The code is given
<?php
include("config1.php");
$id=$_REQUEST['id'];
$q="Select SQL_CALC_FOUND_ROWS * from `vid_table` WHERE vid_id=$id";
$rs=mysql_query($q) or die(mysql_error());
while ($row=mysql_fetch_array($rs))
{
$cat = $row[2];
}
$ql="Select SQL_CALC_FOUND_ROWS * from `vid_table` WHERE vid_cat = '$cat'";
$rs1=mysql_query($ql) or die(mysql_error());
$i=0;
while ($row=mysql_fetch_array($rs1))
{
$id[$i] = $row[0];
$thum[$i] = "flvfiles/".$row[1];
$thumb[$i] = $thum[$i].'.png';
$fil[$i] = "flvfiles/".$row[1];
$file[$i] = $fil[$i].'.flv';
$cat[$i] = $row[2];
$i=$i + 1;
}
$i=$i-1;
?>
Here, the datatype $cat is VARCHAR.It shows the same error even when I give the value directly as this,
$ql="Select SQL_CALC_FOUND_ROWS * from `vid_table` WHERE vid_cat = 'new'";
