OriginalSunny Posted March 6, 2006 Share Posted March 6, 2006 Hi, i need to extract info and display it. The only thing is i have 2 tables. As you can see below this code works when extracting info from one table. $query_food = "SELECT * FROM stock WHERE tariff='$_POST[interest]' AND prodDesc = 'paygo' ORDER BY tariff"; $result = mysql_query($query_food,$connect) or die ("query_food: ".mysql_error($connect)); This works as when the user selects a certain 'tariff' the above code selects the correct products. However i also want to do a query using the manufacturer name. But the 'maufacturer' is stated in another table called [i]stock_item[/i]. (if i therefore swap '[i]manufacturer[/i]' for '[i]tarrif[/i]' in the above code it wont work as 'manufacturer' is in a different table). So how do i do this?? The tables i have used are:stock(stockID, colour, modelnum, tariff, pic)stock_item(modelnum, manufacturer)Thanks. Link to comment https://forums.phpfreaks.com/topic/4268-how-to-get-data-from-mysql-using-php-from-2-tables/ Share on other sites More sharing options...
Barand Posted March 6, 2006 Share Posted March 6, 2006 Don't double-post. Read the forum guidelines. Link to comment https://forums.phpfreaks.com/topic/4268-how-to-get-data-from-mysql-using-php-from-2-tables/#findComment-14867 Share on other sites More sharing options...
Recommended Posts