PHP OOPS – MySQL connecting Insert update delete select Fetch Data

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!.

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.


Related FAQ

Here are some more FAQ related to this Article:

  1.   Simple PHP jQuery Ajax Insert Update Delete using MySQLi
  2.   WordPress AJAX URL GET POST Call PHP Function
  3.   PHP Calculate Difference Between Two Dates
  4.   How to Insert Data in Database using PHP OOPS
  5.   crud with php oop and mvc design pattern
  6.   Simple VueJS DataTables Example
  7.   React JSX Basics Step By Step
  8.   Multiple File Upload in laravel 7 Example Tutorial
  9.   VueJS pass multiple value on function with v-on:click
  10.   PHP crud Mysqli Select Insert Update and Delete query