Jump to content

[SOLVED] Display Error


mnybud

Recommended Posts

I have the following code:

 

<?php

mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("transmission") or die(mysql_error());
$ID=$_GET['ID'];

$query = "SELECT * FROM Auto_database_final ORDER BY ID ASC LIMIT $ID, $ID"; 

$result = mysql_query($query) or die(mysql_error());


$row = mysql_fetch_array($result) or die(mysql_error());
print "<h1>" . $row['year_maker_model']. " </H1><P><b>Model:</b> ". $row['submodel']. " <BR><br /><b>Body Style:</b> ". $row['body_style']. " <BR><br /><b>Engine:</b> ". $row['engines']. " <BR><br /> <b>". $row['year_maker_model']. " Transmission: </b>" . $row['transmissions']. " <BR><br /><b>DriveTrain:</b> ". $row['drivetrains']. " <BR><BR><b>Performance and Efficiency:</b> ". $row['performance_efficiency']. " <BR><br /><b>Handling and Breaking:</b> ". $row['handling_riding_beaking']. " <BR><br /><b>Exterior:</b> ". $row['exterior_aerodymamics']. " <br /><BR><b>Interior:</b> ". $row['interior'];
?>

 

It should display the data by the ID in the mysql database but it is always one off.....so page.php?ID=1 displays ID2 content and page.php?ID=2 displays ID3 content and so on. You can see it here... http://www.rebuilt-transmissions-fast.com/database3.php?page=1

 

I am assuming I have something wrong but I cant figure it out for the life of me....any help?

 

Link to comment
Share on other sites

Hello there mnybud,

 

I could be wrong on this one, but try the sql query as:

$query = "SELECT * FROM Auto_database_final ORDER BY ID ASC LIMIT 0, $ID"; 

Also try the following:

$query = "SELECT * FROM Auto_database_final ORDER BY ID ASC LIMIT $ID"; 

Link to comment
Share on other sites

Thanks but neither of those work for me.

When I use either one I just get the 1st record no matter what ID I put in the url.

 

I left it broke so you could look....

http://www.rebuilt-transmissions-fast.com/database3.php?page=1

http://www.rebuilt-transmissions-fast.com/database.php?ID=8

http://www.rebuilt-transmissions-fast.com/database.php?ID=22

Link to comment
Share on other sites

This is what I am trying to do....

 

I have this page setup which is working fine to display the links to the specific cars details.

http://www.rebuilt-transmissions-fast.com/database3.php?page=1

 

If you click one though you will see it displays the wrong car data, ID1 shows ID2, etc.

 

I tried all the solutions posted and many of my own and they all return just ID1 data not the correct ID's data.

 

That make sense?

 

the closest I have come to getting it right is with the code on my first post which is what is currently live.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.