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
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
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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]
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.