Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Insert Query Error
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Zaka" data-source="post: 396864" data-attributes="member: 12728"><p>First of all I would suggest that you don't mix params with pure data. Now for the answer I think you get an error because you don't define the 3rd value in bindParam which is the data type. Personally I just use array inside of execute which is much easier. I would do it as follows.</p><p>[PHP]$stmm = $dbh->prepare("INSERT INTO hk_logs (staff, action, timestamp) VALUES (:username, :action, :timestamp));</p><p></p><p>$params = [</p><p> "username" => $_SESSION['username'],</p><p> "action" => "Logged in Successfully",</p><p> "timestamp" => time()</p><p>];</p><p></p><p>$stmm->execute($params);</p><p>[/PHP]</p><p></p><p><strong>EDIT:</strong> It could also be the fact that you use time() directly. I don't know why, but sometimes I've gotten errors when I've used time() directly instead of saving it to a variable and then append the variable instead.</p></blockquote><p></p>
[QUOTE="Zaka, post: 396864, member: 12728"] First of all I would suggest that you don't mix params with pure data. Now for the answer I think you get an error because you don't define the 3rd value in bindParam which is the data type. Personally I just use array inside of execute which is much easier. I would do it as follows. [PHP]$stmm = $dbh->prepare("INSERT INTO hk_logs (staff, action, timestamp) VALUES (:username, :action, :timestamp)); $params = [ "username" => $_SESSION['username'], "action" => "Logged in Successfully", "timestamp" => time() ]; $stmm->execute($params); [/PHP] [B]EDIT:[/B] It could also be the fact that you use time() directly. I don't know why, but sometimes I've gotten errors when I've used time() directly instead of saving it to a variable and then append the variable instead. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Insert Query Error
Top