WEB if (isset($_POST['title'])) {

Discussion in 'OT Technology' started by Ricky, Dec 9, 2008.

  1. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,766
    Likes Received:
    6
    How do i make it so it can check more then one fields, besides title

    So like i want it to check post[title], post[song] and post[bpm]


    edit

    //////////


    fuck i think im doing it wrong.

    Basically i want it to check to see if the fields im posting has already been in the database. If it is, i dont want it to upload and atleast give an error.

    If it isnt i'd like it to continue and upload.

    Here's an exert of the script

     
    Last edited: Dec 9, 2008
  2. intrktevo

    intrktevo New Member

    Joined:
    Oct 18, 2004
    Messages:
    5,781
    Likes Received:
    0
    Location:
    UCF
    || means OR
    && means AND

    Code:
    if (isset($_POST['title']) && isset($_POST['song']) && isset($_POST['bpm'])) {
     
  3. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,924
    Likes Received:
    11
    Location:
    Los Angeles
    Use multiple conditional statements.
     
  4. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,766
    Likes Received:
    6
    thank you :)
     
  5. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,766
    Likes Received:
    6
    fuck i think im doing it wrong.

    Basically i want it to check to see if the fields im posting has already been in the database. If it is, i dont want it to upload and atleast give an error.

    If it isnt i'd like it to continue and upload.

    Here's an exert of the script

     
  6. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,924
    Likes Received:
    11
    Location:
    Los Angeles
    You'd utilize multiple queries. First, a select query to check if the data exists. If not, then an insert query.
     
  7. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
  8. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,766
    Likes Received:
    6
    so like i'd run something like

    $checksql (sqlquery select * FROM songs WHERE `title` LIKE `(_POST [title]`)

    then like

    else

    then the insert query ? :o

    i fucking suck with else and all those conditional statements :o
     
  9. intrktevo

    intrktevo New Member

    Joined:
    Oct 18, 2004
    Messages:
    5,781
    Likes Received:
    0
    Location:
    UCF
    run the first SELECT query to see what's in the database, then count the number of results returned by that query.

    then if number of results is zero, run the insert query
     
  10. ge0

    ge0 New Member

    Joined:
    Oct 31, 2005
    Messages:
    8,398
    Likes Received:
    0
    Location:
    JERSEY
    you can also sue $_REQUEST['formObjectName']
     

Share This Page