Jump to content

Recommended Posts

The following code:

 

	function getItemsForSaleOfCatagory($itemCatagory)
{
	$query  = "SELECT vehicleID,vehicleName FROM vehiclesForSale WHERE vehicleCatagory = $itemCatagory AND isActive = 1";
	$result = mysql_query($query);
	if (!mysql_affected_rows($result)==0)
	{
		while($resultRow = mysql_fetch_array($result))
		{	
				echo"<br />";
				echo"<a href=\"index.php?page=browseSingleItem&vehicleID=".$resultRow[vehicleID]."\">";
					echo"$resultRow[vehicleName]";
				echo"</a>";	
		}
	}
	else
	{
		echo "There are curently not vehicles for sale under this category";
	}
}

 

Returns the following error:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\-\siteConfiguration.php on line 94

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\-\siteConfiguration.php on line 33
There are curently not vehicles for sale under this category
Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\-\siteConfiguration.php on line 46

 

I have added the affected rows in order not to run the query if there is no relevant data in the database...

Link to comment
https://forums.phpfreaks.com/topic/121371-solved-database-function-problems/
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.