How to put it all in mysql_query?
Posted: Sat May 15, 2004 6:42 am
Hi!
This code will create database and then tables.
Can I somehow write it more shorter like all these mysql commands will execute only one mysql_query, not all 3 of them? something like this:
I try to put ; in the end of each command, but It dosnt seem to work! Any ideas? Thank you
This code will create database and then tables.
Code: Select all
<?php
mysql_connect("localhost","root","q48cur3");
mysql_query("create database data");
mysql_query("use data");
mysql_query("create table users(username char(40))");
?>Code: Select all
<?php
mysql_connect("localhost","root","q48cur3");
mysql_query("create database data; use data; create table users(username char(40))");
?>