what does this mean?

Discussion in 'Databases' started by scutari, Sep 7, 2008.

  1. #1
    $query = sprintf("INSERT INTO people (userName, userAddress, userCity, userZip, userEmail)
                VALUES( '%s', '%s','%s','%s','%s')",
    PHP:
    What are those %s ?
     
    scutari, Sep 7, 2008 IP
  2. darkmessiah

    darkmessiah Peon

    Messages:
    500
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you are missing the last part of the code...

    sprintf will replace those %s (strings) with values you provide.

    something like $string = sprintf("INSERT %s %s","string","here");

    would output $string = "INSERT string here";
     
    darkmessiah, Sep 9, 2008 IP
  3. scutari

    scutari Peon

    Messages:
    431
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yeah I know the other param of the function but what do they mean?
     
    scutari, Sep 10, 2008 IP
  4. pown

    pown Active Member

    Messages:
    276
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #4
    I know about inside the bracket but i am sorry i don't know the other. . :( Tell me if anyone knows. .
     
    pown, Sep 10, 2008 IP
  5. darkmessiah

    darkmessiah Peon

    Messages:
    500
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    it's just replacing %s with some other variable that you supply. chances are you need to supply the name address zip and stuff that is being inserted into the table
     
    darkmessiah, Sep 10, 2008 IP