Hi
I am trying to add new user to members table, but it doesn't work without errors.
The insert query works well in my local server, but it doesn't work on remote server without error.
Remote server:
Hosting: InMotionHosting.com
Platform: Linux / Apache 2.4.39/PHP 7.0.33 /mySQL 5.7.26
Local Server:
Platform:Windows 10 / Apache/2.4.39 (Win64) / PHP 7.1.28 /mysqlnd 5.0.12-dev - 20150407
What I have tried:
Here is my code snippet.
function adduser($itemData)
{
$qfields = "(";
$qvalues = " VALUES ('";
$countFields = 0;
foreach($itemData as $key=>$value)
{
$countFields++;
$qfields .= '`'.$key;
if ($countFields == sizeof($itemData))
{
$qfields .= "`) ";
}
else
{
$qfields .= "`, ";
}
$qvalues .= $value;
if ($countFields == sizeof($itemData))
{
$qvalues .= '\')';
}
else
{
$qvalues .= '\', \'';
}
}
$query = 'INSERT INTO `members`'.$qfields.$qvalues.';';
$result = mysqli_query($GLOBALS['link'],$query);
if (!$result) {
mysqli_error($GLOBALS['link']);
die($query);
}
updatepass($itemData['password'],mysqli_insert_id($GLOBALS['link']));
return mysqli_insert_id($GLOBALS['link']);
}
If this code run on remote server, it stop after displaying the query.
If you know why , tell me the reason and solution.
Thanks