Delete record

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ken

    Delete record

    Is this a correct statement to delete a row in a table named "ad_data"?

    mysql_query("DE LETE FROM ad_data WHERE id = $_SESSION['id']");

    The connection is open.

    $_SESSION['id'] echo's as 220 which is correct.

    id is the primary auto indexed variable.

    I have written to ad_data many times but this is my first attempt to delete
    a row. I know the database is working.

    Is there a permission to delete that must be set. I could not find a means
    of setting permissions for the table.

    Thanks for the help.

    Ken




  • Aggro

    #2
    Re: Delete record

    Ken wrote:
    [color=blue]
    > Is this a correct statement to delete a row in a table named "ad_data"?
    >
    > mysql_query("DE LETE FROM ad_data WHERE id = $_SESSION['id']");[/color]

    Make sure your query looks like what it is supposed to look like, for
    example like this:

    $query = "DELETE FROM ad_data WHERE id = $_SESSION['id']";
    echo "Query is: " . $query;
    mysql_query( $query );
    [color=blue]
    > Is there a permission to delete that must be set. I could not find a means
    > of setting permissions for the table.[/color]

    Yes it is possible to give for example only permission to select from
    table. Or you can give permission to only select from table.

    Try echoing out the query and then copy-paste that query to MySQL via
    mysql - console program with the same username and password and you
    should get an error message if something is wrong.

    If it works correctly from console, you got propably problem with
    php-MySQL. Figure out how you can print out error messages in php and
    try again to get the error message from there.

    Comment

    Working...