Jump to content

Wont select datbase


Vivid Lust

Recommended Posts

Any reason why never use @? I use @ sign in this situation, it works fine.

 

I suggest you post the banner.php,Vivid Lust, according to the error message,something is wrong on the 6th line.

Also, did you do correctly with the database connection setup? Is your $conn successful? Just my 2 cents.

Link to comment
Share on other sites

That help:

 

<?php
#connect to MySQL
$conn = @mysql_connect( "----", "----", "----" )
or die( "Could not connect" )
#select the specified database
$rs = mysql_select_db( "votick_banner", $conn ) or die (mysql_error());
?>

 

connection is succesful. I added teh database after.

 

Try to add a ";" after your first die statement.

 

<?php
#connect to MySQL
$conn = @mysql_connect( "----", "----", "----" )
or die( "Could not connect" );
#select the specified database
$rs = mysql_select_db( "votick_banner", $conn ) or die (mysql_error());
?>

Link to comment
Share on other sites

Any reason why never use @? I use @ sign in this situation, it works fine.

 

I suggest you post the banner.php,Vivid Lust, according to the error message,something is wrong on the 6th line.

Also, did you do correctly with the database connection setup? Is your $conn successful? Just my 2 cents.

It will suppress any error messages that the function produces. Remove all @'s and put a ; on the msyql_connect

Link to comment
Share on other sites

The blank page you are getting is because of a fatal parse or a fatal runtime error. Most likely due to the missing ; that has already been mentioned. Though, if you have corrected that problem and are still getting blank pages, you likely have several more similar syntax errors.

 

When learning PHP, developing PHP code, or debugging PHP code, turn on full php error reporting in php.ini or a .htaccess file to get php to help you.

 

As to the use of @. The @ suppresses the generation of all errors from the statement. This even prevents writing the error to the log file, so you end up with code that both does not work and you have absolutely no record of what was not working.

 

In the case of a database connection, your database server could be experiencing intermittent problems. A visitor would get your or die() output message, but unless the site was experiencing the problem when you viewed it, you would not know it was even having a problem. So you could be loosing visitors and would never know why.

 

Well written, professional code, does not normally generate any runtime errors during its' execution. All possible input conditions are validated and tested. All function calls are checked to see if they failed or executed before using data that resulted from that function call...

 

In the case where something is beyond your control, such as a database server going down and a mysql_connect() function failing, you manage the generation of runtime errors using the error_reporting  and the display_errors settings. But please don't suppress the errors using the @ so that you have no record of the problem ever occurring (unless you have your own error logging in response to the FALSE value returned from the call to the function.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.