Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is your error</p> <pre><code>$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']."'"; </code></pre> <p>This wont work, as php thinks that in a "" (Double quote) string, $[variablename] means a variable. So it thinks you are trying to substitute the '$name' with the value of the variable called name, which obviously doesnt exist.</p> <p>MySQL doesnt need the $ sign to come before its variable name. Use this code instead</p> <pre><code>$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']."'"; </code></pre> <p>Also, the 'Surname' is capitalized, everything else is not. You may want to double check that, as its usually not recommended to capitalize column and variable names's first letter.</p> <p>Ps: Since you are new to PHP and MySQL, i should warn you that your code is vulnerable to a attack called the 'SQL Injection attack'. Its a trick for a hacker to execute their own SQL code on your server, you can read more about that <a href="http://php.net/manual/en/security.database.sql-injection.php" rel="nofollow">here</a>.</p> <p>I prefer to use PDO(PHP data object), it is easier to use it and it also allows me to use something called 'prepared statements', which are safe from SQL injection attacks. You can read more about PDO <a href="http://php.net/manual/en/book.pdo.php" rel="nofollow">here</a>. Or you can read a simple tutorial about it on <a href="http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/" rel="nofollow">nettuts+</a></p>
    singulars
    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.
    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