problem during data fetch
here is my code
$sql="SELECT * FROM $tbl_name WHERE ownerId='$UserId'";
$result=mysql_query($sql,$link)or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC)
;
<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<tr>";
echo "<td>".$row['pinId']."</td>";
echo "<td>".$row['usedby']."</td>";
echo "<td>".$row['status']."</td>";
echo "</tr>";
}
?>
it is ignoring the first record means if 4 rows are in $row its igno开发者_Python百科ring the 1st one rest three are coming on page. ownerId is not primary key.
This problem is arising because you already called $row = mysql_fetch_array($result, MYSQL_ASSOC); once before looping..
try this code...
$sql="SELECT * FROM $tbl_name WHERE ownerId='$UserId'";
$result=mysql_query($sql,$link)or die(mysql_error());
<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<tr>";
echo "<td>".$row['pinId']."</td>";
echo "<td>".$row['usedby']."</td>";
echo "<td>".$row['status']."</td>";
echo "</tr>";
}
?>
all i have done is removed the 3rd line from your code....
精彩评论