Okay
Here is my code, and in the html when I want to put a certain thing i put <? echo \"$whatever i want it to get\"; ?> Anyways this part works fine, what i cant get to work is this.
when i goto the page http://www.mydomain.com/index.php the data displayed is from the last row of the table whose id is 4, there are four rows. when i try this
http://www.mydomain.com/index.php?id=1 or 2 or 3, it still displays the last entry. How can I do it so I can make the contents of my desired row to appear by typing ?id= after the url?
<?
$db_name = \"dj\";
$table_name = \"music\";
$connection = @mysql_connect(\"localhost\", \"bimmer\", \"xxxxxxx\")
or die(\"Couldn\'t connect.\");
$db = @mysql_select_db($db_name, $connection)
or die(\"Couldn\'t select database.\");
$sql = \"SELECT *
FROM $table_name
ORDER BY id\";
$result = @($sql,$connection)
or die(\"Couldn\'t execute query.\");
while ($row = mysql_fetch_array($result)) {
$id = $row[\'id\'];
$image = $row[\'image\'];
$title = $row[\'title\'];
$artist = $row[\'artist\'];
$year = $row[\'year\'];
$label = $row[\'label\'];
$type = $row[\'type\'];
$comments = $row[\'comments\'];
}
?>
Someone suggested I do this:
$sql = \"SELECT *
FROM $table_name
WHERE id=$id
ORDER BY id\";
but when i do that i get an error
Any help will be appreciated,
Ray