Help, I have a big probem. I wanto to read data from an mysql table and then write this data into a form so that the user can update this data. The code could seem somethin like this, but it doesn't work
<?php
include 'complete.php';
$user_name = "exa";
$password = "exa";
$database = "exa";
$server = "localhost";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT * FROM tb_exa WERE username='$CCGuser' AND password='$CCGpassw'";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
$nome=$db_field['name'];
$cognome=$db_field['gender'];
}
mysql_close($db_handle);
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
<table style="width: 100%">
<form action="process_u.php" method="post">
<tr>
<td>Name: </td>
<td> <input type="text" name="name" value="$nsme"></td>
</tr>
<tr>
<td>Gender: </td>
<td> <input type="text" name = "gender" value="$gender"></td>
</tr>
<input type="submit" value="GO" name="Submit"> <input type="reset" name="reset" value="Reset" /></td>
<td> </td>
</form></tr>
</table>
My problem is: How to read form the sql table and write the result on the form.
*the variables $CCGuser and $CCGpssw are written in complete.php (see top of the code) that's included in here