updating SQL using PHP
The message to screen is:
object(mysqli)[1]
public 'affected_rows' => null
public 'client_info' => null
public 'client_version' => null
public 'connect_errno' => null
public 'connect_error' => null
public 'errno' => null
public 'error' => null
public 'field_count' => null
public 'host_info' => null
public 'info' => null
public 'insert_id' => null
public 'server_info' => null
public 'server_version' => null
public 'stat' => null
public 'sqlstate' => null
public 'protocol_version' => null
public 'thread_id' => null
public 'warning_count' => null
No rows updated
My code is:
$connection = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
if (mysqli_connect_error()) {
die(`Connect Error: ` . mysqli_connect_error());
} else {
echo `Successful connection to MySQL <br />`;
$employ = $_POST['employer'];
$address = $_POST['flat'];
$login_name = $_POST['login_name'] ;
var_dump($connection);
// Insert employer and address into database row for logged in user.
$query = "UPDATE members SET employer = `$employ`, flat = `$address` WHERE login=`$login_name`";
if (!$result = $connection->query($query)) {
echo "No rows updated <br />";
} else {
echo $result . " row(s) successfully updated<br />";
}
}
?>
The form I am getting the information from is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<table width="100%" border="0" >
<tr>
<td colspan="2" style="background-color:#FFA500;">
</td>
</tr>
<td style="height:500px;width:400px; ">
<center>
<h2>Update</h2><br>
<form action="update.php" method="post">
<input type="hidden" name="login_name" value="$_SESSION['SESS_LOGIN']">
<p>employer <input type="text" name="employer"> </p>
<p>flat number <input type="text" name="flat"></p>
<p><input type="submit" value="Login" ></p>
</form>
</center>
</td>
</tr>
</table>
I've been trying to get this to work for days. The user logs into their profile and all of their information is then taken from the SQL database and then displayed onto the screen. The form above is to update their profile with specific information updating their row in the database for the next time they log in.