Jump to content

Recommended Posts

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'); ?>
<?php
function 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);

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


Josh

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