SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Deleting

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jan 2001
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cam someone help me with deleting information from a MYSQL database.
    I want to delete from one table based on information contacted in another. The code I am using at present (which does not work) looks like this:

    Code:
    DELETE FROM ServedAt
    WHERE ServedAt.Journey_ID=Journey.Journey_ID
    AND Journey.Line_ID='101'
    Any help would be much appreciated. Thanks.

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately, this kind of functionality is not available in MySQL, which does not support sub-selects. You'll have to use a script to get this done, I'm afraid. Select the list of ID's and then iterate through, deleting each one.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    SitePoint Member
    Join Date
    Jan 2001
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, Thanks.

    Do you know of any tutorial which might guide me through creating this kind of script in PHP.

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    My article Building a Database-Driven Web Site using PHP and MySQL should teach you everything you need.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


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
  •