Im getting both errors (one or the other) when i modify my code.
Its either QUERY WAS EMPTY (which i dunno what it means)
Or its
QUOTE
Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE username = 'MrTouz'' at line 18
CODE
<?php
include ('include/connect.php');
foreach($_POST as $pn => $p) {
if(empty($p))
$p = '--EMPTY--';
$p = str_replace('"', '\\"', $p);
$p = str_replace("'", "\\'", $p);
}
$sql = ("UPDATE users_info SET
username='". $_POST['username'] ."',
sexe='". $_POST['sexe'] ."',
ddn='". $_POST['ddn'] ."',
codepostal='". $_POST['codepostal'] ."',
WHERE username = '$session->username' ");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header("Location: index.php?id=modif_cmpt");
?>
include ('include/connect.php');
foreach($_POST as $pn => $p) {
if(empty($p))
$p = '--EMPTY--';
$p = str_replace('"', '\\"', $p);
$p = str_replace("'", "\\'", $p);
}
$sql = ("UPDATE users_info SET
username='". $_POST['username'] ."',
sexe='". $_POST['sexe'] ."',
ddn='". $_POST['ddn'] ."',
codepostal='". $_POST['codepostal'] ."',
WHERE username = '$session->username' ");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header("Location: index.php?id=modif_cmpt");
?>
Obviously i dunno what i am doing
If anyone can make it cleaner and nicer... or find my error... god bless you !