Quote:
Originally Posted by Old Pedant
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 }