Hi Guys,
I wonder if you may help me querying my database for specific values that I need as follows:
db: db1
table: table1
I have the following fields in table1:
id, item_name, item_descrip, item_number, amount, active
my values for those fields are:
1, item1, something1, 1, 10, yes
2, item2, something2, 2, 20, yes
3, item3, something3, 3, 30, yes
4, item4, something4, 4, 40, yes
5, item5, something5, 5, 50, yes
6, item6, something6, 6, 60, yes
here is my php script:
$sql = mysql_query("SELECT * from table1 WHERE
active='yes' ORDER BY amount ASC Limit 2");
while($row = mysql_fetch_array($sql)) {
extract($row);
echo "<table width='100%' border='0' cellspacing='1' cellpadding='5' bgcolor='#CECFCE' >
<tr>
<td height='35' colspan='2' align='left' valign='middle'><span class='cat'><font class=text88><b>$item_name</b></font></span></td>
</tr>
<tr>
<td height='105' colspan='2' valign='top' bgcolor='#ffffff'>$item_descrip<br>";
if ($id==1){
echo "<img src='pic1.jpg' width='500' height='54' /></td></tr>";
}
else if ($id==2){
echo "<img src='pic2.jpg' width='500' height='76' /></td></tr>";
}
echo "<tr>
<td width='20%' height='25' align='left' valign='middle' bgcolor='#EDEDED'>item1:</td>
<td width='80%' align='left' valign='middle' bgcolor='#ffffff'> <span class='cat'><b>$amount</b></span></td>
</tr>
<tr>
<td height='25' align='left' valign='middle' bgcolor='#EDEDED'>item2:</td>
<td align='left' valign='middle' bgcolor='#ffffff'> <span class='cat'><b>$amount</b></span></td>
</tr>
<tr>
<td height='25' align='left' valign='middle' bgcolor='#EDEDED'>item3:</td>
<td align='left' valign='middle' bgcolor='#ffffff'> <span class='cat'><b>$amount</b></span></td>
</tr>
</table>
<br>";
I need just for the id==1 pic1.jpg and for id==2 pic2.jpg...
But, I wonder how can I get the amount values for ids: 1,2,3,4,5,6 item just for those id==1 and id==2.
I mean, let's say that I have 2 main options, which are id1 and id2: pro and lite.
and I'm having 6 items that can be either lite or pro.
So I'm querying the id1 and the id2, but I need the amount values for id1, id2, id3, id4, id5, id6.
Would you please help me with this?
Thanks in advance.
I wonder if you may help me querying my database for specific values that I need as follows:
db: db1
table: table1
I have the following fields in table1:
id, item_name, item_descrip, item_number, amount, active
my values for those fields are:
1, item1, something1, 1, 10, yes
2, item2, something2, 2, 20, yes
3, item3, something3, 3, 30, yes
4, item4, something4, 4, 40, yes
5, item5, something5, 5, 50, yes
6, item6, something6, 6, 60, yes
here is my php script:
$sql = mysql_query("SELECT * from table1 WHERE
active='yes' ORDER BY amount ASC Limit 2");
while($row = mysql_fetch_array($sql)) {
extract($row);
echo "<table width='100%' border='0' cellspacing='1' cellpadding='5' bgcolor='#CECFCE' >
<tr>
<td height='35' colspan='2' align='left' valign='middle'><span class='cat'><font class=text88><b>$item_name</b></font></span></td>
</tr>
<tr>
<td height='105' colspan='2' valign='top' bgcolor='#ffffff'>$item_descrip<br>";
if ($id==1){
echo "<img src='pic1.jpg' width='500' height='54' /></td></tr>";
}
else if ($id==2){
echo "<img src='pic2.jpg' width='500' height='76' /></td></tr>";
}
echo "<tr>
<td width='20%' height='25' align='left' valign='middle' bgcolor='#EDEDED'>item1:</td>
<td width='80%' align='left' valign='middle' bgcolor='#ffffff'> <span class='cat'><b>$amount</b></span></td>
</tr>
<tr>
<td height='25' align='left' valign='middle' bgcolor='#EDEDED'>item2:</td>
<td align='left' valign='middle' bgcolor='#ffffff'> <span class='cat'><b>$amount</b></span></td>
</tr>
<tr>
<td height='25' align='left' valign='middle' bgcolor='#EDEDED'>item3:</td>
<td align='left' valign='middle' bgcolor='#ffffff'> <span class='cat'><b>$amount</b></span></td>
</tr>
</table>
<br>";
I need just for the id==1 pic1.jpg and for id==2 pic2.jpg...
But, I wonder how can I get the amount values for ids: 1,2,3,4,5,6 item just for those id==1 and id==2.
I mean, let's say that I have 2 main options, which are id1 and id2: pro and lite.
and I'm having 6 items that can be either lite or pro.
So I'm querying the id1 and the id2, but I need the amount values for id1, id2, id3, id4, id5, id6.
Would you please help me with this?
Thanks in advance.