Forum Moderators: coopster
Warning: mysqli_stmt::fetch() [mysqli-stmt.fetch]: Couldn't fetch mysqli_stmt in /home/#*$!/#*$!/htdocs/projects/page/script.php on line 100
$db = new mysqli('X', 'X', 'X', 'X');
$db -> query("SET NAMES 'latin2'");
$stmt = $db->stmt_init();
if($stmt->prepare("SELECT `table`, `table2`, `table3`, `table4` FROM `database` WHERE `user` = ?")) {
$stmt->bind_param('s', $u);
$u = "$username";
$stmt->execute();
$stmt->bind_result($a_var, $b_var, $c_var, $d_var);
while($stmt->fetch()) {
echo '
<tr class="main_row_color">
<td style="width:2%;"><a href="#" style="color: #fff;"><b>ID</b></a></td>
<td style="width:20%; padding-left: 10px;" colspan="2"><a href="#" style="color: #fff;"><b>Something</b></a></td>
<td style="width:20%;"><a href="" style="color: #fff;"><b>Something2</b></a></td>
<td style="width:20%;"><a href="" style="color: #fff;"><b>Status</b></a></td>
<td style="width:1%;"><b>Something3</b></td>
</tr>
<tr class="row1_color">
<td style="color: #000;"><font style="margin-left: 2px;">' . stripslashes($a_var) .'</font></td>
<td style="width:1%;"></td>
<td style="color: #7f7f7f;"><font style="margin-left: 5px;">' . stripslashes($b_var) .'</font></a></td>
<td><font style="margin-left: 5px;">' . stripslashes($c_var) .'</font></td>
<td style="color: #7f7f7f;"><font style="margin-left: 5px;">' . stripslashes($d_var) .'</font></a></td>
<td><center><input name="do[]" type="checkbox" id="do[]" value="287" class="searchreg"></center></td>
</tr>
<tr class="row2_color">
<td style="color: #000;"><font style="margin-left: 2px;">' . stripslashes($a_var) .'</font></td>
<td style="width:1%;"></td>
<td style="color: #7f7f7f;"><font style="margin-left: 5px;">' . stripslashes($b_var) .'</font></a></td>
<td><font style="margin-left: 5px;">' . stripslashes($c_var) .'</font></td>
<td style="color: #7f7f7f;"><font style="margin-left: 5px;">' . stripslashes($d_var) .'</font></a></td>
<td><center><input name="do[]" type="checkbox" id="do[]" value="286" class="searchreg"></center></td>
</tr>
';
$stmt->close();
$db->close();
}} else {
echo '<p>Error<br /></p><p>' . mysql_error() . '</p>';
}
$rowCount = 0;
while(...) {
...do stuff...
if($rowCount++ % 2 == 0) { //even rows
//print color one row
} else {
// print color two row
}
...do more stuff...
}
$db = new mysqli('x', 'x', 'x', 'x0');
$db -> query("SET NAMES 'latin2'");
$stmt = $db->stmt_init();
if($stmt->prepare("SELECT `table`, `table2`, `table3`, `table4` FROM `database` WHERE `user` = ?")) {
$stmt->bind_param('s', $u);
$u = "$username";
$stmt->execute();
$stmt->bind_result($a_var, $b_var, $c_var, $d_var);
while($stmt->fetch()) {
echo '
<tr class="">
<td style="width:2%;"><a href="#" style="color: #fff;"><b>ID</b></a></td>
<td style="width:20%; padding-left: 10px;" colspan="2"><a href="#" style="color: #fff;"><b>Something</b></a></td>
<td style="width:20%;"><a href="" style="color: #fff;"><b>Something2</b></a></td>
<td style="width:20%;"><a href="" style="color: #fff;"><b>Status</b></a></td>
<td style="width:1%;"><b>Something3</b></td>
</tr>
';
}
<tr class="here must be var">