Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Proper Use of Quotes with POST?

  1. #11
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    I tried it with and without quotes and it still doesn't work.

  2. #12
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Echo out the query and past it here. That will show us any syntax errors.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. The Following User Says Thank You to Jas For This Useful Post:

    kuau (06-04-2008)

  4. #13
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear Jas: I hate to look like even more of a dummy, but how do I "echo out the query?"

    I figure it must involve using the echo command but not sure where.... thanks, e

  5. #14
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    I hate to look like even more of a dummy, but how do I "echo out the query?"
    Echo out means you can use either print or echo to send whatever value you've stored in your variable which supposed to hold an SQL statement. For eg:


    PHP Code:
        $sql " UPDATE users SET status = 'B', confdate = '" $today"', pickdate = '" .$pickdate"', dropdate = '" .$dropdate"' WHERE email = '" .$emailaddress."'";
        print 
    $sql

    Another problem I found is in your another SQL statement, which is following

    PHP Code:
    $sql " UPDATE `users`
                  SET status = 'I', visit = (visit + '1'), visdate = '
    $today',  pickdate = '$pickdate', dropdate = '$dropdate', remind = '0', act = '0', survey = '0'
                  WHERE email = '
    $emailaddress'  "
    Leave the quotes issue for the time being and update it based on the above mentioned demo query. You don't need to enclose numbers within single quotes if they are number based items in your database. In other words the usage of quotes for enclosing the field value purely depends upon the data type that you use in the database. Consider an example a table with two fields one string and one number, for updating a record in such a table would be like the following:

    PHP Code:
    $sql "update mytable set name='codeexploiter', age=33 where name like 'codeexploiter'"
    Another problem in your above SQL is the way you increment the field value visit, which will result in error. If you want to insert a value incremented by the existing value then first you have to query the value using another database operation store it in some variable and using that increment it in the SQL statement.

  6. The Following User Says Thank You to codeexploiter For This Useful Post:

    kuau (06-04-2008)

  7. #15
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear Jas: It's working!!! Thanks a million! I am ecstatic. I spent the entire day yesterday fighting with that one and now I can move on to what I was trying to do with it in the first place. Thank you for lending your eyes and straightening out my quote confusion. I read what Daniel wrote over and over but couldn't quite grasp when to use quotes or not until you showed me examples with my own data. Much appreciation to you, TheTestingSite, and Daniel.

    Yahoooooo!!!! e
    Last edited by kuau; 06-04-2008 at 08:04 PM. Reason: left out an important person

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •