<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mysql database in php - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/mysql-database-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/mysql-database-in-php/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Thu, 28 Jul 2022 05:37:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>mysql database in php - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/mysql-database-in-php/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to create a database using PHP and MySQL ?</title>
		<link>https://www.wikitechy.com/interview-questions/php/how-to-create-a-database-using-php-and-mysql/</link>
					<comments>https://www.wikitechy.com/interview-questions/php/how-to-create-a-database-using-php-and-mysql/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Thu, 28 Jul 2022 05:18:54 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[accessing the database in php]]></category>
		<category><![CDATA[create database mysql]]></category>
		<category><![CDATA[Create MySQL Database And Table Using PHP In XAMPP]]></category>
		<category><![CDATA[Create MySQL Database Using PHP]]></category>
		<category><![CDATA[Creating MySQL Database Using PHP]]></category>
		<category><![CDATA[database connection in php with mysql]]></category>
		<category><![CDATA[how can we connect to a mysql database from a php script]]></category>
		<category><![CDATA[How to Connect MySQL Database with PHP Website]]></category>
		<category><![CDATA[How to create a database in MySQL using PHP script]]></category>
		<category><![CDATA[mysql database in php]]></category>
		<category><![CDATA[php code to create database and table]]></category>
		<category><![CDATA[PHP MySQL Create Database]]></category>
		<category><![CDATA[selecting a database in php]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4497</guid>

					<description><![CDATA[&#160; Database is a collection of inter-related data which helps in insertion, retrieval and deletion of data from database and organizes the data in the form of views, tables, reports, schemas etc. For example, institute database organizes the data about students, admin, faculty, and staff etc. which helps in insertion, efficient retrieval and deletion of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4504" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1.png" alt="" width="882" height="487" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1.png 882w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-300x166.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-768x424.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-390x215.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-database-connection-1-820x453.png 820w" sizes="(max-width: 882px) 100vw, 882px" /></p>
<ul>
<li style="text-align: justify;">Database is a collection of inter-related data which helps in insertion, retrieval and deletion of data from database and organizes the data in the form of views, tables, reports, schemas etc.</li>
<li style="text-align: justify;">For example, institute database organizes the data about students, admin, faculty, and staff etc. which helps in insertion, efficient retrieval and deletion of data from it.</li>
<li style="text-align: justify;">In MySQL we need to create a database to execute a query.</li>
<li style="text-align: justify;">MySQL is an open-source relational database management system and it is distributed, supported and developed by Oracle Corporation.</li>
<li style="text-align: justify;">MySQL is a database system that runs on a server and it is ideal for both small and large applications.</li>
<li style="text-align: justify;">From <a href="https://www.wikitechy.com/php/">PHP</a> script establish a connection to MySQL server.</li>
<li style="text-align: justify;">Write a <a href="https://www.wikitechy.com/tutorials/sql/">SQL</a> query to create a database and store it in a string variable then execute the queries.</li>
<li style="text-align: justify;">Using <strong>Object-oriented</strong> procedure, we can use the query () function of MySQLi class to execute our query.</li>
<li style="text-align: justify;">Using <strong>procedural</strong> procedure, we can use the mysqli_query () function of PHP to execute our query.</li>
<li style="text-align: justify;">Using <strong>PDO</strong> procedure then we can execute our query.</li>
</ul>
<h2 id="sample-code">Sample Code</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-php code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-php code-embed-code">&lt;?php<br/>$servername = &quot;localhost&quot;;<br/>$username = &quot;username&quot;;<br/>$password = &quot;password&quot;;<br/><br/>// Creating a connection<br/>$conn = new mysqli($servername, $username, $password);<br/>// Check connection<br/>if ($conn-&gt;connect_error) {<br/>    die(&quot;Connection failed: &quot; . $conn-&gt;connect_error);<br/>} <br/>// Creating a database named newDB<br/>$sql = &quot;CREATE DATABASE newDB&quot;;<br/>if ($conn-&gt;query($sql) === TRUE) {<br/>    echo &quot;Database created successfully with the name newDB&quot;;<br/>} else {<br/>    echo &quot;Error creating database: &quot; . $conn-&gt;error;<br/>}<br/><br/>// closing connection<br/>$conn-&gt;close();<br/>?&gt;</code></pre> </div>
<h2 id="output">Output</h2>
<p><img decoding="async" class="alignnone size-full wp-image-4498" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql.png" alt="" width="1180" height="625" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql.png 1180w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-300x159.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-1024x542.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-768x407.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-390x207.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/07/php-mysql-820x434.png 820w" sizes="(max-width: 1180px) 100vw, 1180px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/php/how-to-create-a-database-using-php-and-mysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
