![]() In case you need to create many tables then its better to create a text file first and put all the SQL commands in that text file and then load that file into $sql variable and excute those commands.Ĭonsider the following content in sql_query. I am using this in a migration script where I am grabbing data from the original database and inserting it into the new one, so I am looping through. ![]() At the moment the only way I've figured out is to connect to both databases with a different user for each. Try out following example to create a table − I am trying to connect to 2 databases on the same instance of MySQL from 1 PHP script. First create the SQL query to create the tables then execute the query using mysql_query() function. Third, copy the project folder and paste it into the xampp/htdocs folder. Second, after you finished download the source code, extract the zip file. First, download the source code given below. To create tables in the new database you need to do the same thing as creating the database. These are the steps on how to run Calendar Event In PHP With Source Code. Here is the example showing you how to select a database. Syntaxīool mysql_select_db( db_name, connection ) PHP provides function mysql_select_db to select a database.It returns TRUE on success or FALSE on failure. This is required because there may be multiple databases residing on a single server and you can do work with a single database at a time. Once you establish a connection with a database server then it is required to select a particular database where your all the tables are associated. Try out following example to create a database − Optional - if not specified then last opend connection by mysql_connect will be used. Required - SQL query to create a database This function takes two parameters and returns TRUE on success or FALSE on failure. PHP uses mysql_query function to create a MySQL database. Its very easy to create a new MySQL database. To create and delete a database you should have admin privilege.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |