Hey everybody I want to let you know that I have undertaken the grueling task of getting the heck away from WordPress. I was so sick of the problems and updates I had to do all the time. I am now using my ezbloo system and I am integrating all my old posts into the new system. It sucks, but in the end, I will save bundles of time. I needed to keep things simple and that is why I created ezbloo. I'll have more on this later for you guys after I am done with the total integration of my old posts here. So if you are looking for a post and need it faster, shoot me an email and I will make it a priority. [email protected]

Retrieving data from MySql with PHP is a simple process however you should have the following things set up before implementing this process.

  1. You Created A Database
  2. You Granted Privileges to the database
  3. Created a config.php file to access the database
After you insert data into a database you will eventually need to be retrieving data from MySql with PHP. Here is a code that you can use for that.

Code For Retrieving Data From MySql with PHP

<?php
include('config.php');
$con = new mysqli("$host", "$username", "$password", "$dbname");
$result = $con->query("SELECT * FROM TABLE") ;
while ($row = $result->fetch_assoc()) {
echo $row['row-name'];
}
$con->close();
?>
If you only need one result with PHP and MySQL use this code.
$result = $con->query("SELECT id, mechanic FROM users WHERE id='$var' LIMIT 1") ;
    $row = $result->fetch_assoc();
    echo $row['mechanic'];