|
Posted by kirke on 10/23/06 22:16
Hi,
I want to write such code :
// receive and save the variable as Engine ID
$EngineID = (int)$_POST['EngineType'];
dbconnect();
// In the file named dbo_J1708Vehicle, I want to get the list of
numbers in the column of iVehicleID
$sql = "SELECT iVehicleID FROM dbo_J1708Vehicle
WHERE iEngineTypeId = $EngineID";
$result = mysql_query($sql) or die();
$row = mysql_fetch_array($result)
// In drop-down box, I want to show the numbers in the file named
dbo_Vehicle, in the column of sDescriotion where iID= iVehicleID value
in prev result.
$sql2 = "SELECT * FROM dbo_Vehicle WHERE (iID) in ($row)";
$result2 = mysql_query($sql2) or die();
while( $row2 = mysql_fetch_array($result2) )
{
echo '<option
value="'.$row2['sDescription'].'">'.$row2['sDescription'].'</option>';
}
However, as you guess, it doesn't work. My another guess is.
$EngineID = (int)$_POST['EngineType'];
dbconnect();
$sql = "SELECT iVehicleID FROM dbo_J1708Vehicle
WHERE iEngineTypeId = $EngineID";
$result = mysql_query($sql) or die();
$row = mysql_fetch_array($result)
while( $row = mysql_fetch_array($result) )
{
$sql2 = "SELECT * FROM dbo_Vehicle
WHERE iID = .$row";
$result2 = mysql_query($sql2) or die();
$row2 = mysql_fetch_array($result2)
echo '<option
value="'.$row2['sDescription'].'">'.$row2['sDescription'].'</option>';
}
However, also i doesn't work. Do you guys have any idea?
Thx alot.
Navigation:
[Reply to this message]
|