I am running into a very strange issue.
I have a function which prints the columns name of a given database table from MySql.
function getColoumn() {
//replace it with your host normally it could be localhost
$hostname='localhost';
//mysql user name
$username='admin_datauser';
//mysql user password
$password='iCoq4KrJM8';
//connect to the mysql server
$ss = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
//select a database on the mysql server
//please change as you like the database name
mysql_select_db('admin_data');
//SHOW COLUMNS FROM TABLENAME
$query=mysql_query('SHOW COLUMNS FROM user') or die(mysql_error());
foreach($fields as $key=>$field){
echo '"'.$field->Field.'", '; // print each field name
}
}
The output looks like below-
"id", "first_name", "last_name", "email", "address", "country", "city", "state", "phone_number", "fax", "image", "datecreated", "dateupdated", "Company", "token",
I have another array variable where the current static values are like below-
$searchArray = array("first_name","last_name","email","address","country","city","state","phone_number","fax","image");
I need to use the function's variable in this $searchArray. I tried calling the variable in the arrya but it doesn't work in any way.
Any help please??