You are here: Re: Get data from two files « PHP Programming Language « IT news, forums, messages
Re: Get data from two files

Posted by kirke on 10/23/06 23:27

i found it. what i want to do is


require('conf.php');
$EngineID = (int)$_POST['EngineType'];

dbconnect();
$sql = "SELECT dbo_Vehicle.* FROM dbo_J1708Vehicle, dbo_Vehicle
WHERE dbo_J1708Vehicle.iEngineTypeId = $EngineID AND
dbo_J1708Vehicle.iVehicleID=dbo_Vehicle.iID";
$result = mysql_query($sql) or die();

while ($row = mysql_fetch_array($result))
{
echo '<option value="'.$row['sDescription'].'" >
'.$row['sDescription'].' </option>';
}



kirke wrote:
> 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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация