Read and insert to MySQL a URL-Variable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zack

    Read and insert to MySQL a URL-Variable

    Hi, I'm sorry, I've a little question.. I want read 2 URL-Variable and
    then to insert them in my DB (MySQL).

    This is my code:

    <?php
    $insertSQL = sprintf("INSERT INTO nometabella (CAMPO1, CAMPO2) VALUES
    ('VAL1', 'VAL2')");
    mysql_select_db ($database_nome connessione, $nomeconnession e);
    $Result1 = mysql_query($in sertSQL, $nomeconnession e) or
    die(mysql_error ());
    ?>

    How can I modifify?

    Thanks.

    P.S.
    I'm sorry formy english.
  • Fabian Wleklinski

    #2
    Re: Read and insert to MySQL a URL-Variable

    Hi "zack" (?),

    given two variables named "var1" and "var2", try

    $insertSQL = "INSERT INTO nometabella (CAMPO1, CAMPO2) " .
    "VALUES ('" . addslashes($_RE QUEST["var1"]) . "','" .
    addslashes($_RE QUEST["var2"]) . "')";

    Greetings from Frankfurt / Germany,

    Fabian Wleklinski


    Comment

    Working...