The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › Back End › Php query insert to
I am new to CSS-Triks!
Ok. now I explain the problem …
I have this little problem with PHP SQL I do not understand how to solve … I think the advancing age. :-/
$mysqli->query("INSERT INTO coming_soon_emails
SET email='".$mysqli->real_escape_string($_POST).", ".$mysqli->real_escape_string($_POST)."'");
The problem is that it adds “email” and “ip” in the same column “email” and the column “ip” is empty.
I found a solution, I still doubt whether this is the ideal solution.
$email = mysql_real_escape_string($_POST);
$mysqli->query("INSERT INTO coming_soon_emails (ip, email) VALUES ( '$ip', '$email')");
If you have an alternative, let me know. Tnx U very much
Your first version of the query would have been wrong because of how you have it set up, but your second query looks just right. Anytime you need to insert, your final solution is the correct syntax.
There is some rust in my Php Sql. (:
Ok, if I have more updates about it I make it known.