Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Php query insert to

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39075
    webbeloz
    Participant

    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

    #106822
    webbeloz
    Participant

    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
    Mario

    #106826
    ChrisxClash
    Member

    Mario,

    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!

    #106827
    webbeloz
    Participant

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.