Jump to content

can't connect to database, help!!


decneo

Recommended Posts

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!!

Link to comment
https://forums.phpfreaks.com/topic/195102-cant-connect-to-database-help/
Share on other sites

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.   

how can i fix it?  :confused:  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();
}
?>

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?

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.