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!


Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1

    Default Delete something unless id=1?

    Well, how do I make it so this deletes all the entrys unless the id of the entry is 1?
    Code:
    PHP Code:
    <?php
    include "includes/config.php"// config file

            
    $query mysql_query("TRUNCATE TABLE `timefriday` ;");

            
    mysql_query("INSERT INTO `timefriday` VALUES ('00:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('01:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('02:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('03:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('04:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('05:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('06:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('07:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('08:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('09:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('10:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('11:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('12:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('13:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('14:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('15:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('16:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('17:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('18:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('19:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('20:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('21:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('21:00', '');") or exit("It didnt do it :(");
            
    mysql_query("INSERT INTO `timefriday` VALUES ('23:00', '');") or exit("It didnt do it :(");

    ?>
    Thank You

  2. #2
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    2,009

    Latest Awards:

    Default

    PHP Code:
    DELETE FROM table WHERE id => 
    Not sure but would somthing like that work?

  3. #3
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    DELETE FROM `table` WHERE `id` != '1'

  4. #4

    Default

    Quote Originally Posted by redtom View Post
    PHP Code:
    DELETE FROM table WHERE id => 
    Not sure but would somthing like that work?
    nope

    Quote Originally Posted by Invent View Post
    DELETE FROM `table` WHERE `id` != '1'
    That worked but when I run it, I get 2 entries So I end up with two 05:00
    Whats the code so it dosnt duplicate =]
    Last edited by .:Jack120:.2; 03-11-2007 at 07:18 PM.

  5. #5
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    2,009

    Latest Awards:

    Default

    Quote Originally Posted by .:Jack120:.2 View Post
    nope
    Change the => to >=

  6. #6

    Default

    Quote Originally Posted by redtom View Post
    Change the => to >=
    Im using invents (Ill +Rep you when/if I get my other account back for helping)

    But because its our timetable and we dont want two 02:00 slots (Because one is id 1) how do we do it. we tried (Below) but didnt work.

    PHP Code:
            mysql_query("INSERT IGNORE INTO `timefriday` VALUES ('02:00', '', '');") or exit("It didnt do it :("); 
    but still adds an id=0

  7. #7
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    2,009

    Latest Awards:

    Default

    Quote Originally Posted by .:Jack120:.2 View Post
    Im using invents (Ill +Rep you when/if I get my other account back for helping)

    But because its our timetable and we dont want two 02:00 slots (Because one is id 1) how do we do it. we tried (Below) but didnt work.

    PHP Code:
            mysql_query("INSERT IGNORE INTO `timefriday` VALUES ('02:00', '', '');") or exit("It didnt do it :("); 
    but still adds an id=0
    Wouldn't updating instead of inserting be easyer?

  8. #8

    Default

    Quote Originally Posted by redtom View Post
    Wouldn't updating instead of inserting be easyer?
    yea =]

    Im crap with these

    PHP Code:
    <?php
    include "includes/config.php"// config file
            
    mysql_query("UPDATE `timetest` SET ('00:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('01:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('02:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('03:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('04:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('05:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('06:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('07:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('08:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('09:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('10:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('11:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('12:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('13:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('14:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('15:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('16:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('17:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('18:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('19:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('20:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('21:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('22:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('23:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");

    ?>
    Last edited by .:Jack120:.2; 03-11-2007 at 09:29 PM.

  9. #9
    Join Date
    Sep 2006
    Location
    Hobart, Australia
    Posts
    593
    Tokens
    0

    Default

    Quote Originally Posted by .:Jack120:.2 View Post
    yea =]

    Im crap with these

    PHP Code:
    <?php
    include "includes/config.php"// config file
            
    mysql_query("UPDATE `timetest` SET ('00:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('01:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('02:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('03:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('04:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('05:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('06:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('07:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('08:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('09:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('10:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('11:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('12:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('13:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('14:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('15:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('16:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('17:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('18:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('19:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('20:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('21:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('22:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");
            
    mysql_query("UPDATE `timetest` SET ('23:00', '', '0') WHERE `id` != '1' ;") or exit("Could not import the sunday timetable data");

    ?>
    The above works? Or do you still need help?

  10. #10

    Default

    Quote Originally Posted by benzoenator View Post
    The above works? Or do you still need help?
    Still need help please =]

Page 1 of 2 12 LastLast

Posting Permissions

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