<?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>phpmysql Archives -</title>
	<atom:link href="https://mitindia.in/tag/phpmysql/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/phpmysql/</link>
	<description></description>
	<lastBuildDate>Sat, 26 Nov 2016 07:01:52 +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://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>phpmysql Archives -</title>
	<link>https://mitindia.in/tag/phpmysql/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Fill values in combo box from MySQL using PHP</title>
		<link>https://mitindia.in/fill-values-in-combo-box-from-mysql-using-php/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Tue, 21 Jun 2016 11:41:32 +0000</pubDate>
				<category><![CDATA[PHP-MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpmysql]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=107</guid>

					<description><![CDATA[<p>THE BELOW EXAMPLE SHOWS THAT HOW TO FILL VALUES IN SECOND COMBO BOX BASED ON FIRST COMBO BOX SELECTED VALUES FROM MYSQL DB USING PHP 1 Create a table called &#8220;Course&#8221; as following screen shot with insert few records as well in it. 2. Create another table called &#8220;Subjects&#8221; and add few records as following. 3. [&#8230;]</p>
<p>The post <a href="https://mitindia.in/fill-values-in-combo-box-from-mysql-using-php/">Fill values in combo box from MySQL using PHP</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>THE BELOW EXAMPLE SHOWS THAT HOW TO FILL VALUES IN SECOND COMBO BOX BASED ON FIRST COMBO BOX SELECTED VALUES FROM MYSQL DB USING PHP</p>
<div>1 Create a table called &#8220;<b>Course</b>&#8221; as following screen shot with insert few records as well in it.</div>
<div class="separator"><img decoding="async" class="alignnone" src="https://2.bp.blogspot.com/-EukF_KgNdwM/VtAiIT2y69I/AAAAAAAABLc/TgyYVcrNXWc/s1600/course_table.JPG" width="269" height="177" border="0" /></div>
<div></div>
<div></div>
<div>2. Create another table called &#8220;<b>Subjects</b>&#8221; and add few records as following.</div>
<div class="separator"><img fetchpriority="high" decoding="async" class="alignnone" src="https://2.bp.blogspot.com/-fOdFZ4EUcWo/VtAiwPQbIyI/AAAAAAAABLk/Q1z9SHQXMR0/s1600/subjects.JPG" width="350" height="457" border="0" /></div>
<div></div>
<div></div>
<div>3. Now create &#8220;<b>config.php</b>&#8221; with following code in it.</div>
<div>
<pre>&lt;?php
      $host="localhost";
      $username="root";
      $password="";
      $dbname="demo";
      $con=mysql_connect("$host","$username","$password");
      mysql_select_db("$dbname",$con);
?&gt;</pre>
</div>
<div></div>
<div>In the above code please enter your database name, user name, password etc.</div>
<div></div>
<div>4. Now create &#8220;cmb5.php&#8221; program with following code in it.</div>
<div>
<pre>&lt;?php
include('config.php');
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script language="javascript"&gt;
    function showSub(catid)
 {
 document.frm.submit();
 }
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h2&gt; Fill values in second combo box based on &lt;/br&gt; first 

combo box values from MySQL DB using PHP &lt;/h2&gt;
&lt;hr color=red&gt;
&lt;?php error_reporting (E_ALL ^ E_NOTICE); ?&gt;
&lt;form action="" method="POST" name="frm" id="frm"&gt;
&lt;table width="500" border="0"&gt;
  &lt;tr bgcolor=silver&gt;
    &lt;td&gt;Course&lt;/td&gt;
    &lt;td&gt; &lt;select name="course_id" id="course_id" 

onChange="showSub(this.value);"&gt;
       &lt;option value=""&gt;--Select--&lt;/option&gt;
       &lt;?php
        $sql1="select * from course";
       $sql_row1=mysql_query($sql1);
       while($sql_res1=mysql_fetch_assoc($sql_row1))
       {
       ?&gt;
       &lt;option value="&lt;?php echo $sql_res1["id"]; ?&gt;" 

&lt;?php if($sql_res1["id"]==$_REQUEST["course_id"]) { 

echo "Selected"; } ?&gt;&gt;&lt;?php echo 

$sql_res1["course_name"]; ?&gt;&lt;/option&gt;
        &lt;?php
        }
        ?&gt;
       &lt;/select&gt;
       &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr bgcolor=silver&gt;
    &lt;td&gt;Subjects&lt;/td&gt;
    &lt;td&gt;
       &lt;select name="sub_id" id="sub_id"&gt;
        &lt;option value=""&gt;--Select--&lt;/option&gt;
       &lt;?php
       $sql="select * from subjects where 

cat_id='$_REQUEST[course_id]'";
       $sql_row=mysql_query($sql);
       while($sql_res=mysql_fetch_assoc($sql_row))
       {
       ?&gt;
       &lt;option value="&lt;?php echo $sql_res["id"]; 

?&gt;"&gt;&lt;?php echo $sql_res["Sub"]; ?&gt;&lt;/option&gt;
       &lt;?php
       }
       ?&gt;
    &lt;/select&gt;
       &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
</div>
<div></div>
<div>5. Finally go for out put to see the above program.</div>
<div class="separator"><img decoding="async" class="alignnone" src="https://3.bp.blogspot.com/-BVQm_AosxBs/VtAlEAJ5ouI/AAAAAAAABLw/rNfwqdx_OrI/s1600/output1.JPG" width="684" height="290" border="0" /></div>
<div>That&#8217;s all for now, kindly subscribe us / comments your response!.</div>
<div></div>
<div>Thank you!</div>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Ffill-values-in-combo-box-from-mysql-using-php%2F&amp;linkname=Fill%20values%20in%20combo%20box%20from%20MySQL%20using%20PHP" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Ffill-values-in-combo-box-from-mysql-using-php%2F&amp;linkname=Fill%20values%20in%20combo%20box%20from%20MySQL%20using%20PHP" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Ffill-values-in-combo-box-from-mysql-using-php%2F&#038;title=Fill%20values%20in%20combo%20box%20from%20MySQL%20using%20PHP" data-a2a-url="https://mitindia.in/fill-values-in-combo-box-from-mysql-using-php/" data-a2a-title="Fill values in combo box from MySQL using PHP"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/fill-values-in-combo-box-from-mysql-using-php/">Fill values in combo box from MySQL using PHP</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Inserting radio button value to mysql database through php script</title>
		<link>https://mitindia.in/inserting-radio-button-value-to-mysql-database-through-php-script/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Tue, 21 Jun 2016 11:37:24 +0000</pubDate>
				<category><![CDATA[PHP-MySQL]]></category>
		<category><![CDATA[phpmysql]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=105</guid>

					<description><![CDATA[<p>In the below example shows that  &#8220;Inserting radio button value to mysql database through php script&#8221; Before we begin let us understand brief about radio buttons, radio buttons are used to select single value from a group or it is for single selection or true / false type of values. Step 1 : Create table [&#8230;]</p>
<p>The post <a href="https://mitindia.in/inserting-radio-button-value-to-mysql-database-through-php-script/">Inserting radio button value to mysql database through php script</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the below example shows that  &#8220;Inserting radio button value to mysql database through php script&#8221;<br />
Before we begin let us understand brief about radio buttons, radio buttons are used to select single value from a group or it is for single selection or true / false type of values.</p>
<p>Step 1 : Create table as following screen shot in MySql database with all fields set to <b>varchar</b> type.</p>
<div class="separator"><img loading="lazy" decoding="async" class="alignnone" src="https://3.bp.blogspot.com/--IXqTesTlL0/Vtki8BKYWrI/AAAAAAAABMI/Dnnmoxm4G2U/s1600/booked_status_table.JPG" width="234" height="103" border="0" /></div>
<p>Step 2 : Create a configuration file for connection purpose as following and name it config2.php (as per my example)</p>
<pre>&lt;?php
      $host="localhost";
      $username="root";
      $password="";
      $dbname="demo";
      $con=mysql_connect("$host","$username","$password");
      mysql_select_db("$dbname",$con);
?&gt;</pre>
<p>Step 3:  Create main html/php page to display radio buttons and name it &#8220;radio2mysql.php&#8221; and follow the below code.</p>
<pre>&lt;html&gt;
&lt;head&gt; 
&lt;/head&gt; 
&lt;body&gt;
&lt;center&gt;
&lt;table style="border: 1px solid yellowgreen;"&gt;
 &lt;h2&gt;Inserting Radio button value to MySQL database in 
php&lt;/h2&gt;
 &lt;form method="post" action=""&gt;
&lt;tr&gt; 
&lt;td&gt; Register No: &lt;/td&gt; &lt;td&gt; &lt;input type=text 
name=t1&gt; &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;  &lt;input type="radio" name="status" 
value="Booked"&gt;Booked 
 &lt;input type="radio" name="status" 
value="Pending"&gt;Pending &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt; 
&lt;input type="submit" name="submit" Value="submit"&gt; 
&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;
 &lt;/form&gt;
 &lt;/body&gt;
&lt;/html&gt;
&lt;?php error_reporting (E_ALL ^ E_NOTICE); ?&gt;
&lt;?php
include 'config2.php';
$t1=$_POST['t1'];
$st=$_POST['status'];
$query=mysql_query("select * from booked_status where 
regno='".$t1."' ") or die(mysql_error());
$duplicate=mysql_num_rows($query);
if (isset($_POST['submit']))
{
if($duplicate==0)
   {
$query = "INSERT INTO booked_status (regno, status) 
VALUES ('$t1','$st')";
mysql_query($query) or die(mysql_error());
echo "&lt;center&gt;&lt;h2 style='background-color:green; 
color:white; display:inline'&gt;&lt;span&gt;Successfully 
updated.&lt;/span&gt;";
 }
 else
    {
      echo "&lt;center&gt;&lt;h2 style='background-color:red; 
color:white; display:inline'&gt;&lt;span&gt;The Register No. '$t1' is 
already present in the booking table";
    }
}
?&gt;</pre>
<p>Step 4: Output of the above program is&#8230;</p>
<div class="separator"><img loading="lazy" decoding="async" class="alignnone" src="https://4.bp.blogspot.com/-Rb667G6fe54/VtkkeZgrYRI/AAAAAAAABMU/0VycQv-rz2U/s1600/radio2mysql_ss.JPG" width="786" height="229" border="0" /></div>
<p>Step 5: After successful submit with register number and radio button value following output can be generated.</p>
<div class="separator"><img loading="lazy" decoding="async" class="alignnone" src="https://3.bp.blogspot.com/-M5BDNN-eMmk/Vtkk9A2QT8I/AAAAAAAABMY/jWNrDJLeai0/s1600/radio2mysql_success.JPG" width="808" height="238" border="0" /></div>
<div class="separator"></div>
<div class="separator">Step 6 : After unsuccessful submit with register number and radio button value following output can be generated(duplicate values).</div>
<div class="separator"></div>
<div class="separator"><img loading="lazy" decoding="async" class="alignnone" src="https://1.bp.blogspot.com/-gNO1o2XKxJI/VtklfXq_CCI/AAAAAAAABMk/oTrF7-bAsdo/s1600/radio2mysql_unsuccess.JPG" width="826" height="241" border="0" /></div>
<div class="separator"><b>Thank you for referring above example!</b></div>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Finserting-radio-button-value-to-mysql-database-through-php-script%2F&amp;linkname=Inserting%20radio%20button%20value%20to%20mysql%20database%20through%20php%20script" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Finserting-radio-button-value-to-mysql-database-through-php-script%2F&amp;linkname=Inserting%20radio%20button%20value%20to%20mysql%20database%20through%20php%20script" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Finserting-radio-button-value-to-mysql-database-through-php-script%2F&#038;title=Inserting%20radio%20button%20value%20to%20mysql%20database%20through%20php%20script" data-a2a-url="https://mitindia.in/inserting-radio-button-value-to-mysql-database-through-php-script/" data-a2a-title="Inserting radio button value to mysql database through php script"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/inserting-radio-button-value-to-mysql-database-through-php-script/">Inserting radio button value to mysql database through php script</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>mysqli-examples</title>
		<link>https://mitindia.in/mysqli-examples/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Sat, 18 Jun 2016 09:00:01 +0000</pubDate>
				<category><![CDATA[PHP-MySQL]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[insert records]]></category>
		<category><![CDATA[phpmysql]]></category>
		<category><![CDATA[update records]]></category>
		<category><![CDATA[view records]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=59</guid>

					<description><![CDATA[<p>Following examples shows that how to use mysqli functions to insert, update, delete and select records from database. mysqli, here the letter &#8216;i&#8217; stands for improved version. Example 1 : Insert record to mysql database through php using MySQLi function. Step 1 : create a following html file. &#60;html&#62; &#60;body&#62; &#60;form name=f1 action="mysqli_ins.php" method="POST"&#62; Enter [&#8230;]</p>
<p>The post <a href="https://mitindia.in/mysqli-examples/">mysqli-examples</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Following examples shows that how to use <b><i>mysqli</i></b> functions to <i>insert, update, delete </i>and<i> select</i> records from database.</p>
<p>mysqli, here the letter &#8216;i&#8217; stands for improved version.</p>
<p>Example 1 : Insert record to mysql database through php using MySQLi function.</p>
<p>Step 1 : create a following html file.</p>
<pre>&lt;html&gt;
&lt;body&gt;
&lt;form name=f1 action="mysqli_ins.php" method="POST"&gt;
Enter Emp Code: &lt;input type=text name=t1&gt; &lt;br&gt;
Enter Emp Name: &lt;input type=text name=t2&gt; &lt;br&gt;
Enter Emp Salary: &lt;input type=text name=t3&gt; &lt;br&gt;
&lt;input type=submit value="Submit Data"&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Step 2: Now create &#8220;mysqli_ins.php&#8221; with following code in it.</p>
<pre>&lt;?php

$ec=$_POST['t1'];
$en=$_POST['t2'];
$sal=$_POST['t3'];

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "emp_db";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn-&gt;connect_error) {
    die("Connection issue: " . $conn-&gt;connect_error);
} 

$sql = "INSERT INTO emp_details (ecode, ename, sal)
VALUES ('$ec', '$en', '$sal')";

if ($conn-&gt;query($sql) === TRUE) {
    echo "New record added successfully";
} else {
    echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
}
$conn-&gt;close();
?&gt;</pre>
<p>Step 3: Now run html file and enter a record in it and click on submit button to insert new record to table.</p>
<p>Example 2: Below example shows updating an existing records.</p>
<pre>&lt;?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "emp_db";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn-&gt;connect_error) {
    die("Connection issue: " . $conn-&gt;connect_error);
} 

$sql = "UPDATE emp_details SET ecode='e002' WHERE ename='amit'";

if ($conn-&gt;query($sql) == TRUE) {
    echo "One record updated successfully";
} else {
    echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
}
$conn-&gt;close();
?&gt;</pre>
<p>Example 3: Below example shows that old / existing record can be deleted.</p>
<pre>&lt;?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "emp_db";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn-&gt;connect_error) {
    die("Connection issue: " . $conn-&gt;connect_error);
} 

$sql = "DELETE from emp_details  WHERE ecode='E91'";

if ($conn-&gt;query($sql) === TRUE) {
    echo "One record Deleted successfully";
} else {
    echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
}
$conn-&gt;close();
?&gt;</pre>
<p>Example 4: Select query example.</p>
<pre>&lt;?php
$con=mysqli_connect("localhost","root","","emp_db");

if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM emp_details");

echo "&lt;center&gt;";
echo "&lt;h2&gt;Select Query &lt;/h2&gt;";
echo "&lt;table border=1&gt;";
echo "&lt;tr bgcolor=khaki&gt;";
echo "&lt;th&gt; Employee code &lt;/th&gt;";
echo "&lt;th&gt; Employee Name &lt;/th&gt;";
echo "&lt;th&gt; Salary &lt;/th&gt;";
echo "&lt;/tr&gt;";

while($row = mysqli_fetch_array($result))
  {
echo "&lt;tr&gt;";
echo "&lt;td&gt;" .$row['ecode']. "&lt;/td&gt;";
echo "&lt;td&gt;" .$row['ename']. "&lt;/td&gt;";
echo "&lt;td&gt;" .$row['sal']. "&lt;/td&gt;";
}
echo "&lt;/table&gt;";
echo "&lt;center&gt;";
?&gt;</pre>
<p>&nbsp;</p>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fmysqli-examples%2F&amp;linkname=mysqli-examples" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fmysqli-examples%2F&amp;linkname=mysqli-examples" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fmysqli-examples%2F&#038;title=mysqli-examples" data-a2a-url="https://mitindia.in/mysqli-examples/" data-a2a-title="mysqli-examples"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/mysqli-examples/">mysqli-examples</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
