Jump to content

db4free.net MySQL connect error....


surf5502

Recommended Posts

i just started using MySQL and this is my frist program... i ve read numerous things on how to connect and i think i followed them all... and this is what i ended up with:

[color=orange]//connect to MySQL Database and add information into it[/color]
[color=blue]$username = "bchs";
$password = "mattward";
$database = "bchssurvey";
$hostaddr = "db4free.net:3307";

mysql_connect($hostaddr,$username,$password);
@mysql_select_db($database) or die("Error: Database not available. Please try again later.");

$query = "INSERT INTO survey VALUES('','$type','$isHomePage','$vstAthlet','$vstLinks','$vstEdline','$vstFacul','$vstLaptop','$vstPres','$vstPrinc','$vstCal','$eForms','$sMap','$bRSS','$facWS','$facClub','$facClubWS','$facCon','$facPic','$facEdline1','$facEdline2','$facEdline3','$facEdline4','$facEdline5','$aEdline','$chEdline','$announce','$eFac','$eFindFac','$stuHandouts','$stuWebteam','$stuWebteamN','$stuWebteamH','$otherWB','$conceptHP','$conceptCP','$conceptLike','$conceptNoLike','$comments')";

mysql_query($query);
mysql_close();
[/color]

any ideas of what i did wrong? i am actually programming an online survey for my school website (i am the new webmaster)... any questions about what i am trying to do please ask

i really need this thing to work asap

thanks everyone
Link to comment
https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/
Share on other sites

well besides the fact that the loading.... thing goes on for like 10 minutes... it then goes:


[color=blue]Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'db4free.net' (36) in /home/bchs/bchs-web/data/survey/finalize.php on line 10
Error: Database not available. Please try again later.[/color]


and thats my error for ya
ok so i got bored and re-coded it to MySQLi:

[color=blue]//connect to MySQL Database and add information into it
$username = "bchs";
$password = "mattward";
$database = "bchssurvey";
$hostaddr = "db4free.net:3306";

$connection = mysqli_connect($hostaddr,$username,$password,$database) or die("Error: Database not available. Please try again later.");
$query = "INSERT INTO survey VALUES('','$type','$isHomePage','$vstAthlet','$vstLinks','$vstEdline','$vstFacul','$vstLaptop','$vstPres','$vstPrinc','$vstCal','$eForms','$sMap','$bRSS','$facWS','$facClub','$facClubWS','$facCon','$facPic','$facEdline1','$facEdline2','$facEdline3','$facEdline4','$facEdline5','$aEdline','$chEdline','$announce','$eFac','$eFindFac','$stuHandouts','$stuWebteam','$stuWebteamN','$stuWebteamH','$otherWB','$conceptHP','$conceptCP','$conceptLike','$conceptNoLike','$comments')";
$result = mysqli_query($connection,$query);
mysqli_free_result($result);
mysqli_close($connection);[/color]

ok still doesnt work but different error now!
[color=red]
Fatal error: Call to undefined function mysqli_connect() in /home/bchs/bchs-web/data/survey/finalize.php on line 10[/color]
going backwards...
[color=red]
Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in /home/bchs/bchs-web/data/survey/finalize.php on line 10
Error: Database not available. Please try again later.[/color]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.