Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default Hulp With Delete Script

    Okay, i have a delete script which should work

    Code:
    <?php
    $hostname = "localhost"; 
    $db_user = "*******"; // change to your database password
    $db_password = "*******"; // change to your database password
    $database = "*******"; // provide your database name
    $db = mysql_connect($hostname, $db_user, $db_password);
    mysql_select_db($database,$db);
    
    $ref = $_GET['RefNum'];
    $ok = @mysql_query("DELETE FROM ads WHERE REFNUM='$ref");
    
    if ($ok) {
    
    echo("Advert Deleted");      
    
      } else {
      echo('<p>Error deleting from database!<br />'.
           'Error: ' . mysql_error() . '</p>');
    }
    
    ?>
    I go to delete it and it says deleted, yet when i check to see if it has deleted it hasn't

    Help please?

    also here is my table structure if it is any help


  2. #2
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    DELETE _ FROM

    your missing whatever is in between DELETE and FROM

  3. #3
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Johnnikins View Post
    Okay, i have a delete script which should work

    Code:
    <?php
    $hostname = "localhost"; 
    $db_user = "*******"; // change to your database password
    $db_password = "*******"; // change to your database password
    $database = "*******"; // provide your database name
    $db = mysql_connect($hostname, $db_user, $db_password);
    mysql_select_db($database,$db);
    
    $ref = $_GET['RefNum'];
    $ok = @mysql_query("DELETE FROM ads WHERE REFNUM='$ref");
    
    if ($ok) {
    
    echo("Advert Deleted");      
    
      } else {
      echo('<p>Error deleting from database!<br />'.
           'Error: ' . mysql_error() . '</p>');
    }
    
    ?>
    I go to delete it and it says deleted, yet when i check to see if it has deleted it hasn't

    Help please?

    also here is my table structure if it is any help

    Are you looking to delete 1 reference number at a time or actually remove the RefNum table from the database?

  4. #4
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    $hostname 
    "localhost"
    $db_user "*******"// change to your database password
    $db_password "*******"// change to your database password
    $database "*******"// provide your database name
    $db mysql_connect($hostname$db_user$db_password);
    mysql_select_db($database,$db);

    $ref $_GET['RefNum'];
    $ok = @mysql_query("DELETE FROM `ads` WHERE `RefNum` = '$ref'");

    if (
    $ok) {

    echo(
    "Advert Deleted");      

      } else {
      echo(
    '<p>Error deleting from database!<br />'.
           
    'Error: ' mysql_error() . '</p>');
    }
    mysql_close($db);
    ?>
    Last edited by MrCraig; 04-08-2008 at 09:01 PM.
    Coming and going...
    Highers are getting the better of me

  5. #5
    Join Date
    Apr 2008
    Posts
    39
    Tokens
    0

    Default

    thanks everyone, i got it working eventually

Posting Permissions

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