Jump to content

Recommended Posts

I basically have some code with queries my database and displays the results on a php webpage.

 

I have the following tables in my database:

 

term(id, term)

product(id, product)

join_table(term_id, product_id)

 

Here is my code:

 

$query1="SELECT term FROM term INNER JOIN join_table ON join_table.term_id=term.id INNER JOIN product ON join_table.product_id=product.id WHERE product = '$product1'";

$result1=mysql_query($query1) or die(mysql_error());

$row1 = mysql_fetch_array($result1);

while($row1 = mysql_fetch_array($result1)) {
echo $row1['term'];
}

 

This code display serveral terms on the screen. Is there any way in which i can save these into an array so that i can count how many terms are returned from the query.

 

 

Thanks :)

 

 

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.