Dabrowski
3-12-06, 06:56 PM
I can't figure out how to connect properly using MySQL 5. My host upgraded a week ago, but my site had issues just yesterday. Now, when I make a connection, nothing outputs to the browser. I see that there is something about a strict mode in MySQL, and I'm wondering if that could be part of the problem.
Here is a test script that pretty much strips down the problem:
<?php
echo '<p>before connection</p>';
//$please_connect = 1;
if ($please_connect == 1){
mysql_connect ("localhost", "user", "pass") or die(mysql_error());
mysql_select_db ("name");
} else {
echo '<p>you did not ask to connect.</p>';
}
echo '<p>after connection</p>';
?>
If $please_connect is set, then nothing outputs to the browser, not even the text before the connection. And there is no error, so the connection does go through.
If it is commented out, then naturally, it outputs "before connection, you did not ask to connect," and "after connection."
Anyone have any ideas?
Here is a test script that pretty much strips down the problem:
<?php
echo '<p>before connection</p>';
//$please_connect = 1;
if ($please_connect == 1){
mysql_connect ("localhost", "user", "pass") or die(mysql_error());
mysql_select_db ("name");
} else {
echo '<p>you did not ask to connect.</p>';
}
echo '<p>after connection</p>';
?>
If $please_connect is set, then nothing outputs to the browser, not even the text before the connection. And there is no error, so the connection does go through.
If it is commented out, then naturally, it outputs "before connection, you did not ask to connect," and "after connection."
Anyone have any ideas?