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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.