I'm trying to print data from mysql but get these error :
Warning: mysql_query() expects parameter 1 to be string, resource given in ..
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in ..
TCPDF ERROR: Some data has already been output, can't send PDF file
I have learn from these following links but still get warning:
- Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
- mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 to be resource or mysqli_result, boolean given
This is the code:
$con=mysql_connect('localhost','root','','bkd_rev');
$sql = 'select * from tbl';
$result = mysql_query($con,$sql);
if($result === FALSE) {
die(mysql_error());
}
while($row = mysql_fetch_array($result))
{
$id = $row['id'];
$nam = $row['name'];
$tbl .= '<tr>
<td>'.$id.'</td><td>'.$nam.'</td><td>
</tr>';
}