Jump to content

displaying a table


addyp

Recommended Posts

hi guys I am having trouble displaying a table in a mySQL database

i get the error message

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /home/students/accounts/s7188633/hit3323/www/htdocs/Assiment2V2/main.php on line 47

 

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /home/students/accounts/s7188633/hit3323/www/htdocs/Assiment2V2/main.php on line 53

 

these are the two line that it realtes to

 

row  47: $Row = mysqli_fetch_row($result);

 

row  53: $Row = mysqli_fetch_row($result);

 

below is all the code if you wanted to look at it,

 

thanks

 

<?php

$choice = addslashes ($_POST["selection"]);

{

$DBConnect = @mysqli_connect("neptune.it.swin.edu.au", "*****", "***")

Or die("<p>Unable to connect to the database server.</p>"

. "<p>Error code " . mysqli_connect_errno()

. ": " . mysqli_connect_error()) . "</p>";

$DBName = "*****_db";

if (!@mysqli_select_db($DBConnect, $DBName))

echo "<p>The database is not available.</p>";

 

$SQLstring = "SELECT * FROM Books";// WHERE category = 'Programing'";

$QueryResult = @mysqli_query($DBConnect, $SQLstring)

Or die("<p>Unable to execute the query.</p>"

. "<p>Error code " . mysqli_errno($DBConnect)

. ": " . mysqli_error($DBConnect)) . "</p>";

$NumRows = mysqli_num_rows($QueryResult);

if ($NumRows == 0)

echo "<p>No records returned.</p>";

else

{

mysqli_select_db($DBConnect, $DBName);

 

  $SQLstring = "SELECT * FROM Books";

  $result = @mysql_query($DBConnect, $SQLstring);

 

$Row = mysqli_fetch_row($result);

do {

echo "<tr><td>{$Row[0]}</td>";

echo "<td>{$Row[1]}</td>";

echo "<td align='right'>{$Row[2]}</td>";

echo "<td align='right'>{$Row[3]}</td></tr>";

$Row = mysqli_fetch_row($result);

} while ($Row);

}

 

}

 

mysqli_close($DBConnect);

 

 

?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/216209-displaying-a-table/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.