surf5502 Posted December 2, 2006 Share Posted December 2, 2006 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 aski really need this thing to work asapthanks everyone Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/ Share on other sites More sharing options...
Hypnos Posted December 2, 2006 Share Posted December 2, 2006 You need to post the error. Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-134097 Share on other sites More sharing options...
surf5502 Posted December 4, 2006 Author Share Posted December 4, 2006 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 10Error: Database not available. Please try again later.[/color]and thats my error for ya Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135103 Share on other sites More sharing options...
surf5502 Posted December 4, 2006 Author Share Posted December 4, 2006 might this have anything to do with it?[color=blue]Used PHP extensions: mysqli[/color]it was on my PHPMyAdmin page... Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135110 Share on other sites More sharing options...
mainewoods Posted December 4, 2006 Share Posted December 4, 2006 you did know that mysql is usually installed on port '3306' and '3307' is what you meant to code?[code]$hostaddr = "db4free.net:3307";[/code] Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135113 Share on other sites More sharing options...
surf5502 Posted December 4, 2006 Author Share Posted December 4, 2006 this server runs it on both actually... i dont know i tried both and neither workedwill the mysqli make a difference? or is it like the same thing? Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135117 Share on other sites More sharing options...
surf5502 Posted December 4, 2006 Author Share Posted December 4, 2006 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 https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135127 Share on other sites More sharing options...
mainewoods Posted December 4, 2006 Share Posted December 4, 2006 just try the mysql_connect with 3306 Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135133 Share on other sites More sharing options...
surf5502 Posted December 4, 2006 Author Share Posted December 4, 2006 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 10Error: Database not available. Please try again later.[/color] Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135136 Share on other sites More sharing options...
surf5502 Posted December 4, 2006 Author Share Posted December 4, 2006 oh ya i fixed it....ignore this thread Link to comment https://forums.phpfreaks.com/topic/29246-db4freenet-mysql-connect-error/#findComment-135151 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.