Jump to content

Query code advice


gwh

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
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.