decneo Posted March 13, 2010 Share Posted March 13, 2010 Hi,my name is decneo. i would like to submit to register to become to be a member on localhost but when i click submit the weird message look like this ERROR : ກະລຸນາກຼອກຂໍ້ມູນໃຫ້ຄົບຖ້ວນ "; exit(); } include "function.php"; if (!checkemail($email_reg)) { echo " ERROR : ຮູບແບບ ອີເມລ ບໍ່ຖືກຕ້ອງ "; exit(); } include "connect.php"; $sql="select * from tb_member where username='$user_reg' "; $result=mysql_db_query($dbname,$sql); $num=mysql_num_rows($result); if($num>0) { echo " ERROR : Username ມີຢູ່ໃນລະບົບແລ້ວ "; exit(); } $sql="insert into tb_member values('','$user_reg','$pass_reg','$name_reg','$sex_reg', '$email_reg','$tel_reg','$address_reg','$date_reg')"; $result=mysql_db_query($dbname,$sql); if ($result) { echo " ຂໍ້ມູນຂອງທ່ານຖືກບັນທຶກຮຽບຮ້ອຍແລ້ວ "; echo "ຄິຼກເພື່ອເຂົ້າລະບົບສະມາຊິກ "; } else { echo " ບໍ່ສາມາດສະໝັກເປັນສະມາຊິກໄດ້ "; } mysql_close(); ?> for my connect.php to database <? $host="localhost"; $user="root"; $pw="**********"; $dbname="db_member"; $c = mysql_connect($host,$user,$pw); if (!$c) { echo "<h3>ERROR : ບໍ່ສາມາດຕິດຕໍ່ຖານຂໍ້ມູນໄດ້ </h3>"; exit(); } ?> please help me!! Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 13, 2010 Share Posted March 13, 2010 Try using a full opening php tag <?php Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025555 Share on other sites More sharing options...
decneo Posted March 13, 2010 Author Share Posted March 13, 2010 i've tested but it still weird , when i test to surf connect.php it appear like this : ERROR : ບໍ່ສາມາດຕິດຕໍ່ຖານຂໍ້ມູນໄດ້ "; exit(); } php?> ບໍ່ສາມາດຕິດຕໍ່ຖານຂໍ້ມູນໄດ້ = can't connect to database. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025558 Share on other sites More sharing options...
jspodisus Posted March 13, 2010 Share Posted March 13, 2010 please put it on PHP code. so that we can sort out problems. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025560 Share on other sites More sharing options...
decneo Posted March 13, 2010 Author Share Posted March 13, 2010 how can i fix it? still get the same <?php $host="localhost"; $user="root"; $pw="**********"; $dbname="db_member"; $c = mysql_connect($host,$user,$pw); if (!$c) { echo "<h3>ERROR : ບໍ່ສາມາດຕິດຕໍ່ຖານຂໍ້ມູນໄດ້ </h3>"; exit(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025563 Share on other sites More sharing options...
PFMaBiSmAd Posted March 13, 2010 Share Posted March 13, 2010 Your problem is more serious than not being able to connect to the database. Your problem is that your php code is not being parsed as php code. Is the php language even installed on your server? What URL are you entering in your browser? Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025566 Share on other sites More sharing options...
decneo Posted March 13, 2010 Author Share Posted March 13, 2010 i use http://localhost/myfile yes, i've installed php already. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025572 Share on other sites More sharing options...
DaiLaughing Posted March 13, 2010 Share Posted March 13, 2010 I think the PHP is being processed but this might clarify what the actual error is. Change your line by add this on the end: $c = mysql_connect($host,$user,$pw) or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025582 Share on other sites More sharing options...
decneo Posted March 13, 2010 Author Share Posted March 13, 2010 so sorry friend it still have same problem.. :'( Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025629 Share on other sites More sharing options...
PFMaBiSmAd Posted March 13, 2010 Share Posted March 13, 2010 i use http://localhost/myfile Does the file name myfile have a .php extension so that it will be parsed by the php language engine? Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025634 Share on other sites More sharing options...
decneo Posted March 13, 2010 Author Share Posted March 13, 2010 exactly i use http://localhost/koko/userlogin/connect (connect.php) but it can't connect to database . i don't know why, please help me to figure it out,pleaseeee.. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025646 Share on other sites More sharing options...
PFMaBiSmAd Posted March 13, 2010 Share Posted March 13, 2010 The URL you enter must include the .php part of the filename (unless you are doing so url rewriting that makes it unnecessary.) Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025667 Share on other sites More sharing options...
DaiLaughing Posted March 13, 2010 Share Posted March 13, 2010 Sorry PFMaBiSmAd I must add a rule to the one about not posting when drunk. Don't post when hung over. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025671 Share on other sites More sharing options...
decneo Posted March 13, 2010 Author Share Posted March 13, 2010 ok. included .php but it still get the same result. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025752 Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2010 Share Posted March 14, 2010 Php is not installed/running on your server. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025754 Share on other sites More sharing options...
decneo Posted March 14, 2010 Author Share Posted March 14, 2010 i've download newest php : php-5.3.2-nts-Win32-VC9-x86 yesterday and installed already. Quote Link to comment https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/#findComment-1025774 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.