Retrieving a data from a table. the table has only one filed.
table name: qupdate
filed: last_update
but I am getting Warning:mysql_r esult() expects parameter 2 to be long, string...
on this line,
the following code not executing...
I have run the code on my local server (wamp) php 5.2.5. it runs without any problem.
when I uploaded the code on the web server, (PHP Version 5.5.18) I am getting this warning and the following code not executing.
full code:
how to fix this?
table name: qupdate
filed: last_update
Code:
$sql4="SELECT * FROM qupdate"; $result4=mysql_query($sql4); $last_update=mysql_result($result4,"last_update");
on this line,
Code:
$last_update=mysql_result($result,"last_update");
Code:
if($last_update==$today)
{
$cqid=mysql_result($result,"cqid");
$update1="update cquestions set showdate='$tomorrow' where showdate='0000-00-00' and cqid!='$cqid' order by cqid limit 2";
mysql_query($update1);
}
when I uploaded the code on the web server, (PHP Version 5.5.18) I am getting this warning and the following code not executing.
full code:
Code:
<?php
$today=date("Y-m-d");
mysql_query("SET CHARACTER SET utf8");
echo "<form method='post' id='submit' action='checkresult2.php'>";
$sql="SELECT * FROM cquestions where showdate='$today' limit 1,1";
$result=mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
echo "<p>" . $row['cqtext'] . "</p>";
$sql2="SELECT * FROM canswers where cqid=".$row['cqid'];
$result2=mysql_query($sql2);
while($row2=mysql_fetch_assoc($result2))
{
echo "<input type='radio' name='".$row['cqid']."' value='".$row2['cqans']."' />".$row2['aatext'];
echo"<br>";
}
}
$tomorrow= date("Y-m-d", strtotime("tomorrow"));
$sql4="SELECT * FROM qupdate";
$result4=mysql_query($sql4);
$last_update=mysql_result($result4,"last_update");
if($last_update==$today)
{
$cqid=mysql_result($result,"cqid");
$update1="update cquestions set showdate='$tomorrow' where showdate='0000-00-00' and cqid!='$cqid' order by cqid limit 2";
mysql_query($update1);
$update2="update qupdate set last_update='$tomorrow'";
mysql_query($update2);
$sql3="SELECT * FROM qupdate";
$result3=mysql_query($sql3);
$last_update=mysql_result($result3,"last_update");
}
echo"<br>";
echo"<br>";
echo "<div align='left' style='padding-left:160px;'>";
echo"<input type='submit' id='submit' name='submit' value='التالي' />";
echo "</div>";
echo "</form>" ;
?>
Comment