Share

Flat-file SQL

Subscribe

Delete Bug?

You are viewing a single message from this topic. View all messages.

  1. 2009-06-18 07:34:31 UTC
    Premise:
    To reset the database i roughly delete all the db files.. (don't know if it's the right way to do, i don't find drop database example on fsql documentation)

    Table creation:

    $fsql->query("CREATE TABLE events(
    id INT NOT NULL AUTO_INCREMENT,
    author VARCHAR(30),
    title VARCHAR(30),
    clan VARCHAR(30),
    suburb VARCHAR(30),
    position VARCHAR(5),
    time INT,
    PRIMARY KEY(id)
    )") or die($fsql->error());

    Data insertion:

    INSERT INTO events VALUES (null,'333','Test event three','0-Hope','Kempsterbank','3-3','1245312495')
    INSERT INTO events VALUES (null,'444','Test event four','0-Hope','Kempsterbank','3-3','1245395295')
    INSERT INTO events VALUES (null,'111','Test event one','0-Hope','Kempsterbank','3-3','1245310695')
    INSERT INTO events VALUES (null,'222','Test event two','0-Hope','Kempsterbank','3-3','1245309495')

    Data retrieval query:

    SELECT * FROM events WHERE suburb = 'Kempsterbank' AND clan = '0-Hope' AND position = '3-3'

    Data retrieved:

    array(4) {

    [0]=> array(7) {
    ["id"]=> int(1)
    ["author"]=> string(3) "333"
    ["title"]=> string(16) "Test event three"
    ["clan"]=> string(6) "0-Hope"
    ["suburb"]=> string(12) "Kempsterbank"
    ["position"]=> string(3) "3-3"
    ["time"]=> int(1245312495) }

    [1]=> array(7) {
    ["id"]=> int(2) ["author"]=> string(3) "444"
    ["title"]=> string(15) "Test event four"
    ["clan"]=> string(6) "0-Hope"
    ["suburb"]=> string(12) "Kempsterbank"
    ["position"]=> string(3) "3-3"
    ["time"]=> int(1245395295) }

    [2]=> array(7) {
    ["id"]=> int(3)
    ["author"]=> string(3) "111"
    ["title"]=> string(14) "Test event one"
    ["clan"]=> string(6) "0-Hope"
    ["suburb"]=> string(12) "Kempsterbank"
    ["position"]=> string(3) "3-3"
    ["time"]=> int(1245310695) }

    [3]=> array(7) {
    ["id"]=> int(4)
    ["author"]=> string(3) "222"
    ["title"]=> string(14) "Test event two"
    ["clan"]=> string(6) "0-Hope"
    ["suburb"]=> string(12) "Kempsterbank"
    ["position"]=> string(3) "3-3"
    ["time"]=> int(1245309495) }

    }

    Delete queries:

    delete FROM events WHERE id = 1
    delete FROM events WHERE id = 2
    delete FROM events WHERE id = 3
    delete FROM events WHERE id = 4

    Data retrieved after deleting:

    array(2) {

    [0]=> array(7) {
    ["id"]=> int(3)
    ["author"]=> string(3) "111"
    ["title"]=> string(14) "Test event one"
    ["clan"]=> string(6) "0-Hope"
    ["suburb"]=> string(12) "Kempsterbank"
    ["position"]=> string(3) "3-3"
    ["time"]=> int(1245310695)}

    [1]=> array(7) {
    ["id"]=> int(4)
    ["author"]=> string(3) "222"
    ["title"]=> string(14) "Test event two"
    ["clan"]=> string(6) "0-Hope"
    ["suburb"]=> string(12) "Kempsterbank"
    ["position"]=> string(3) "3-3"
    ["time"]=> int(1245309495)}

    }

    So.. what's wrong??
    I'm a bit confused..
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.