I am trying to make a script so you can edit different entries in mysql by the id number. Whenever I use this code, i get a Resource id #2. I have searched this forum, and the posts i read make no sense. I am a N00b at php, so any help would be good.
Notice: Use of undefined constant id - assumed 'id' in /web/admin/test.php on line 11
is an error I get. I have no Idea what this means.
i wanna have it be like http://www.whatever.com/update.php?id=1
<?PHP
$id = $_GET['id'];
$db = mysql_connect("localhost", "root");
mysql_select_db("events" , $db) or die("Couldn't open $db: ".mysql_error());
$query = 'SELECT * FROM events WHERE id="$id"';
$result=mysql_query($query);
while ($row = mysql_fetch_array($result)){
echo $row['fieldname'];
echo $row['fieldname'];
//where fieldname is the name of the field int he database.
}
?>