View Single Post
Old 03-06-2013, 08:36 AM   PM User | #11
bemore
New Coder

 
Join Date: Feb 2013
Posts: 39
Thanks: 14
Thanked 0 Times in 0 Posts
bemore is an unknown quantity at this point
Quote:
Originally Posted by Old Pedant View Post
Still say a SELECT followed by either INSERT, UPDATE, or nothing would be better.

If you did that all in a Stored Procedure, it would still only involve one call from PHP.

And why did you reject my idea about adding the mysql_real_escape_string??
I'm not sure how to go about using SELECT to get the same results as IF gets me. The idea is to always UPDATE the existing row, but only if there is nothing in the row's gamename column.

I'm already using
PHP Code:
if(isset($_POST['gamename'])) {
$gamename mysqli_real_escape_string($link$_POST['gamename']);   
} else {
$gamename "None";

I see that your method is cleaner and a lot less code, as I use the above for each input name, but
PHP Code:
function clean$val )
{
    return 
"'" mysql_real_escape_string$val ) . "'"

gives me a syntax error on }
bemore is offline   Reply With Quote