Page 3 of 3 FirstFirst 123
Results 33 to 41 of 41

Thread: How can i delete database value using an html page in php?

  1. #33
    Senior Member
    Join Date
    Dec 2012
    Location
    Oxfordshire
    Posts
    272
    Thanks
    3
    Thanked
    18 times in 17 posts
    • phil4's system
      • Motherboard:
      • Asus Sabertooth Z77
      • CPU:
      • Core i7-3770K @ 4.6Ghz
      • Memory:
      • 16Gb Corsair Dominator Platinum @ 1866Mhz
      • Storage:
      • OS: OCZ Vertex 4 256Gb, Data: 3Tb Seagate HDD, Cache: OCZ Agility 4 128Gb
      • Graphics card(s):
      • 2 x EVGA GTX 680 SC
      • PSU:
      • 750W Corsair Pro Series AX
      • Case:
      • Corsair Obsidian 650D Black
      • Operating System:
      • Windows 7 Ultimate 64Bit
      • Monitor(s):
      • 2 x Dell U2410 Ultrasharp
      • Internet:
      • Plusnet Fibre Unlimited 76/20

    Re: How can i delete database value using an html page in php?

    Ok, that leads me to think you might be using a different DB user account than what you did by hand. Incidentally, a good way to work with DB's, is never to delete. Instead to have an isActive column, which is set to 0 in place of a delete, however your whole app then needs to only list items where IsActive=1, so more changes.

    Also, you need to be very very sure, that woat you output, is what you've written and tried.

    So in your code where you did this:
    $id=$_GET['id'];
    $query1=mysql_query("delete from news where id='$id'");

    do this:

    $id=$_GET['id'];
    echo "delete from news where id='". mysql_real_escape_string($id) . "'";

    and then run the page, and try by hand executing the code it writes out.

    I genuinely don't think you're doing this, as your code above doesn't seem to use concat correctly. surely it should be:
    "delete from news where id='".$id."'" ???

    But even then, as we've said you really really really really really really really!!!!!! MUST use SQL Injection protection. So as has been said earlier you MUST do this:

    . mysql_real_escape_string($id) .

  2. #34
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: How can i delete database value using an html page in php?

    Quote Originally Posted by Raz316 View Post
    In the nicest possible way (which isn't that nice I'm afraid) no, I will not help you.
    Did you see the link Fin posted. Not sure exactly what this training company is about, but they don't appear to be remotely useful.

    Also anyone learning PHP is a bit dim, anyone paying to learn it really hasn't done any research. Now excuse me whilst I do something with UTF-8.
    throw new ArgumentException (String, String, Exception)

  3. #35
    Registered+
    Join Date
    Apr 2013
    Posts
    19
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: How can i delete database value using an html page in php?

    when i give the code:echo "delete from news where id='". mysql_real_escape_string($id) . "'";
    on executiong it is displaying the id.bt still the value remains in the database.delete query is not working.

  4. #36
    Senior Member
    Join Date
    Dec 2012
    Location
    Oxfordshire
    Posts
    272
    Thanks
    3
    Thanked
    18 times in 17 posts
    • phil4's system
      • Motherboard:
      • Asus Sabertooth Z77
      • CPU:
      • Core i7-3770K @ 4.6Ghz
      • Memory:
      • 16Gb Corsair Dominator Platinum @ 1866Mhz
      • Storage:
      • OS: OCZ Vertex 4 256Gb, Data: 3Tb Seagate HDD, Cache: OCZ Agility 4 128Gb
      • Graphics card(s):
      • 2 x EVGA GTX 680 SC
      • PSU:
      • 750W Corsair Pro Series AX
      • Case:
      • Corsair Obsidian 650D Black
      • Operating System:
      • Windows 7 Ultimate 64Bit
      • Monitor(s):
      • 2 x Dell U2410 Ultrasharp
      • Internet:
      • Plusnet Fibre Unlimited 76/20

    Re: How can i delete database value using an html page in php?

    And when you ran the code that was echo'd by hand against the database, did it delete the value?

    Did you investigate
    you might be using a different DB user account
    And finally, I mentioned not deleting, have you considered that approach?

    You're getting the benefit here of clever people with many decades of development experience between them, it would be nice to think you'd read what they put, gone away, and carefully considered and tried what they were suggesting.

  5. #37
    Registered+
    Join Date
    Apr 2013
    Posts
    19
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: How can i delete database value using an html page in php?

    the value still remaining in database.what to do next?

  6. #38
    Senior Member
    Join Date
    Dec 2012
    Location
    Oxfordshire
    Posts
    272
    Thanks
    3
    Thanked
    18 times in 17 posts
    • phil4's system
      • Motherboard:
      • Asus Sabertooth Z77
      • CPU:
      • Core i7-3770K @ 4.6Ghz
      • Memory:
      • 16Gb Corsair Dominator Platinum @ 1866Mhz
      • Storage:
      • OS: OCZ Vertex 4 256Gb, Data: 3Tb Seagate HDD, Cache: OCZ Agility 4 128Gb
      • Graphics card(s):
      • 2 x EVGA GTX 680 SC
      • PSU:
      • 750W Corsair Pro Series AX
      • Case:
      • Corsair Obsidian 650D Black
      • Operating System:
      • Windows 7 Ultimate 64Bit
      • Monitor(s):
      • 2 x Dell U2410 Ultrasharp
      • Internet:
      • Plusnet Fibre Unlimited 76/20

    Re: How can i delete database value using an html page in php?

    Sorry, but you're now beyond the help I can give. You clearly have not read or perhaps not understood what I've put above. As such I can no longer assist.

  7. #39
    Registered+
    Join Date
    Apr 2013
    Posts
    19
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: How can i delete database value using an html page in php?

    can u please rewrite my delete.php page?

  8. #40
    Senior Member
    Join Date
    Dec 2012
    Location
    Oxfordshire
    Posts
    272
    Thanks
    3
    Thanked
    18 times in 17 posts
    • phil4's system
      • Motherboard:
      • Asus Sabertooth Z77
      • CPU:
      • Core i7-3770K @ 4.6Ghz
      • Memory:
      • 16Gb Corsair Dominator Platinum @ 1866Mhz
      • Storage:
      • OS: OCZ Vertex 4 256Gb, Data: 3Tb Seagate HDD, Cache: OCZ Agility 4 128Gb
      • Graphics card(s):
      • 2 x EVGA GTX 680 SC
      • PSU:
      • 750W Corsair Pro Series AX
      • Case:
      • Corsair Obsidian 650D Black
      • Operating System:
      • Windows 7 Ultimate 64Bit
      • Monitor(s):
      • 2 x Dell U2410 Ultrasharp
      • Internet:
      • Plusnet Fibre Unlimited 76/20

    Re: How can i delete database value using an html page in php?

    In a word - No.

  9. #41
    Registered+
    Join Date
    Apr 2013
    Posts
    19
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: How can i delete database value using an html page in php?

    k.i dnt.

Page 3 of 3 FirstFirst 123

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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