SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    will not create more than 2 tables via PHP script, but does on PHPmyAdmin.

    I have a query will run more than 1 statement at a time.
    My SQL isbe:

    CREATE TABLE `homepage` ( `content1` longtext, `content2` longtext, `content3` longtext, `title` varchar(100) default NULL, `style` varchar(10) default NULL, `use_homepage_control` char(1) default NULL, `s4` tinyint(4) default NULL, `s5` tinyint(4) NOT NULL default '0', PRIMARY KEY (`s5`) ) TYPE=MyISAM; CREATE TABLE `homepage_style` ( `style_id` tinyint(4) NOT NULL auto_increment, `style_name` char(10) default NULL, `style_description` char(250) default NULL, `s1` tinyint(4) default NULL, `s2` tinyint(4) default NULL, `s3` tinyint(4) default NULL, PRIMARY KEY (`style_id`) ) TYPE=MyISAM;

    However this does not work when I use my PHP script to run the query. If I just have one create table then it works.
    However when I run the complete SQL through PHPmyAdmin it works and generates both tables.

    Any ideas?

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by http://us2.php.net/manual/en/function.mysql-query.php
    mysql_query() sends an unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier .
    .
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there any other way to do it?

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    run mysql_query() twice?
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a whole database with 2,000 queries to insert a new database.

    I've done it by using PHP to break apart the different queries and ran each query separatly.

    Thanks for your advice.

  6. #6
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You have two thousand tables??? Or are you including the records in this set of queries as well?

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This includes the insert statements! There is not 2000 tables!


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
  •