I stopped coding for like 5 months, and mostly forgot the advanced stuff. I made a Inventory search system for a company awhile back. I'm now trying to get each listing to show a camera icon if there is a image associated with that listing. So basically, There is the table the images url's are held, that are associated to the listings Called: Images, and the table that holds the listings Called: Listings. In the Images table, there is 3 rows, id, file (holds urls), and listing_id (holds the listings.id) I'm running a while(mysql_fetch_array) to create the list of inventory, so i figure if I just add the images rows to the query where the listings are queried, and just add to the area which displays each listing in text, if ($row[images.file] != "") { echo" Image found" }else{ echo "no image found" { but as soon as I try to add the images table to the Query it gives me a error on page, and lists no inventory: Heres the error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data/9/1/25/146/1351472/user/1449089/htdocs/ileap/admin/main.php on line 500
The code in red is what I added, and made the page display this error, it was working fine before this:
Code: Select all
}else{
$query = "SELECT listings.id, listings.request, listings.date_submitted, listings.sold, listings.item, listings.manufacturer_id, listings.model_id, listings.category_id, listings.condition_id, listings.hours,
listings.cost, listings.price, listings.inprogress, listings.serial, listings.servicedate, manufacturers.manufacturer, models.model, categories.category, images.file, images.listing_id,
FROM listings
JOIN manufacturers ON listings.manufacturer_id = manufacturers.id
JOIN categories ON listings.category_id = categories.id
JOIN models ON listings.model_id = models.id
JOIN images ON listings.id = images.listing_id
ORDER BY manufacturers.manufacturer, models.model, categories.category ASC";
}
$result = mysql_query($query);What am I doing wrong?
Everah | Please use [code] or [code={lang}] tags when posting code in the forms (where {lang} is the lowercase name of the language you are highlighting as.