Usually localhost // DatabaseUsername => The username for the database (quite often its root) // DatabasePassword => The password for the user of the database if root, then roots password // DatabaseName => The name of the database you wish to use // SelectQuery => The query you want to execute, up to 5 fields. Further explanation below: // // SelectQuery: // Part 1: SELECT // FirstField AS One, // SecondField AS Two, // ThirdField AS Three, // FourthField AS Four, // FifthField AS Five // FROM TableName // All Together: // SELECT FirstField AS One, SecondField AS Two, ThirdField AS Three, FourthField AS Four, FifthField AS Five FROM TableName // // // SelectQuery WITH WHERE OPTIONS: // Part 1: SELECT // FirstField AS One, // SecondField AS Two, // ThirdField AS Three, // FourthField AS Four, // FifthField AS Five // FROM TableName // WHERE FirstField='Test' // All Together: // SELECT FirstField AS One, SecondField AS Two, ThirdField AS Three, FourthField AS Four, FifthField AS Five FROM TableName WHERE FirstField='Test' // // To run the query above you would use: // MySQLSelect("DatabaseHost","DatabaseUsername","DatabasePassword","DatabaseName","SelectQuery"); // Obviously you need to replace the parts with the pieces you need. // // function MySQLSelect($functionhost,$functionusername,$functionpassword,$functiondatabase,$functionselectstatement) { $con = mysql_connect($functionhost,$functionusername,$functionpassword); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db($functiondatabase, $con); $FunctionSelect=$functionselectstatement; $result = mysql_query($FunctionSelect); while($row = mysql_fetch_array($result)) { echo $row['One'] . " " . $row['Two'] . " " . $row['Three'] . " " . $row['Four'] . " " . $row['Five']; echo "
"; } mysql_close($con); } ?>