Quick reference for how to read a single field from a MySQL database in PHP: –

// Connect to the database
$mysqli = new mysqli(my.server.com', 'schemaName', 'password', 'databaseName') or die ('<b>Could not connect: </b>' . mysql_error());

// Query the database for the info we need
$results = $mysqli->query("SELECT * FROM myData WHERE id='$id'") or die($mysqli->error);

$content = $results->fetch_assoc();
$field = $content['fieldName'];

 

 

Advertisements