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
Mysql Query Problem
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="GarettM" data-source="post: 309014" data-attributes="member: 839"><p>Okay first run the sql code below into your database. You don't use varchar for dates.</p><p>[CODE]ALTER TABLE groups DROP `created`; ALTER TABLE groups ADD `created` DATETIME;[/CODE]</p><p>Second change how you get your variables</p><p>[PHP]</p><p>$rid = (int) filter_input(INPUT_POST, 'room_id');</p><p>$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_SPECIAL_CHARS);</p><p>$desc = filter_input(INPUT_POST, 'desc', FILTER_SANITIZE_SPECIAL_CHARS);</p><p>$priv = filter_input(INPUT_POST, 'priv', FILTER_SANITIZE_SPECIAL_CHARS);</p><p>$stat = filter_input(INPUT_POST, 'stat', FILTER_SANITIZE_SPECIAL_CHARS);</p><p>$badge = filter_input(INPUT_POST, 'img', FILTER_SANITIZE_SPECIAL_CHARS);</p><p>$date = date('Y-m-d h:i:s', time());</p><p>[/PHP]</p><p>Third try this and see if you still get an error.</p><p>[PHP]</p><p>dbquery(sprintf("INSERT INTO groups (name, desc, badge, ownerid, created, roomid, locked, privacy) VALUES ('%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s');",$name, $desc, $badge, (int)USER_ID, $date, $rid, $priv, $stat));</p><p>[/PHP]</p><p></p><p>i believe the error is spacing :3</p><p></p><p>Also another note add more filtering. <img src="/styles/default/xenforo/smilies/emojione/tongue.png" class="smilie" loading="lazy" alt=":p" title="Stick Out Tongue :p" data-shortname=":p" /> like strip non alpha characters</p></blockquote><p></p>
[QUOTE="GarettM, post: 309014, member: 839"] Okay first run the sql code below into your database. You don't use varchar for dates. [CODE]ALTER TABLE groups DROP `created`; ALTER TABLE groups ADD `created` DATETIME;[/CODE] Second change how you get your variables [PHP] $rid = (int) filter_input(INPUT_POST, 'room_id'); $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_SPECIAL_CHARS); $desc = filter_input(INPUT_POST, 'desc', FILTER_SANITIZE_SPECIAL_CHARS); $priv = filter_input(INPUT_POST, 'priv', FILTER_SANITIZE_SPECIAL_CHARS); $stat = filter_input(INPUT_POST, 'stat', FILTER_SANITIZE_SPECIAL_CHARS); $badge = filter_input(INPUT_POST, 'img', FILTER_SANITIZE_SPECIAL_CHARS); $date = date('Y-m-d h:i:s', time()); [/PHP] Third try this and see if you still get an error. [PHP] dbquery(sprintf("INSERT INTO groups (name, desc, badge, ownerid, created, roomid, locked, privacy) VALUES ('%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s');",$name, $desc, $badge, (int)USER_ID, $date, $rid, $priv, $stat)); [/PHP] i believe the error is spacing :3 Also another note add more filtering. :p like strip non alpha characters [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Mysql Query Problem
Top