I'm really stumped here. I am running two website on two different web host servers. I am using the exact same php script at both places, but it works on one but not the other?? I checked phpinfo on both, and they are very identical. The webhost that runs the php code fine has php 4.4.4, and the one that does not work has php 4.4.1 - I don't think that will affect anything?
Anyway - I have a small script that inserts records into a table on both websites - is there anything I'm missing that causes it not to work on one of the webhost? Here's the code, with the username, password and database censored:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
$dbh=mysql_connect ("localhost", "xxxx", "xxxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("xxxx");
if ($submit) {
for ($i = 1; $i <= 10; $i++) {
$sql = "INSERT INTO phpbb_forums_watch (forum_id, user_id, notify_status) VALUES ('$i','$user_id','0')";
$result = mysql_query($sql);
}
?>
<p>Update completed for user id <?= $user_id; ?></p>
<?php
} else {
?>
<form action="<?= $PHP_SELF; ?>" method="post">
User ID: <input type="text" size="8" maxlength="8" name="user_id"><br />
<input type="submit" name="submit" value=" Go!">
</form>
<?
}
?>
</body>
</html>