Im unteren Code erzeugt es eine Warnung während der Ausführung. Warnung: mysqli_fetch_assoc() erwartet s Parameter 1 zu sein mysqli_result, Wie kann man das lösen?So lösen Sie diese Warnung: mysqli_fetch_assoc() erwartet s Parameter 1 zu sein mysqli_result, So lösen Sie diese
<?php
require '../smarty3/libs/Smarty.class.php';
$smarty = new Smarty;
class conn
{
public $conn = '';
public function fetchAll()
{
$sql = "SELECT * FROM test" ;
if(mysqli_query($this->conn,$sql))
{ return 'success'; }
else{ return 'error'; }
}
}
$db = new conn();
$record = $db->fetchAll();
if($record != 'error'){
while($row = mysqli_fetch_assoc($record))
{
header('location : view.tpl');
}
}else{ echo "No Records Found";}
$smarty->display('view.tpl');
?>
**View.tpl**
<table align = "center">
{section name = i loop = $row}
<tr> <td> {$smarty.section.i.rownum} </td>
<td> {$row[i].name} </td>
<td> {$row[i].country} </td>
</tr>
{/section}
</table>
Vielen Dank für alle guten Antworten.
Es funktioniert. Vielen Dank – himani