keep getting this error: Undefined index: id in C:\xampp\htdocs\Projeto\edit.php on line 5
But i checked phpmyadmin and i have a index for id, it's in the table. Why do I get this? Never happened before.

<?php

require 'conf/connection.php';

$id = $_GET['id'];

$choose_user = mysql_query("SELECT * FROM users WHERE id = '$id'");
$r = mysql_fetch_array($choose_user);

?>
Member Avatar for diafol

It's the fact that there is no url querystring.

Use this:

<?php
if(isset($_GET['id'])){ 
  require 'conf/connection.php';
 
  $id = $_GET['id'];
 
  $choose_user = mysql_query("SELECT * FROM users WHERE id = '$id'");
  $r = mysql_fetch_array($choose_user);
}
?>

You also need to clean your input - have a look at mysql_real_escape_string() in the php.net manual.

Problem solved! Thanks again!

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.