mei_913 Posted June 24, 2006 Share Posted June 24, 2006 Warning: mysql_free_result(): 6 is not a valid MySQL result resource in c:\program files\easyphp1-8\www\apply\modify.php on line 111 THIS SENTENCE APPEARED WHEN I TRIED TO RUN MY PHP WEBPAGE!!!<?php require_once('Connections/conn_member.php'); ?><?php require_once('Connections/conn_member.php'); ?><?phpfunction GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue;}$editFormAction = $_SERVER['PHP_SELF'];if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);}if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE tbmember SET username_eng=%s, username_nick=%s, cons_id=%s, beau_id=%s, joinday=%s, birthday=%s, phone=%s, address=%s, email=%s, sex=%s, occupation=%s, book_time=%s, reactivity=%s, remark=%s, medicaltreat=%s, surgery=%s, medicine=%s, heartdisease=%s, allergy=%s, skin=%s, bloodpressure=%s, asthma=%s, epilepsy=%s, diabetes=%s, metal=%s, otherdisease=%s, insomnia=%s, stress=%s, busy=%s, relax=%s, alcoholic=%s, smoking=%s, spice=%s, sweet=%s, coffee=%s WHERE username_chi=%s", GetSQLValueString($_POST['username_eng'], "text"), GetSQLValueString($_POST['username_nick'], "text"), GetSQLValueString($_POST['cons_id'], "text"), GetSQLValueString($_POST['beau_id'], "text"), GetSQLValueString($_POST['joinday'], "date"), GetSQLValueString($_POST['birthday'], "date"), GetSQLValueString($_POST['phone'], "int"), GetSQLValueString($_POST['address'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['sex'], "text"), GetSQLValueString($_POST['occupation'], "text"), GetSQLValueString($_POST['book_time'], "int"), GetSQLValueString($_POST['reactivity'], "int"), GetSQLValueString($_POST['remark'], "text"), GetSQLValueString($_POST['medicaltreat'], "text"), GetSQLValueString($_POST['surgery'], "text"), GetSQLValueString($_POST['medicine'], "text"), GetSQLValueString(isset($_POST['heartdisease']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['allergy']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['skin']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['bloodpressure']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['asthma']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['epilepsy']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['diabetes']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['metal']) ? "true" : "", "defined","1","0"), GetSQLValueString($_POST['otherdisease'], "text"), GetSQLValueString(isset($_POST['insomnia']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['stress']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['busy']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['relax']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['alcoholic']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['smoking']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['spice']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['sweet']) ? "true" : "", "defined","1","0"), GetSQLValueString(isset($_POST['coffee']) ? "true" : "", "defined","1","0"), GetSQLValueString($_POST['username_chi'], "text")); mysql_select_db($database_conn_member, $conn_member); $Result1 = mysql_query($updateSQL, $conn_member) or die(mysql_error()); $updateGoTo = "complete.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo));}mysql_select_db($database_conn_member, $conn_member);$query_rsConsultant = "SELECT cons_id, cons_name FROM tbconsultant";$rsConsultant = mysql_query($query_rsConsultant, $conn_member) or die(mysql_error());$row_rsConsultant = mysql_fetch_assoc($rsConsultant);$totalRows_rsConsultant = mysql_num_rows($rsConsultant);mysql_select_db($database_conn_member, $conn_member);$query_rsBeautician = "SELECT beau_id, beau_name FROM tbbeautician";$rsBeautician = mysql_query($query_rsBeautician, $conn_member) or die(mysql_error());$row_rsBeautician = mysql_fetch_assoc($rsBeautician);$totalRows_rsBeautician = mysql_num_rows($rsBeautician);$colname_rsCustomerData = "-1";if (isset($_GET['userid'])) { $colname_rsCustomerData = (get_magic_quotes_gpc()) ? $_GET['userid'] : addslashes($_GET['userid']);}mysql_select_db($database_conn_member, $conn_member);$query_rsCustomerData = sprintf("SELECT * FROM tbmember WHERE userid = '%s'", $colname_rsCustomerData);$rsCustomerData = mysql_query($query_rsCustomerData, $conn_member) or die(mysql_error());$row_rsCustomerData = mysql_fetch_assoc($rsCustomerData);$totalRows_rsCustomerData = mysql_num_rows($rsCustomerData);mysql_free_result($rsBeautician);mysql_free_result($rsCustomerData);mysql_free_result($rsConsultant);mysql_free_result($rsBeautician);?> Quote Link to comment https://forums.phpfreaks.com/topic/12780-do-u-think-theres-any-problem-with-my-script/ Share on other sites More sharing options...
homchz Posted June 24, 2006 Share Posted June 24, 2006 Delete one of the first requires as you do not need two of them, and delete the last mysql_free at the bottom of the scrpit as you have two of those too. You cannot free anything more than once, I do not beleive.JoshDW makes some bad default code, do your self a favor and learn what it all means so you can do with out DW's code. Make life much simpler. Quote Link to comment https://forums.phpfreaks.com/topic/12780-do-u-think-theres-any-problem-with-my-script/#findComment-48996 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.