Hmm...
PHP Code:
<?php
$password = "testpass";
$password = crypt($password);
// Define and execute query
$query = " INSERT INTO `accounts` (`user_id`, `username`, `password`, `email`) VALUES ('0', 'testing', '$password', 'webmaster@fnar.sytes.net'); ";
mysql_query($query);
// Define the query
$query2 = " SELECT * FROM `accounts` ORDER BY user_id DESC ";
$r = mysql_query($query2);
if (!$r) {
die ("<p>query did not run</p>");
} else {
while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) { print("<table><tr><td>user_id</td><td>username</td><td>password</td><td>email</td></tr>
<tr><td>" . $row['user_id'] . "</td><td>" . $row['username'] . "</td><td>" . $row['password'] . "</td><td>" . $row['email'] . "</td></tr></table>");
}
}
mysql_close(); // Close Db connection
?>
Try that... if it works, tell me and I'll explain what I did. (Just make sure to include the connection variables and all that, too, I excluded them here.)
By the way, for the record: you're getting a blank page because the browser sees nothing to display, meaning that the "while" statement isn't executing (and thusly, the if returned false), meaning that a) that code in the IF just doesn't work or b) there is nothing in the table to be returned by the query.
Last edited by Bloodsyne; 04-24-2005 at 07:33 AM..
|