I have a database containing two tables:
products_attributes ( id , image )options_values ( id , text )
The id value is the same in both tables. Now I need to output the text and the image based on the same id from both tables.
Then possibly base this on the loop. I have created something like this, but it doesn't work correctly.
$sqlquery = "SELECT * FROM products_attributes JOIN options_values WHERE BY
id=id ASC LIMIT 0,40";
$sqlresult = @mysql_query($sqlquery);
while ($content = mysql_fetch_array($sqlresult, MYSQL_NUM)) {
echo "<img src='$content[1]'/> $content[2]";
}
@EDIT
So the query ended up like this, however I can not get the attributes_image (table column name) to display. It does however work using the numerical system.
$sqlquery = "SELECT * FROM zen_products_attributes pa JOIN zen_products_options_values ov ON pa.options_values_id = ov.products_options_values_id LIMIT 0,40;";
$sqlresult = @mysql_query ($sqlquery);
while ($content = mysql_fetch_array($sqlresult, MYSQL_NUM)){
echo $content['attributes_image'];
;}