Hallo miteinander,
ich habe das Problem, dass wenn ich diesen Code ein zweites Mal auf der Page ausführen lasse, es mir diesen Error generiert:
Warning: mysqli_query() [function.mysqli-query]: Couldn't fetch mysqli in C:\Inetpub\vhosts\iarc.ch\httpdocs\Index.php on line 489
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\Inetpub\vhosts\iarc.ch\httpdocs\Index.php on line 489
Das hier ist der Code den ich geschrieben habe, das komische ist, dass er das erste Mal korrekt ausgeführt wird.
<?php
require_once "to_mysql.php";
// Query siteartefacts
$sqlCommand = "SELECT Question FROM Uquestion";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
// ------------------------------------------------------------------------------
// create the table of Artefacts and fill it with the DB content
if($query){
echo '<table style="width: 800px; height: 60px; text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="2">
<tbody>';
while($row = mysqli_fetch_array($query)){
echo '<tr align="left"><td align="left">' .
$row['Question'] . '</td><td align="left">';
echo '</tr>';
}
echo '</tbody></table>';
} else {
echo "Couldn't issue database query<br />";
echo mysqli_error($myConnection);
}
mysqli_close($myConnection);
?>
ich habe das Problem, dass wenn ich diesen Code ein zweites Mal auf der Page ausführen lasse, es mir diesen Error generiert:
Warning: mysqli_query() [function.mysqli-query]: Couldn't fetch mysqli in C:\Inetpub\vhosts\iarc.ch\httpdocs\Index.php on line 489
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\Inetpub\vhosts\iarc.ch\httpdocs\Index.php on line 489
Das hier ist der Code den ich geschrieben habe, das komische ist, dass er das erste Mal korrekt ausgeführt wird.

<?php
require_once "to_mysql.php";
// Query siteartefacts
$sqlCommand = "SELECT Question FROM Uquestion";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
// ------------------------------------------------------------------------------
// create the table of Artefacts and fill it with the DB content
if($query){
echo '<table style="width: 800px; height: 60px; text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="2">
<tbody>';
while($row = mysqli_fetch_array($query)){
echo '<tr align="left"><td align="left">' .
$row['Question'] . '</td><td align="left">';
echo '</tr>';
}
echo '</tbody></table>';
} else {
echo "Couldn't issue database query<br />";
echo mysqli_error($myConnection);
}
mysqli_close($myConnection);
?>
Kommentar