[thelist] create mysql tables / multiple queries

Robert Gormley robert at pennyonthesidewalk.com
Sun Oct 30 21:32:47 CST 2005


That's exactly why.

If you're using PHP 5 / MySQL 4.1+, the mysqli extension offers
mysqli_multi_query: www.php.net/manual/en/function.mysqli-multi-query.php

Why do these need to be a single 'statement'? They're not being executed as
a transaction by the DB, as it is.

Rob 

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org 
> [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Alex Beston
> Sent: Monday, 31 October 2005 2:14 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] create mysql tables / multiple queries
> 
> hi
> 
> Was wondering why the following wont work as a single statement in sql
> 
> $sql="CREATE TABLE chat (
>   id mediumint(9) NOT NULL auto_increment,
>   content text NOT NULL,
>   UNIQUE KEY id (id)
> );
> CREATE TABLE users (
>   id mediumint(9) NOT NULL auto_increment,
>   username varchar(40) NOT NULL,
>   lastupdate varchar(40),
>   UNIQUE KEY id (id)
> );";
> 
> with the error
> 
> "There was an error creating the entry"
> 
> its possibly because  mysql_query($sql, $conn);     can only handle 
> single statements - how would i run multiple queries like the 
> one above?
> 
> ta
> Alex
> 
> --
> -------------------------------------------
> 
> Office: 01273 297927 / mobile: 07814 630621
> 
> -------------------------------------------
> 
> 
> -- 
> 
> * * Please support the community that supports you.  * * 
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip 
> Harvester and archives of thelist go to: 
> http://lists.evolt.org Workers of the Web, evolt ! 
> 


More information about the thelist mailing list