| | |
Multile sql statement
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 510
Reputation:
Solved Threads: 0
Hi,
What is wrong with this sql? It fails in php but doesn't fail in phpmyadmin!
Thanks
What is wrong with this sql? It fails in php but doesn't fail in phpmyadmin!
Thanks
PHP Syntax (Toggle Plain Text)
<?php $connection=mysql_connect("localhost", "root", ""); if(!$connection) { die('Could not connect: ' . mysql_error()); } else { mysql_select_db("test", $connection) or die('Could not select the table.'); $sql="BEGIN;\n"; $sql.="SET AUTOCOMMIT=0;\n"; $sql.="INSERT INTO table1 (id, name) values (1, 'person1');\n"; $sql.="INSERT INTO table2 (id, name) values (2, 'person2');\n"; $sql.="INSERT INTO table3 (id, name) values (3, 'person3');\n"; $sql.="COMMIT;"; /*echo "<pre>"; echo $sql;exit;*/ $runSql=mysql_query($sql); if($runSql) { echo "Done"; } else { echo "Failed"; } } ?>
•
•
•
•
mysql_query() sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated with the specified link_identifier .
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- is there something wrong with my SQL statement? (PHP)
- Syntax error in "like" in sql statement (ASP.NET)
- Question about SQL statement (MS SQL)
- SQL statement error (ASP.NET)
- sql statement (Visual Basic 4 / 5 / 6)
- run sql statement in asp (ASP)
Other Threads in the PHP Forum
- Previous Thread: Help, please?
- Next Thread: Global Methods
Views: 413 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql oop parse password paypal pdf php problem query radio random recursion regex remote script search select seo server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web webdesign xml youtube






