hey guys,please help me out here..
i have made a edit profile form in which i had create a "country" feild with dropdown list...
and i have done the update query and there is no error and dynamically i have type the code to get data from the form into the mysql database table name "register". .but unfortunatly after i click on the button to update it but in the database it displays blank data..
so what is the problem exectly i dint find..
here is the code...
i have made a edit profile form in which i had create a "country" feild with dropdown list...
and i have done the update query and there is no error and dynamically i have type the code to get data from the form into the mysql database table name "register". .but unfortunatly after i click on the button to update it but in the database it displays blank data..
so what is the problem exectly i dint find..
here is the code...
Code:
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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"] == "profile_update")) {
$updateSQL = sprintf("UPDATE `register master` SET First_name=%s, Last_name=%s, DOB=%s, contact=%s, city_name=%s, state_name=%s, country_name=%s, address1=%s, address2=%s, profile_photo_path=%s WHERE email_add=%s",
GetSQLValueString($_POST['profile_name'], "text"),
GetSQLValueString($_POST['profile_lname'], "text"),
GetSQLValueString($_POST['profile_dob'], "date"),
GetSQLValueString($_POST['profile_phone'], "text"),
GetSQLValueString($_POST['profile_city'], "text"),
GetSQLValueString($_POST['profile_state'], "text"),
GetSQLValueString($_POST['country'], "text"),
GetSQLValueString($_POST['address1'], "text"),
GetSQLValueString($_POST['address2'], "text"),
GetSQLValueString($_POST['upload'], "text"),
GetSQLValueString($_POST['profile_email'], "text"));
mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($updateSQL, $conn) or die(mysql_error());
$updateGoTo = "profile.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_conn, $conn);
$query_Recordset_reg = "SELECT * FROM `register master`";
$Recordset_reg = mysql_query($query_Recordset_reg, $conn) or die(mysql_error());
$row_Recordset_reg = mysql_fetch_assoc($Recordset_reg);
$totalRows_Recordset_reg = mysql_num_rows($Recordset_reg);
?>
<div class="row cf">
<span class="title">Country</span>
<select name="country" >
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">India</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">Australia</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">United states</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">Chin</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">Pakistan</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">Japan</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">Srilanka</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">Bangladesh</option>
<option value="<?php if (!(strcmp("", $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>">Kenya</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset_reg['country_name']?>"
<?php if (!(strcmp($row_Recordset_reg['country_name'], $row_Recordset_reg['country_name']))) {echo "selected=\"selected\"";} ?>>
<?php echo $row_Recordset_reg['country_name']?> </option>
<?php
} while ($row_Recordset_reg = mysql_fetch_assoc($Recordset_reg));
$rows = mysql_num_rows($Recordset_reg);
if($rows > 0) {
mysql_data_seek($Recordset_reg, 0);
$row_Recordset_reg = mysql_fetch_assoc($Recordset_reg);
}
?> </select>
</div>
Comment