Im using mysql with PHP, I had been just wondering if the query,

$query = "UPDATE tblName SET area='$fieldValue' WHERE field2='$fieldValue2'"
would cause an From Memory Error in mysql. Will this question,
$query = "UPDATE tblName SET area='".$fieldValue."' WHERE field2='".$fieldValue2."'"
consume less memory compared to previous one?

Im getting this error: From memory (Needed nnnnnnn bytes) and it is pointing towards the query with similar format as the first above.


So far as MySQL is worried, the 2 strings are identical.

How large are these values in $fieldValue and $fieldValue2? If they are multiple mb, trying to allocate space for that $query variable might be exceeding your PHP memory limit - possibly you have to up it if you are dealing with large data.

Should you code like this, this may happen. DonĀ“t code like this, please.

Both strings are identical, one uses inline interpolation, another uses string concatenation. I believe your condition needs to be located elsewhere.

Well the from memory error is most likely triggered because the values in individuals variables are merely too lengthy. If that's the situation you need to consider prepared claims as individuals are designed for Larger values than simple queries.