Note that there are some explanatory texts on larger screens.

plurals
  1. POundefine variable errors in my code
    primarykey
    data
    text
    <p>Please help I'm new in coding php mysql This code is giving me errors like:</p> <blockquote> <p>Notice: Undefined index: name in C:\Program Files\EasyPHP-5.3.9\www\Authentication1\update1_ac.php on line 15</p> <p>Notice: Undefined index: surname in C:\Program Files\EasyPHP-5.3.9\www\Authentication1\update1_ac.php on line 15</p> <p>Notice: Undefined index: contact_number in C:\Program Files\EasyPHP-5.3.9\www\Authentication1\update1_ac.php on line 15</p> <p>Notice: Undefined index: email in C:\Program Files\EasyPHP-5.3.9\www\Authentication1\update1_ac.php on line 15</p> <p>Notice: Undefined index: position in C:\Program Files\EasyPHP-5.3.9\www\Authentication1\update1_ac.php on line 15</p> <p>Notice: Undefined index: user_name in C:\Program Files\EasyPHP-5.3.9\www\Authentication1\update1_ac.php on line 15</p> <p>Notice: Undefined index: password in C:\Program Files\EasyPHP-5.3.9\www\Authentication1\update1_ac.php on line 15 ERROR can not update data</p> </blockquote> <p>This is the code</p> <pre><code>&lt;?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password `enter code here` $db_name="administrator"; // Database name $tbl_name="players"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); if (isset($_POST['submit'])){ // update data in mysql database $sql="UPDATE $tbl_name ports SET name='".$_POST['name']."', Surname='".$_POST['surname']."', contact='".$_POST['contact_number']."', email='".$_POST['email']."', position='".$_POST['position']."', user_name='".$_POST['user_name']."', password='".$_POST['password']."' WHERE id='".$_POST['player_id']."'"; $result=mysql_query($sql); // if successfully updated. if(!empty($result)){ //The error is here echo "Successful"; echo "&lt;BR&gt;"; echo "&lt;a href='list2_player.php'&gt;View result&lt;/a&gt;"; } } else { echo "ERROR can not update data"; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload