Hi There
Im new to php and im writing a webservice that communicates with a My sql database, when i select database all the examples do it like this
which is fine but...Code:$result = mysql_query('select * from Hire_Codes');
if (mysql_num_rows($result) > 0)
{
$response["equip"] = array();
While ($row = mysql_fetch_array($result))
{
$equip = array();
$equip["Code"] = $row["Code"];
$equip["Description"] = $row["Description"];
array_push($response["equip"], $equip);
}
$response["Success"] = 1;
echo json_encode($response);
}
what if i don't want to have to hard code my column names?? basically i want to be able to use something similar to this that can handle a posted MySql Select statement.
is it possible to extract the column name from row in this instance?
Many thanks
Ian
