First it connects, no problem with that.
Then it selects the database, no problem.
Then it runs the query... OH NOSE!!! Error!
OK, well fine, so I output the query I'm running right before I run it. If I copy and paste that into a different file and run it, it runs perfectly, no problem. Grrr wtf? I also try outputting dbuser, dbpass, and dbname, and they are all the correct values.
Code: Select all
$dbc=mysql_connect("localhost",$dbuser,$dbpass) or die ('Error: I cannot connect
to the database because: '.mysql_error());
mysql_select_db($dbname);
$instsql=file_get_contents("install.sql");
//Replace variables in the install file with values you filled in.
$instsql=str_replace("%tableprefix%",$table_prefix,$instsql);
$instsql=str_replace("%adminname%",$admin_user,$instsql);
$instsql=str_replace("%adminpass%",md5($admin_pass1),$instsql);
$instsql=str_replace("%adminemail%",$admin_email,$instsql);
if(mysql_query($instsql)) {
echo "Installation Successful<BR>";
} else {
echo "Error while running SQL Query<BR>";
}
mysql_close($dbc);