Forum Moderators: coopster
I am very new to PHP/MySQL.
I have created a very small test database called 'Goldenstar'
The database has various columns in it, one of which is called Prod_name. This column, as the name suggests, has the names (strings) of the products for a Chinese takeaway.
I have written the below script, and the only output I get from the browser is:
No its only Array
<?php$cxn=mysqli_connect("localhost","root","password","Goldenstar")
or die ("No Mushroom!");
$dish="Chicken Chop Suey";
$query = "SELECT prod_name FROM products";
$result = mysqli_query($cxn,$query)
or die ("Couldn't Execute Query Erdes!");
$row = mysqli_fetch_assoc ($result);
if ( $row['Prod_Name'] == "Chop Suey" )
{
echo "Yes its ". $row;
}
else
{
echo "No its only ". $row ."<br/>";
}
?>
I expected to see a list of the various Chinese dishes with
No its only Beef Curry etc until the script got to Chicken Chop Suey. Instead I just get No its only Array. Please help if you can. Thanks
Lee.
[edited by: eelixduppy at 10:45 pm (utc) on Mar. 19, 2008]
[edit reason] removed specifics [/edit]