I've got some info in a MySQL database...the name is "mycodingdb" and the table is called "programmers"...

I'm trying to create a variable in the URL (IE: "programmers.php?id=2"), so that I can then later on in the page tell the database to take that variable ($id=2 in this case), go into the SQL database, and pull out the record with the same ID as that variable, and post the info accordingly...

No matter what number I used after programmers.php?id= it simply displays the first record in the database...I tested it by just sticking the $id variable in the page and it came out just fine...displayed the same number in the URL...so the problem must lie in one of the SELECT commands I've got in there...

Here's some of the code I'm using...and of course I've taken out my actual password and username and replaced them with USERNAME and PASSWORD.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>

$db = @mysql_connect("localhost", "USERNAME", "PASSWORD");
if (!$db) {
echo( "&lt;p&gt;Unable to connect to the " .
"database server at this time.&lt;/p&gt;" ); exit();}
if (! @mysql_select_db("mycodingdb") ) {
echo( "&lt;p&gt;Unable to locate the " .
"database at this time.&lt;/p&gt;" ); exit();}

$result = mysql_query("SELECT ID FROM programmers WHERE ID LIKE $ID",$db);
if (!$result) {
echo("&lt;P&gt;Error performing query: " .
mysql_error() . "&lt;/p&gt;"); exit();}

$sql = "SELECT * FROM programmers";

$result = mysql_query($sql);

$myrow = mysql_fetch_array($result);

$Name = $myrow["Name"];

$Age = $myrow["Age"];

$Experience = $myrow["Experience"];

$Languages = $myrow["Languages"];

$Comments = $myrow["Comments"];

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

printf("&lt;b&gt;$Name&lt;/b&gt; - $Age years old - $Experience experience&lt;br&gt;&lt;b&gt;Languages: &lt;/b&gt;$Languages&lt;br&gt;
&lt;b&gt;Comments: &lt;/b&gt;$Comments&lt;br&gt;&lt;p&gt;\n", $myrow[1], $myrow[2], $myrow[3], $myrow[4]);

echo "$ID";



Any ideas on what's wrong? I don't get an error, it just only posts the first record in the DB...not the one corresponding the ID variable...this make any sense?

Chris Bowyer
MyCoding.com: Join our mailing list for launch notification!
"I'm not an insomniac, I'm a web designer."

[This message has been edited by jonese (edited June 14, 2000).]