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.
I attached my vehicle-info.php
Thanks alots...

When you say it doesn't work what happens?

Dear;
The SQL error that I put as acondition it occurs.

What is the SQL error? That error message should tell you what is wrong and point you in the right direction towards fixing it.

I put the condition as following
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>";

what does this page output as an error??

Sorry dear,
there is may be an error in our system, please contact us.

I took a look at the code and the only things I can see is to check the spelling (case sensitive) of the Index in your $_GET array.

Personally I would change the if statement. check if your result variable contains any data, and move your fetch array down into the if block. Than add a mysql_error(); to your error at the end. This way if your query fails it will tell you what happened so you can fix it. As well I would enclose the code of your else statement in { and } to ensure proper processing. Otherwise evan when it works it will possibly show your error.

I.E.

$result = mysql_query($sql);
 
if ($result)
{
  $row = mysql_fetch_array($result);
 
  ... (Rest of code)
 
}
else
{
 
  ...error code here...
 
  mysql_error();
 
}

After you do that if you still have errors, they should be more detailed and we will be able to help you out furthur.

The problem now, that I can't view specific info. for specific record.
I wrote
$plateN = $_GET["PlateN"];
$sql = "SELECT * from $table where plateN='$plateN'";

But it does not retriev any data from my DB!

If you echo $plateN what do you get?? Is it blank?

Nothing happened :(

Ok so the problem is passing the info between the pages... What does the link look like on vehicle.php that sends you to vehicle-info.php ??

<th><a href=My-Vehicle-info.php?=".$myrow[0].">More</th>

That is your problem you do not define the veriable name in your link. Modify it to this and it should work:

<th><a href='My-Vehicle-info.php?PlateN=" . $myrow[0] . "'>More</a></th>

The same problem is remain.:(

After you click the link, goto the top of the page in the address bar and copy and paste the link you have starting at My-Vehicle-info.php right to the end.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.