some clarification with Databa communication using php,mysql
Posted: Tue Mar 10, 2009 8:28 am
$query="select * from emp where ename='$ename' and empno='$empno'";
print "<br>".$query;
$result=mysql_query($query);
print "<br>".$result."<br>";
//print if($result);
if($result)
{
print_r(mysql_fetch_array($result));
while($row=mysql_fetch_array($result))
{
echo "This is from Stalinreddy";
echo "<br>".$row['ename'];
}
}
in the above code with in the if loop only one statement (i.e if we write print_r() first then it will excuted other wise whil)either print_r() or while loop is excuted ,(both are not excuted),can any body give me a explanation
print "<br>".$query;
$result=mysql_query($query);
print "<br>".$result."<br>";
//print if($result);
if($result)
{
print_r(mysql_fetch_array($result));
while($row=mysql_fetch_array($result))
{
echo "This is from Stalinreddy";
echo "<br>".$row['ename'];
}
}
in the above code with in the if loop only one statement (i.e if we write print_r() first then it will excuted other wise whil)either print_r() or while loop is excuted ,(both are not excuted),can any body give me a explanation