Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MySQLi With Prepared Statements For Beginners
#1
Prepared statements may seem intimidating at first, but once you get hang of it, it’ll seem like second nature to you. The goal of this tutorial is to transform someone with little to no knowledge of prepared statements, into an expert. 
Database Connection

Code:
<?php
   $db = new mysqli('host', 'UserName', 'Password', 'DatabaseName');
   if($db->connect_errno > 0)
   {
       die('Unable to connect to database [' . $db->connect_error . ']');
   }
?>

Select Query
Code:
$results = $db->query("SELECT id,name from emp");

Data fetch in Database
Code:
while($row = $result->fetch_assoc())
{
   echo $row['id'];
   echo $row['name'];
}

Now rows Count
Code:
<?php
echo 'Total results: ' . $result->num_rows;
?>



To Purchase Credit Click here , For how to make money on Sologet forum Click here . 
There is love in sharing
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  How to Stop Sending E-Mail Spam using PHP mail function Kingsolomon 1 59 11-12-2018, 04:38 PM
Last Post: Solomon
  Multiple file upload in php Kingsolomon 1 67 11-08-2018, 03:01 PM
Last Post: Solomon
  How to limit text length in php and provide 'Read more' link Kingsolomon 0 48 10-31-2018, 02:08 PM
Last Post: Kingsolomon
  How to read more / hide text using Jquery and PHP Kingsolomon 0 40 10-31-2018, 02:06 PM
Last Post: Kingsolomon
  Download simple HTML email templates Kingsolomon 0 42 10-31-2018, 02:05 PM
Last Post: Kingsolomon

Forum Jump:


Users browsing this thread:
1 Guest(s)

MySQLi With Prepared Statements For Beginners00