Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi,

 

I am building a website that holds cats for sale. I have a page that lists the cats but then I want to go to a page where there is more details about the cat via a link that shows the cats name.

 

It seems to work in principle and it takes you to the page associated with that cat. However I get this error:-

 

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in (then goes on to state the page name and line where the error is).

 

Here is my code:- CIN is Cat Idenfication Name

 

<?php
if (isset($_GET['CIN']) && is_string($_GET['CIN']) )

// Define the display kitten details query:
$query = "SELECT * FROM tbl_kittens_for_sale WHERE CIN={$_GET['CIN']}";
$display_kitten_details_result = mysqli_query($dbc, $query); // Run the query.
$rs_display_kitten_details = mysqli_fetch_array($display_kitten_details_result);
?>

 

Any help would be much appreciated.

 

Thanks

Link to comment
Share on other sites

Sorry for the delayed reply! It looks like it might be correct, although it'd be much better if you verified that $_GET['CIN'] was an integer greater than 0. 

 

I'd use the standard PHP-MySQL debugging approach here: print out the query being run and run it using another interface to see the results or error. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...