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

Link to comment
Share on other sites

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();
}
?>

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.