decneo Posted April 1, 2010 Share Posted April 1, 2010 Hello,friends i got error said : " supplied argument is not a valid MySQL result resource " like this screenshot ບໍ່ສາມາດສະໝັກເປັນສະມາຊິກໄດ້ = 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 Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 1, 2010 Share Posted April 1, 2010 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. Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1035282 Share on other sites More sharing options...
decneo Posted April 1, 2010 Author Share Posted April 1, 2010 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, Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1035365 Share on other sites More sharing options...
fenway Posted April 3, 2010 Share Posted April 3, 2010 That was the example. Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1036440 Share on other sites More sharing options...
decneo Posted April 5, 2010 Author Share Posted April 5, 2010 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 . Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1037153 Share on other sites More sharing options...
PFMaBiSmAd Posted April 5, 2010 Share Posted April 5, 2010 Actually, that means that there was a typo in the post, which you should have been able to figure out because all the mysql functions start with mysql Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1037156 Share on other sites More sharing options...
decneo Posted April 5, 2010 Author Share Posted April 5, 2010 Actually, that means that there was a typo in the post, which you should have been able to figure out because all the mysql functions start with mysql but i've checked every statement that are correct for the post . Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1037271 Share on other sites More sharing options...
jeffshen Posted April 7, 2010 Share Posted April 7, 2010 $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(); Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1038145 Share on other sites More sharing options...
decneo Posted April 7, 2010 Author Share Posted April 7, 2010 $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 Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1038316 Share on other sites More sharing options...
fenway Posted April 9, 2010 Share Posted April 9, 2010 mysql_select_d()? Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1039588 Share on other sites More sharing options...
decneo Posted April 19, 2010 Author Share Posted April 19, 2010 mysql_select_d()? still didnt work :'( Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1044463 Share on other sites More sharing options...
fenway Posted April 19, 2010 Share Posted April 19, 2010 Then read up on the mysql_* functions in the php refman -- it seems to be igonring you. Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1044637 Share on other sites More sharing options...
decneo Posted April 19, 2010 Author Share Posted April 19, 2010 Then read up on the mysql_* functions in the php refman -- it seems to be igonring you. where i could found this..? sorry to trouble you but i'm a newbie need more explain please please best regards, Deneo Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1044649 Share on other sites More sharing options...
fenway Posted April 23, 2010 Share Posted April 23, 2010 The refman is your friend. Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1047055 Share on other sites More sharing options...
decneo Posted April 23, 2010 Author Share Posted April 23, 2010 The refman is your friend. who is the refman ? :-\ Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1047150 Share on other sites More sharing options...
fenway Posted April 26, 2010 Share Posted April 26, 2010 See here. Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1048546 Share on other sites More sharing options...
decneo Posted April 26, 2010 Author Share Posted April 26, 2010 See here. thank you bro , my host website is clear now best regards, Decneo Link to comment https://forums.phpfreaks.com/topic/197223-supplied-argument-is-not-a-valid-mysql-result-resource-help/#findComment-1048577 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.