This is my error:
Fatal error: Uncaught Error:
Function name must be a string in /home/kmsrutge/public_html/Login2process.php:5
Stack trace:
#0 {main} thrown in /home/kmsrutge/public_html/Login2process.php on line 5
My code:
$db_server = $mysqli_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to MySQL: " . $mysqli_error());
$mysqli_select_db($db_database) or die("Unable to select database: " . $mysqli_error());
$sql = "UPDATE Invoices SET Ord_ID = '$9144' WHERE Prod_ID = '98'; ";
$result = $mysqli_query($sql);
if($result) echo "UPDATE success!"; else echo "UPDATE failed!";
if($result)
{
echo "<p>New row was successfully inserted</p>".
$insertQueryCount = $insertQueryCount+1;
}
else
{
echo "<p>Your insert failed.</p>";
die($mysqli_error());
}
?>
I read that it may be a possible PHP 7 issue. Any idea on how to correct this?
Try changing the result variable to the following:
$result = mysqli_query($db_server, $sql);
Please check your code SQL function do not start with $
so you got the error. remove all $
from mysqli
.
Please change the first line:
$db_server = mysqli_connect($db_hostname, $db_username, $db_password,$db_database);
you don't require mysqli_select_db
function so comment that line and check.
Also the fifth line change like mysqli_query($db_server,$sql)
.
Please read (https://www.w3schools.com/php/php_mysql_intro.asp)this documents how to connect SQL and how to write a query.