I have this code.
For some reason, when I display the html, it wont show the values of the id column. There is a column, but theres no values in it. In the mysql table, there are three columns: “id”, “username” and “password”.
Can anybody help me?
include "Connector.php";
$query = "SELECT id, username, password FROM users";
$result = mysql_query("SELECT username, password FROM users") or die ("MySQL error: " .mysql_error());
echo "<table>";
while($row = mysql_fetch_array($result)){
echo "
<tr>
<td>"
.$row['id'].
"</td>
<td>"
.$row['username'].
"</td>
<td>"
.$row['password'].
"</td>";
echo "<td><a href='deleteRow.php?oId=".$row[password]."'>Delete</a></form></td>
</tr>";
}
echo "</table>";
mysql_free_result($result);
mysql_close($connection);
You don’t select the id column:
you are missing the id column on the mysql_query line. The $query variable isn’t used at all.
Let me guess… You copy pasted the code?
Do this: