SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL Table Creation/Population Script Problems

    I cannot seem to find any erroneous coding; but I need to be sure it is not something other than the PHP or MySQL that is acting up. Any ideas?
    PHP Code:
    <?php
    error_reporting
    (E_ALL);
    /*
     * Table Board Creation Script
    */
    include('functionlib.php');
    connect_db();
    // create table board_members
    mysql_query("CREATE TABLE board_members (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ".
        
    "name VARCHAR(32) NOT NULL, ".
        
    "title VARCHAR(32) NOT NULL, ".
        
    "address VARCHAR(32) NOT NULL, ".
        
    "city_state_zip VARCHAR(32) NOT NULL, ".
        
    "home_phone VARCHAR(16) NOT NULL, ".
        
    "cell_phone VARCHAR(16) NOT NULL, ".
        
    "email VARCHAR(32) NOT NULL)")
            or exit(
    '<p>Error No. 1</p>');
    // create table board_positions
    mysql_query("CREATE TABLE board_positions (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ".
        
    "position VARCHAR(32) NOT NULL)")
            or exit(
    '<p>Error No. 2</p>');
    // populate table board_positions
    mysql_query("INSERT INTO board_positions SET position='Executive Staff')"
        
    or exit('<p>Error No. 3</p>');
    mysql_query("INSERT INTO board_positions SET position='Chairperson'")
        or exit(
    '<p>Error No. 4</p>');
    mysql_query("INSERT INTO board_positions SET position='Lieutenant Governor'")
        or exit(
    '<p>Error No. 5</p>');
    mysql_query("INSERT INTO board_positions SET position='Kiwanis Committee'")
        or exit(
    '<p>Error No. 6</p>');
    mysql_query("INSERT INTO board_positions SET position='Regional Advisor'")
        or exit(
    '<p>Error No. 7</p>');
    mysql_query("INSERT INTO board_positions SET position='Other Important Information'")
        or exit(
    '<p>Error No. 8</p>');
    // create table board_relate
    mysql_query("CREATE TABLE board_relate (mid INT NOT NULL, ".
        
    "pid INT NOT NULL, ".
        
    "PRIMARY KEY(mid,pid))")
            or exit(
    '<p>Error No. 9</p>');
    echo(
    '<html><head><title>Success!</title></head><body><p>Database table creation and population successful!</p></body></html>');
    ?>
    Everything should work fine, I think. But it does not.

    When I run it in my browser, it appears to download the page indefinitely, but nothing happens.

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  2. #2
    Super Ninja Monkey Travis's Avatar
    Join Date
    Dec 2001
    Location
    Sioux City, Iowa
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you have the " and ) switched around at this line
    PHP Code:
    mysql_query("INSERT INTO board_positions SET position='Executive Staff')" 
    Travis Watkins - Hyperactive Coder
    My Blog: Realist Anew
    Projects: Alacarte - Gnome Menu Editor

  3. #3
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Trav, you are amazing, my friend. I hate the subtle intricasies of coding some times -- I always tend to mis-code simple things. Many thanks.

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.


Bookmarks

Posting Permissions

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