PHP OOPS – MySQL connecting Insert update delete select Fetch Data

PHP OOPS – MySQL connecting Insert update delete select Fetch Data

In this Post We Will Explain About is PHP OOPS – MySQL connecting Insert update delete select Fetch Data With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to php – Fetch data from MySQL using OOPExample

In this post we will show you Best way to implement Fetching Data from Database using PHP classes OOP, hear for OOPS – MySQL connecting and fetching data – PHPwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Also Read :  paypal express checkout woocommerce Integration

function.php

<?php
session_start();
define('DB_SERVER','localhost');
define('DB_USER','root');
define('DB_PASS' ,'live9*896********');
define('DB_NAME', 'live24u');
class DB_con
{
	function __construct()
	{
		$conn = mysql_connect(DB_SERVER,DB_USER,DB_PASS) or die('live24u check localhost connection problem'.mysql_error());
		
		//select here database
		mysql_select_db(DB_NAME, $conn);
	}
	public function userfetchdata()
	{
	$result=mysql_query("select * from usermst");
	return $result;
	}
}
?>

index.php

<?php
include_once("function.php");
$userfetchdata=new DB_con();
 
 ?>
 <h2>PHP OOPS - MySQL connecting Insert update delete select Fetch Data</h2>
 <table>
  <tr>
    <th>SR. no.</th>
    <th>Name</th>
    <th>Email Address</th>
    <th>Contact no</th>
    <th>User Gender</th>
    <th>User Education</th>
    <th>User Address</th>
    <th>User PostingDate</th>
  </tr>
  <?php
  $myquery=$userfetchdata->userfetchdata();
  $counter=1;
  while($results=mysql_fetch_array($myquery))
  {
  ?>
  <tr>
      <td height="29"><?php echo $counter;?></td>
    <td><?php echo $results['name'];?></td>
    <td><?php echo $results['email_add'];?></td>
    <td><?php echo $results['phon_no'];?></td>
    <td><?php echo $results['user_gender'];?></td>
    <td><?php echo $results['user_education'];?></td>
    <td><?php echo $results['user_addrss'];?></td>
    <td><?php echo $results['user{posting_date'];?></td>
 
  </tr>
  <?php $counter=$counter+1;} ?>
</table>

Example

I hope you have Got What is Select or Fetch Data from Mysql Table using OOPS in PHP And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.