473,320 Members | 1,948 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,320 software developers and data experts.

Getting Info. for specific record?

Dear All;
I have table in vehicle.php file that contains vehicle information(plate number, vehicle model, reg. and exp. dates). I pprovided each record with href(more) if he want to know more about this specific vehicle in vehicle-info.php file. in vehicle-info.php I get the plateN and I pass it to the SQL command "Select * from $table where plateN = '$plateN';" However this was not working.
Can you guide me.
Thanks alots...
May 2 '07 #1
3 1879
Dear All;
I have table in vehicle.php file that contains vehicle information(plate number, vehicle model, reg. and exp. dates). I pprovided each record with href(more) if he want to know more about this specific vehicle in vehicle-info.php file. in vehicle-info.php I get the plateN and I pass it to the SQL command "Select * from $table where plateN = '$plateN';" However this was not working.
Can you guide me.
Thanks alots...

Hi!
Your post seems very abstract to me,. How can you query using SQL commads from a table that you have in vehicle.php file? Or do you mean to say that you have code in vehicle.php that query's your table in database? I am unable to understand.. If, you have a table in your database, then what you can do is :

Say you have a link for plate number in some page, then provide a link to this,

<a href='vehicle.php?plateN=$plateN'>Plate_number</a>

Now in vehicle.php

$plateN = $_GET['plateN'] ;
and for your query:

$result = mysql_query("SELECT * FROM table_name WHERE plateN = '$plateN' ");

And now you can use the fetched values. This ll work! But I dont know if this is what you are actually wanting to do! The reason is, I am unable to understan your post.

Regards
CyberKing
http://www.bytesandbytes.com
May 2 '07 #2
Hi;;
In vehicle.php I query some information about vehicle. Then there is a link bypass each record {more}. when a user click on it, the more detailed information about the vehicle will appeared in vehicle-info.php file. The problem was How can I get the specific infor for that record.
Here are my files:

vehicle.php
========
<html>
<head>
<title>Displaying Your Vehicles</title>
</head>
<body>
<?php

$host = "localhost";
$user = "";
$password = "";
$db = "DMV";
$table = "myvehicle";

mysql_connect($host,$user,$password) or die("Failed to connect");

mysql_select_db($db) or die("Failed to select database");


$sql = "SELECT * from $table ORDER BY platen ASC";

$result = mysql_query($sql);

if ($row = mysql_fetch_array($result))
{
echo "<p align=\"center\"><font size=\"5\" color=\"#FF0000\">&lt;&lt;Your Vehicles&gt;&gt;</font></p>";

echo
"<table border=\"1\" width=\"100%\" id=\"table1\">
<tr>
<th>
<p dir=\"ltr\">Plate Number</th>
<th>
<p dir=\"ltr\">Vehicle Model</th>
<th>
<p dir=\"ltr\">Registration Date</th>
<th>
<p dir=\"ltr\">Expire Date</th>
<th>
<p dir=\"ltr\">More Info.</th>
</tr>";


do {

echo "<tr>
</tr>";

echo " <tr>
<th>$row[0]</th>
<th>$row[1]</th>
<th>$row[2]</th>
<th>$row[3]</th>
<th><a href=My-Vehicle-info.php?=".$myrow[0].">More</th>
</tr>";

}
while($row = mysql_fetch_array($result));

echo"</table></div>";
}
else

echo "<p><i><b><font face=\"Chiller\" size=\"6\" color=\"#FF0000\">Sorry dear</font><font face=\"Chiller\" size=\"5\" color=\"#800000\">,
there is may be an error in our system, please contact us.</font></b></i></p>";
?>

</body>
</html>


vehicle-info.php
===========
<html>
<head>
<title>More Information</title>
</head>
<body>
<?php

$host = "localhost";
$user = "";
$password = "";
$db = "DMV";
$table = "myvehicleinfo";

mysql_connect($host,$user,$password) or die("Failed to connect");

mysql_select_db($db) or die("Failed to select database");

$plateN = $_GET["PlateN"];
$sql = "SELECT * from $table where plateN='$plateN'";

$result = mysql_query($sql);

if ($row = mysql_fetch_array($result))
{
echo "<p align=\"left\"><font face=\"Times New Roman\" size=\"5\">Detail information about your
<font color=\"#FF0000\">chosen Vehicle</font></p>";

echo
"<table border=\"1\" width=\"72%\" id=\"table1\" style=\"border-width: 0px\">
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">Plate Number:</th>
<td style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">$row[0]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">Plate Color:</th>
<td style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">$row[1]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">Plate Type:</th>
<td style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">$row[2]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">Vehicle Type:</th>
<td style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">$row[3]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">Vehicle Model:</th>
<td style=\"border-style: none; border-width: medium\">
<p dir=\"ltr\" align=\"left\">$row[4]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
Vehicle Color:</th>
<td style=\"border-style: none; border-width: medium\">$row[5]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
Manufactured Country:</th>
<td style=\"border-style: none; border-width: medium\">$row[6]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
Insurance Company:</th>
<td style=\"border-style: none; border-width: medium\">$row[7]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
Insurance Type:</th>
<td style=\"border-style: none; border-width: medium\">$row[8]</td>
</tr>
<tr>
<th width=\"161\" align=\"left\" style=\"border-style: none; border-width: medium\">
Contract Number:</th>
<td style=\"border-style: none; border-width: medium\">$row[9]</td>
</tr>";


while($row = mysql_fetch_array($result));

echo"</table></div>";
}
else

echo "<p><i><b><font face=\"Chiller\" size=\"6\" color=\"#FF0000\">Sorry dear</font><font face=\"Chiller\" size=\"5\" color=\"#800000\">,
there is may be an error in our system, please contact us.</font></b></i></p>";
?>

</body>
</html>
May 2 '07 #3
ak1dnar
1,584 Expert 1GB
Make it as a Hyperlink </a> is missing.
and you are not passing the PlateN to next page over the URL.
try this.
[PHP]<a href=My-Vehicle-info.php?PlateN=".$myrow[0].">More</a>[/PHP]
May 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Red Green | last post by:
I have a form with a datagrid and a dataset bound to it. I want to launch a second form and pass it a value from whichever record the user has selected. I can't find an example anywhere that shows...
8
by: narpet | last post by:
Hello all... I'm having a problem getting a query to work. As a matter of fact I can't even seem to get a good start. I have a table with the following example data ID# PRE_ID# ...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.