gwh Posted December 6, 2009 Share Posted December 6, 2009 Hi everyone, I have the following code that selects two columns from my 'shirts' table but only where the shirtID is equal to the variable $itemID. $itemID = 4; mysql_select_db($database_localhost, $localhost); $query_rsShirts = "SELECT shirtDescLadies, shirtDescMen FROM shirts WHERE shirtID IS '$itemID"; $rsShirts = mysql_query($query_rsShirts, $localhost) or die(mysql_error()); $row_rsShirts = mysql_fetch_assoc($rsShirts); $totalRows_rsShirts = mysql_num_rows($rsShirts); In addition to this selection from my shirts table, I need the record set to select other columns also within the same table but I'm not sure how to add to the query code. I need to also select the following columns: shirtTitle shirtSKU shirtPrice shirtColours shirtSizes shirtImage Would I need to create a separate recordset or can someone tell me how to extend the code to encompass these other columns? Appreciate any advice. Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 6, 2009 Share Posted December 6, 2009 try this $query_rsShirts = "SELECT * FROM shirts WHERE shirtID IS $itemID"; Quote Link to comment Share on other sites More sharing options...
gwh Posted December 6, 2009 Author Share Posted December 6, 2009 Thanks for the reply, I only need the where clause to be applicable to two columns, ie. shirtDescLadies AND shirtDescMen With all the other columns I need every single record, so I'm not sure if your code would work. Any other suggestions? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.