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
Problem with MYSQL Query
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="trakstarz" data-source="post: 44516" data-attributes="member: 4692"><p>My hotel is private, so whenever a user registers on my site, they have to enter a registration code (similar to a referral code), that they obtained from a friend.</p><p> </p><p> In order to validate the code exists in my database, i would like to check the following tables based on the user input:</p><p> </p><p> <strong>Database table</strong>: USERS</p><p> <strong>Rows</strong>: Code, Username, (or) Real_name</p><p> </p><p> The reason why it needs to check if Username (OR) Real_Name exists is because the code that the new user enters in my site must be matched to their friends username/real_name. </p><p> Below, i put the code that i tried using but wouldn't work:</p><p></p><p>Source: class.users.php</p><p>[PHP]public function IsCodeExist($code = '')</p><p> {</p><p> if (mysql_num_rows(dbquery("SELECT * FROM users WHERE register_code = '" . $code . "' AND (username = '" . $fname . "' OR real_name = '" . $fname . "')")))</p><p> return true;</p><p></p><p> return false;</p><p> }[/PHP]</p><p></p><p>Can anybody provide me with a working code? thanks in advance</p></blockquote><p></p>
[QUOTE="trakstarz, post: 44516, member: 4692"] My hotel is private, so whenever a user registers on my site, they have to enter a registration code (similar to a referral code), that they obtained from a friend. In order to validate the code exists in my database, i would like to check the following tables based on the user input: [B]Database table[/B]: USERS [B]Rows[/B]: Code, Username, (or) Real_name The reason why it needs to check if Username (OR) Real_Name exists is because the code that the new user enters in my site must be matched to their friends username/real_name. Below, i put the code that i tried using but wouldn't work: Source: class.users.php [PHP]public function IsCodeExist($code = '') { if (mysql_num_rows(dbquery("SELECT * FROM users WHERE register_code = '" . $code . "' AND (username = '" . $fname . "' OR real_name = '" . $fname . "')"))) return true; return false; }[/PHP] Can anybody provide me with a working code? thanks in advance [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Problem with MYSQL Query
Top