473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Get data from two files

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.

Oct 23 '06 #1
1 1084
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.
Oct 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nelson Minar | last post by:
I'm writing some code to upload photos to Flickr. The Photo Upload API requires documents be POSTed via a multipart/form-data request. I was surprised to learn that Python 2.3's HTTP clients don't...
2
by: Ivan | last post by:
Hi, SQL Server 2000 SP3 Windos 2000 Server SP4 I have a DTS package that imports data from a dBase IV databse with files located in two folders (dBF1 and dBF2). I use a transform data task...
15
by: Xarky | last post by:
Hi, Is it possible to make use of data files in C? If yes can someone tell how or suggest me a site from where I can learn them. Thanks in Advance for your patience.
3
by: eieiohh | last post by:
MySQL 3.23.49 PHP 4.3.8 Apache 2.0.51 Hi All! Newbie.. I had a CRM Open Source application installed and running. Windows Xp crashed. I was able to copy the contents of the entire hard...
12
by: Chris Springer | last post by:
I'd like to get some feedback on the issue of storing data out to disk and where to store it. I've never been in a production environment in programming so you'll have to bear with me... My...
11
by: E.T. Grey | last post by:
Hi, I have an interesting problem. I have a (LARGE) set of historical data that I want to keep on a central server, as several separate files. I want a client process to be able to request the...
0
by: george585 | last post by:
Hello! I am new to network programming, and understand just basics. Using some sample code, and having read documentation, I managed to create a simple app in C# and VB.NET. The application is...
9
by: LucasLondon | last post by:
Hi, Sorry, this is a bit of a lengthy one but I guess too much information is better than less! I have an excel worksheet that I update regulary with latest values from downloaded CSV files....
0
by: Winder | last post by:
Computer Data Recovery Help 24/7 Data recovering tools and services is our focus. We will recover your data in a cost effective and efficient manner. We recover all operating systems and media....
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.