Results 1 to 3 of 3
  1. #1
    pph Expert! Gordon's Avatar
    Join Date
    January 18th, 2005
    Location
    Edmonton Canada
    Posts
    5,781
    How can I do this?
    I'm trying to write a bit of php script that I can run and it will delete from my database any lines/products that meet into the criteria. In this case below I am looking to delete all lines/products that do not have anything in the maincat field. I am not having any luck at all trying to get it to work. Can anyone tell/explain to me what I am doing wrong please?

    Thanks in advance.

    <?php

    require_once("./config.inc.php");


    $sql = mysql_query("SELECT * FROM databasename WHERE maincat = ' ' ") or die(mysql_error());


    $sql = ("DELETE (*) FROM databasename WHERE maincat = ' ' ");


    ?>
    One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
    Mr. Spitzer is fetching it nearer

    YouTrek

  2. #2
    ABW Ambassador cditty's Avatar
    Join Date
    January 18th, 2005
    Location
    Memphis TN
    Posts
    1,434
    mysql_query("delete FROM databasename WHERE maincat = ' ' ") or die(mysql_error());

    Should do it for you
    Recycled Talent - Architects of custom scripts and snippets, perfectly written to suit any need. We stay on top of the latest technology so you don't have to.
    Total Stupidity - Shining light on stupid things.

  3. #3
    pph Expert! Gordon's Avatar
    Join Date
    January 18th, 2005
    Location
    Edmonton Canada
    Posts
    5,781
    Thanks Chris I was going mad trying to figure this out
    One day parasites and their ilk will be made illegal, I bet a few Lawyers will be pissed off when the day comes.
    Mr. Spitzer is fetching it nearer

    YouTrek

  4. Newsletter Signup

+ Reply to Thread

Posting Permissions

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