Web Analytics Made Easy -
StatCounter Delete query - CodingForum

Announcement

Collapse
No announcement yet.

Delete query

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Delete query

    PHP Code:
    if(isset($_GET['time']))
    {
        
    $time $_GET['time'];
        
    $sql "DELETE * FROM support WHERE time = '$time'";
        if(
    mysql_query($sql))
        {
            echo(
    "Support Ticket Deleted!");
        }

    I dont see anything wrong with that code but its not deleting right. I know the get variable is passing through, and its connected to the database farther up in the script. Time is just the time() that the row was intserted in the db.
    -bubbles

  • #2
    Originally posted by bubbles19518 View Post
    I dont see anything wrong with that code but its not deleting right.
    "its not deleting right" is rather vague...

    maybe echo out the generated delete statement by adding an
    echo $sql;
    and then post that.

    or check if there are records where
    time = '$time'
    evaluates to True with
    select count(*) from support where time = '$time'
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment


    • #3
      No reason to "Delete *", it's just "delete from"

      Comment


      • #4
        Sorry, I meant its not deleteing at all.. Here is the echo'd SQL.

        DELETE * FROM support WHERE time = 1159447855

        Theres only one record in the DB right now, the one im testing with so I know the time values are equal.
        -bubbles

        Comment


        • #5
          as beagle correctly picked up, you need to remove the *.

          also, did you check if there are records where 'time = 1159447855' with the select i posted
          Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

          Comment


          • #6
            Fixed thanks.
            -bubbles

            Comment

            Working...
            X