I have an INSERT.. SELECT statement that works fine at the Mysql command line, but returns nothing when run from the web page. The page just flashes (like it is doing something), and fails to do the insert.
I did put in a bit of code that would perform a select on the new users database and another that would select from the registered members database and they both work fine (I have since removed them), but cannot get any insert, update or delete to work.
I know that it must be a configuration problem in mysql, but don't know where to go to fix it.
I created duplicate databases on a linux machine here and the pages work just fine, but as I said, they fail on the production machine.
Here is the code:
Code: Select all
<?php
include('../includes/config.inc');
$page_title = "Move New Users to Registered User DB";
include('../includes/admin_header.html');
require_once ('../../authentication.php');
if (isset($_SESSIONї'username'])) {
if ($authorized) {
include('../../mysql_connect.php');
echo '<h1>Copy New User to Registered User DB</h1><br />';
if (isset($submit)) {
$query="INSERT INTO users (username, realname, level, email, msn, aol, registration_date, player_type, password) SELECT username, realname, level, email, msn, aol, registration_date, player_type, password FROM newusers where username='$user_name'";
$result=mysql_query($query);
if ($result) {
echo 'New Member Moved to Registered Users Database';
} else {
echo "Insert failed for New User";
}
}
?>
<form action="<?php ($_SERVERї'PHP_SELF']); ?>" method="post">
<fieldset>
USER NAME:<input name="user_name" type="text" /><br />
</fieldset>
<div align="center"><input type="submit" name="submit" value="MOVE USER" /></div>
</form>
<?php
}
}
include('../includes/admin_footer.html');
?>Any Ideas??