The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Php query insert to

  • # July 26, 2012 at 7:04 am

    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.
    Regards, Mario

    # July 26, 2012 at 9:01 am

    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

    # July 26, 2012 at 10:12 am


    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.

    Good work!

    # July 26, 2012 at 10:30 am

    There is some rust in my Php Sql. (:
    Ok, if I have more updates about it I make it known.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed