本文介绍了警告:mysql_fetch_assoc()期望参数1是资源,在第21行的/home/rcoent1/rcoreent.com/PHP IMAGE / addadmin.php中给出布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我的代码: <?php include(validation.php); include(conection.php); if(isset($ _ POST [button])) { $ pwde = md5($ _ POST [密码]); $ sql =INSERT INTO管理员(管理员,管理员名称,密码,地址,联系人) VALUES ('$ _POST [adminid]','$ _ POST [adminname]','$ pwde','$ _ POST [address]','$ _ POST [contactno]'); if(!mysql_query($ sql,$ con)) { die('Error:'。mysql_error()); } 其他 { echo1条记录成功插入......; } } $ result = mysql_query(SELECT * FROM administrator); while($ row1 = mysql_fetch_assoc( $ result)) { $ adminid = $ row1 [adminid] + 1; } if(isset($ _ POST [button2])) { $ pwde = md5($ _ POST [密码]); mysql_quer y(UPDATE administrator SET adminname ='$ _ POST [adminname]',address ='$ _ POST [address]',contactno ='$ _ POST [contactno]' WHERE adminid ='$ _POST [管理员''); echo记录更新成功; } if($ _ GET [view] ==administrator) { $ result = mysql_query(SELECT * FROM administrator where adminid ='$ _ GET [滑动]'); while($ row1 = mysql_fetch_array($ result)) { $ adminid = $ row1 [adminid]; $密码= $ row1 [密码]; $ adminname = $ row1 [adminname]; $ address = $ row1 [地址]; $ contact = $ row1 [contactno]; } } ?> 我尝试过: <?php include(validation.php); 包括(conection.php); if(isset($ _ POST [button])) { $ pwde = md5 ($ _POST [密码]); $ sql =INSERT INTO管理员(管理员,管理员名称,密码,地址,联系人) VALUES ('$ _POST [adminid]','$ _ POST [adminname]','$ pwde','$ _ POST [address]','$ _ POST [contactno]'); if(!mysql_query($ sql,$ con)) { die('错误:'。mysql_error()); } 其他 { echo1条记录成功插入......; } } $ result = mysql_query(SELECT * FROM administrator); while($ row1 = mysql_fetch_assoc($ result)) { $ adminid = $ row1 [adminid] + 1; } if(isset($ _ POST [button2])) { $ pwde = md5($ _ POST [密码]); mysql_query(UPDATE administrator SET adminname ='$ _ POST [adminname]',address ='$ _ POST [地址]',contactno ='$ _ POST [contactno]' WHERE adminid ='$ _POST [adminid]'); echo记录更新成功; } if($ _ GET [view] ==administrator) { $ result = mysql_query(SELECT * FROM administrator where adminid ='$ _ GET [slid]'); while($ row1 = mysql_fetch_array($ result)) { $ adminid = $ row1 [adminid]; $密码= $ row1 [密码]; $ adminname = $ row1 [adminname]; $ address = $ row1 [地址]; $ contact = $ row1 [contactno]; } } b $ b ?> 解决方案 _POST [button]) ) { pwde = md5( _POST [密码]); My Code:<?phpinclude("validation.php");include("conection.php");if(isset($_POST["button"])){$pwde = md5($_POST[password]);$sql="INSERT INTO administrator (adminid, adminname, password, address, contactno)VALUES('$_POST[adminid]','$_POST[adminname]','$pwde','$_POST[address]','$_POST[contactno]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } else { echo "1 record Inserted Successfully..."; }}$result = mysql_query("SELECT * FROM administrator");while($row1 = mysql_fetch_assoc($result)) {$adminid = $row1["adminid"]+1;}if(isset($_POST["button2"])){$pwde = md5($_POST[password]);mysql_query("UPDATE administrator SET adminname='$_POST[adminname]', address='$_POST[address]', contactno='$_POST[contactno]'WHERE adminid = '$_POST[adminid]'");echo "Record updated successfully";}if($_GET[view] == "administrator"){$result = mysql_query("SELECT * FROM administrator where adminid='$_GET[slid]'"); while($row1 = mysql_fetch_array($result)) {$adminid = $row1["adminid"];$password = $row1["password"];$adminname = $row1["adminname"];$address = $row1["address"];$contact = $row1["contactno"];}}?>What I have tried:<?phpinclude("validation.php");include("conection.php");if(isset($_POST["button"])){$pwde = md5($_POST[password]);$sql="INSERT INTO administrator (adminid, adminname, password, address, contactno)VALUES('$_POST[adminid]','$_POST[adminname]','$pwde','$_POST[address]','$_POST[contactno]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } else { echo "1 record Inserted Successfully..."; }}$result = mysql_query("SELECT * FROM administrator");while($row1 = mysql_fetch_assoc($result)) {$adminid = $row1["adminid"]+1;}if(isset($_POST["button2"])){$pwde = md5($_POST[password]);mysql_query("UPDATE administrator SET adminname='$_POST[adminname]', address='$_POST[address]', contactno='$_POST[contactno]'WHERE adminid = '$_POST[adminid]'");echo "Record updated successfully";}if($_GET[view] == "administrator"){$result = mysql_query("SELECT * FROM administrator where adminid='$_GET[slid]'"); while($row1 = mysql_fetch_array($result)) {$adminid = $row1["adminid"];$password = $row1["password"];$adminname = $row1["adminname"];$address = $row1["address"];$contact = $row1["contactno"];}}?> 解决方案 _POST["button"])){pwde = md5(_POST[password]); 这篇关于警告:mysql_fetch_assoc()期望参数1是资源,在第21行的/home/rcoent1/rcoreent.com/PHP IMAGE / addadmin.php中给出布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-23 13:17