Vivid Lust Posted December 22, 2007 Share Posted December 22, 2007 Heres the code: #select the specified database $rs = @mysql_select_db( "votick_banner", $conn ) or die( "Could not select database" ); Heres the link: http://imgsurf.wsnw.net/banner.php Help would be much apreciated Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/ Share on other sites More sharing options...
papaface Posted December 22, 2007 Share Posted December 22, 2007 Remove the @. NEVER EVER EVER EVER use the @ sign is what I say. Use this code: //select the specified database $rs = mysql_select_db( "votick_banner", $conn ) or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/#findComment-421199 Share on other sites More sharing options...
Vivid Lust Posted December 22, 2007 Author Share Posted December 22, 2007 Um, that doesnt work ??? Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/#findComment-421203 Share on other sites More sharing options...
freebsdntu Posted December 22, 2007 Share Posted December 22, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/#findComment-421204 Share on other sites More sharing options...
Vivid Lust Posted December 22, 2007 Author Share Posted December 22, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/#findComment-421205 Share on other sites More sharing options...
freebsdntu Posted December 22, 2007 Share Posted December 22, 2007 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()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/#findComment-421207 Share on other sites More sharing options...
papaface Posted December 22, 2007 Share Posted December 22, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/#findComment-421223 Share on other sites More sharing options...
PFMaBiSmAd Posted December 22, 2007 Share Posted December 22, 2007 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.) Quote Link to comment https://forums.phpfreaks.com/topic/82822-wont-select-datbase/#findComment-421230 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.