Jump to content

supplied argument is not a valid MySQL result resource? Help


Recommended Posts

Hello,friends

 

  i got error said : "  supplied argument is not a valid MySQL result resource " like this screenshot

 

1-3.gif

 

 

ບໍ່ສາມາດສະໝັກເປັນສະມາຊິກໄດ້ = you can not register to become to be a member.

 

  this is my code,what's wrong with this line : $num=mysql_num_rows($result); it can not insert to tb_member.  :'(

 

<?
$user_reg=$_POST[user_reg];
$pass_reg=$_POST[pass_reg];
$name_reg=$_POST[name_reg];
$sex_reg=$_POST[sex_reg];
$email_reg=$_POST[email_reg];
$tel_reg=$_POST[tel_reg];
$address_reg=$_POST[address_reg];
$date_reg=date("Y-m-d");

if ($user_reg=="" or $pass_reg=="" or $name_reg=="" ) {
echo "<h3>ERROR : ກະລຸນາກຼອກຂໍ້ມູນໃຫ້ຄົບຖ້ວນ<h3>"; exit();
}
include "function.php";
if (!checkemail($email_reg)) {
echo "<h3>ERROR : ຮູບແບບ ອີເມລ ບໍ່ຖືກຕ້ອງ </h3>"; 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 "<h3>ERROR : Username ມີຢູ່ໃນລະບົບແລ້ວ </h3>"; 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 "<h3>ຂໍ້ມູນຂອງທ່ານຖືກບັນທຶກຮຽບຮ້ອຍແລ້ວ</h3>";
echo "<A HREF='index.html'>ຄິຼກເພື່ອເຂົ້າລະບົບສະມາຊິກ</A><BR><BR>";
} else {
echo "<h3>ບໍ່ສາມາດສະໝັກເປັນສະມາຊິກໄດ້</h3>";
}
mysql_close();
?>

 

 

Please help!!

 

best regard,

koko

If you search for any portion of that error message you will find that it means that your query failed to execute due to an error.

 

For debugging purposes only (remove it after you are done), echo msyql_error(); on the next line right after the line with the mysql_query() statement.

If you search for any portion of that error message you will find that it means that your query failed to execute due to an error.

 

For debugging purposes only (remove it after you are done), echo msyql_error(); on the next line right after the line with the mysql_query() statement.

i'm confusing

Could you please give me some example for my script line? because i'm a newbie,so sorry about this

 

best regard

koko,

 

That was the example.

 

$sql="insert into tb_member values('','$user_reg','$pass_reg','$name_reg','$sex_reg',
'$email_reg','$tel_reg','$address_reg','$date_reg')";
echo msyql_error(); 
$result=mysql_db_query($dbname,$sql);

 

ok,i've added like PFMaBiSmAd's advise and i got this , what does it mean? please recommend .

 

df.gif

 

 

$sql="insert into tb_member values('','$user_reg','$pass_reg','$name_reg','$sex_reg',
'$email_reg','$tel_reg','$address_reg','$date_reg')";
echo msyql_error(); 
$result=mysql_db_query($dbname,$sql);

 

You typed echo msyql_error();

 

it should be mysql_error();

 

$sql="insert into tb_member values('','$user_reg','$pass_reg','$name_reg','$sex_reg',
'$email_reg','$tel_reg','$address_reg','$date_reg')";
echo msyql_error(); 
$result=mysql_db_query($dbname,$sql);

 

You typed echo msyql_error();

 

it should be mysql_error();

 

ok, i did it and it said no database selected

 

how can i test my connect.php?

 

best regard,

Decneo

  • 2 weeks later...
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.