MySQL Forums
Forum List  »  PHP

MySQL Query Using PHP not working
Posted by: Stavros Kokkineas
Date: January 11, 2018 07:19AM

Hello,

I'm really new to MySQL. I have set up a database and I am using a script that inserts entries in the database through PHP using the following code:


// Server and database connection information
$dbServer = "...";
$dbUsername = ""...";
$dbPassword = "...";
$dbSchema = ""...";

// Madrid time for updating and checking the IsLiveLastUpdated column
date_default_timezone_set('Europe/Madrid');
$date = date('m/d/Y h:i:s a', time());

con = new mysqli ($dbServer, $dbUsername, $dbPassword, $dbSchema);
$sql = "INSERT INTO 'ProvidersDevices' (UserID, DeviceID, IsLive, sLiveLastUpdated) VALUES (1, '456', 1, '" .$date. "' ") ";

$queryState = mysqli_query($con, $sql);




What is the mistake in the query as it doesn't seem to work and is there any chance I don't have the (user) priviledges to call the time() function on the server?

Options: ReplyQuote


Subject
Written By
Posted
MySQL Query Using PHP not working
January 11, 2018 07:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.