Update query leaving a blank value
By : DaPunhal
Date : March 29 2020, 07:55 AM
around this issue you didn't quote the $cleanURL variable, or possibly the $uid variable is incorrect. code :
mysql_query("Update login SET website = '$cleanURL' WHERE loginid = '$uid'");
|
MySQL syntax error on "" (blank) - UPDATE query
By : Bolle
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Your query is a single line, yet the error is at line 2 Your code is not safe, you are not sanitizing the values and the error comes from this fact. mysql_* functions are now deprecated for this kind of mistakes. code :
include 'includes/connection.php';
if (isset($_POST['submit'])) {
$statement = $db->prepare("UPDATE student SET `name`=:name , `email`=:email , `dob`=:dob , `phone`=:phone , `college`=:college , `address`=:address , `state`=:state , `country`=:country WHERE id = :id");
$statement->execute(array(
':name' => $_POST['name'],
':email' => $_POST['email'],
':dob' => $_POST['dob'],
':phone' => $_POST['phone'],
':college' => $_POST['college'],
':address' => $_POST['address'],
':state' => $_POST['state'],
':country' => $_POST['country'],
':id' => $_POST['id']
));
}
include 'includes/connection.php';
if (isset($_POST['submit'])) {
$name = mysql_real_escape_string($_POST['name']);
$email = mysql_real_escape_string($_POST['email']);
$dob = mysql_real_escape_string($_POST['dob']);
$phone = mysql_real_escape_string($_POST['phone']);
$college = mysql_real_escape_string($_POST['college']);
$address = mysql_real_escape_string($_POST['address']);
$state = mysql_real_escape_string($_POST['state']);
$country = mysql_real_escape_string($_POST['country']);
$id = mysql_real_escape_string($_POST['id']);
/**
* For debugging purposes
*/
$query = "UPDATE student SET `name`='$name' , `email`='$email' , `dob`='$dob' , `phone`='$phone' , `college`='$college' , `address`='$address' , `state`='$state' , `country`='$country' WHERE id = '$id'";
mysql_query($query) or die(mysql_error());
/**
* For debugging purposes
*/
echo "<pre>Last query: $query</pre>";
}
|
Pass Form Values to Update Query without updating blank fields in table
By : user3428161
Date : March 29 2020, 07:55 AM
|
Access, Update Query that does not overwrite data with blank cells
By : user3828437
Date : March 29 2020, 07:55 AM
this will help Excuse formatting, I'm answering from my phone... You could replace the elements of the SET such that, for example:
|
Update query successful but getting blank values in SQL Server database
By : user3486864
Date : March 29 2020, 07:55 AM
Any of those help I solved it. Turns out the problem was that i was missing a postback check in pageload function. Therefore, the values from the update query were being removed by the values already present in the database and giving me blank values as a result. I just added the code :
if(!Page.IsPostBack)
{
}
|