rlb1 Posted November 5, 2007 Share Posted November 5, 2007 I have a variable: $row['Manufacturer']; that I need to include in a Select Statement: $resulty = mysql_query("select * from database WHERE Manufacturer order by rand() LIMIT 1,10") or die(mysql_error()); (If you echo the variable -- echo " ".$row['Manufacturer']; -- it produces the name of the Manufacturer.) How do I include a variable like .$row['Manufacturer']; in the select statement? Thanks for your help!! ALL of the code $resulty = mysql_query("select * from database WHERE Manufacturer order by rand() LIMIT 1,10") or die(mysql_error()); Print "<TABLE cellSpacing=0 cellPadding=2 width=765>"; while($rowy = mysql_fetch_array( $resulty )) { $pic = $rowy['URL_Image_Small']; Print "<TBODY>"; Print "<tr>"; Print "<TD class=listings>"; Print "<TABLE cellSpacing=0 cellPadding=2>"; Print "<TBODY>"; Print "<TR>"; Print "<TD>"; Print "<TD width=100><DIV class=image>"; Print "<img src=\"$pic\"></td> "; Print "<TD vAlign=top align=left>"; Print "<TABLE cellSpacing=0 cellPadding=2 width=600>"; Print "<TBODY>"; Print "<TR>"; Print "<TD height=30 width=600>"; Print "<A class=text_title title=".$rowy['Name'] . " href=/domain.com/stuff?id=".$rowy['id'] . " target=_top>"; Print "".$rowy['Name'] . "</A></TD>"; Print "<TD vAlign=top align=right width=100 rowSpan=3>"; Print "<DIV class=text_price>$".$rowy['Price'] . "</DIV></TD>"; Print "</TR>"; Print "<TR>"; Print "<TD height=25>"; Print "<SMALL>".$rowy['Description'] . "</SMALL> "; Print "<A title=".$rowy['Name'] . " href=domain.com/stuff?id=".$rowy['id'] . " target=_top>"; Print "<SMALL><i>more info</i></SMALL></A>..."; Print "</SMALL>"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; Print "</TD>"; Print "</TR>"; Print "</TBODY>"; Print "</TABLE>"; } Link to comment https://forums.phpfreaks.com/topic/76008-solved-select-statement-question/ Share on other sites More sharing options...
teng84 Posted November 5, 2007 Share Posted November 5, 2007 $resulty = mysql_query("select * from database WHERE Manufacturer ='{$row['Manufacturer']}' order by rand() LIMIT 1,10") Link to comment https://forums.phpfreaks.com/topic/76008-solved-select-statement-question/#findComment-384724 Share on other sites More sharing options...
rlb1 Posted November 5, 2007 Author Share Posted November 5, 2007 Thank You! It worked!! Link to comment https://forums.phpfreaks.com/topic/76008-solved-select-statement-question/#findComment-385016 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.