473,549 Members | 2,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MySQL: How do i know what table and database my php code is work with?

55 New Member
I know the PHP command "CREATE DATABASE DataBaseName" creates a database in MySQL. I also know that the command "CREATE TABLE TableName" creates a table. But how is the CREATE TABLE command linked to the DATABASE in MySQL, I mean what if there are multiple databases, then in which database would the table be created, how is the table linked to the database?
Feb 28 '16 #1
2 1339
Dormilich
8,658 Recognized Expert Moderator Expert
I know the PHP command "CREATE DATABASE DataBaseName" creates a database in MySQL.
that’s not a PHP command, that’s an SQL command. PHP only sends that to the database, nothing more.

I mean what if there are multiple databases, then in which database would the table be created
the currently active database. in mysqli you can explicitly switch between databases. for PDO you’d probably have to create a new connection, but I never had the need to create databases in PHP.
Feb 29 '16 #2
RonB
589 Recognized Expert Moderator Contributor
It's vary rare and IMO silly to use your own custom php script to create the database. Normally you would use a tool specifically designed for this purpose. The most common one talked about in forums like this is phpMyAdmin which is a 3rd party php app for the administration of mysql. I on the other hand prefer to use Mysql Workbench.
Feb 29 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
2169
by: Joshua Beall | last post by:
Hi All, I am working on a registration system, and one of the things I am going to need to be able to do it setup the database tables for each event that I have registration for. Normally I would do this by hand, but I am wondering if there are any code libraries out there that could generate the SQL for me. Basically I would have a...
2
2225
by: Thomas Bartkus | last post by:
Is it safe to say that restoring the directory from a backup would that restore all database data and structure? All usr/pwd and GRANT info? Thomas Bartkus
0
1506
by: R. Tarazi | last post by:
Hello, We are planning to reprogramm our search machine and website. Since we have call agents who query the same database as the customers do, we had the idea of splitting the database to 2 servers. The call agents can update customer data with our intern webinterface, which not only concerns tables that are for the call agents, but also...
0
1965
by: SQLServer007 | last post by:
25 more days until the "get it free" promotion runs out for xSQL Object (you can get it from http://www.x-sql.com) Here are just some of the great features packed in the product: - Compare SQL Server objects (databases, tables, views, stored procedures, user defined data functions etc.) accross servers. - view and print dependencies; -...
2
3232
by: Raffi | last post by:
I use the --all-databases switch to backup my entire database. Sometimes there's a need to restore individual databases or tables form the backup file. What command should I use for this? Thanks, Raffi
1
3066
by: vineyard_saker | last post by:
Hi, I am new to MySql and I want to practice querying by playing around a relatively large and complex database without having to enter all the data myself. Is there a publicly available MySql database on the internet which I could download? (the "world" database on the MySql website is really to simple to be useful). Of course, it would...
9
5843
by: noor.rahman | last post by:
I was wondering how it may be possible to query 2 MySQL databases using one query statement from PHP. For instance: SELECT database1.tableA.field1 UNION database2.tableB.field2. My concern is, when connecting to MySQL (or sending a query), I only specify 1 database connection resource ID. How does that play out when connecting to 2...
4
4012
by: Tracey | last post by:
I have a Mysql database hosted on a remote server. Previously, I could always connect to those databases using the 3.51 ODBC connector and linking the tables in Access. The benefit of this is that I can view the data from my desktop, export it to spreadsheets if necessary and print labels. I guess because of a Mysql upgrade by my host, the...
1
2476
by: penny111 | last post by:
Hi there, I've migrated a database named "crime" from an MS Access database to MySQL 5.0.37 using the MySQL Migration Toolkit 1.1.11. What i want to do is to copy the database folder from C:\Program Files\MySQL\MySQL Server 5.0\data to the same folder on another machine. So i copied the files directly over, ran MySQL and it recognizes the...
2
1753
by: sandeep jahagir | last post by:
HI, I want to merge TESTLINK and BUGZILLA databases into one, even though they have mysql DB but i have installed in different ports(TESTLINK-3306 and BUGZILLA-3307). so with respect to TEST CASE-ID in test link which are failed or blocked or whatever it should raise a defect in the bugzilla automatically. I am unable to understand which...
0
7521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5369
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1944
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.