Previous Thread
Next Thread
Print Thread
Hop To
#221808 02/01/2009 12:20 AM
Joined: Mar 2008
Posts: 326
D
Enthusiast
Enthusiast
D Offline
Joined: Mar 2008
Posts: 326
New in the 7 series... I've noticed a lot of queries have things like:
PHP Code
WHERE  t1.USER_ID = ? 

If I'm not mistaken, this is part of the new "prepared statement" feature of MySQL, correct?

However, aren't prepared statements only present in MySQLi? So if it's not a prepared statement, what is it? (My ignorance on this topic is stiffling my modification abilities.)

On that topic, any thought about moving to MySQLi... perhaps for 8.0? I'm sure everyone has gotten with the times and are running PHP 5x by now. wink

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
when you subsequently call do_placeholder_query with the supplied variable array, the routine will replace the ?'s from the variables in the array..

example:
PHP Code

$queryVars = array($Board,$user['USER_ID']);
$query = "
			SELECT USER_ID
	FROM   {$config['TABLE_PREFIX']}MODERATORS
	WHERE  FORUM_ID = ?
	AND	USER_ID = ?
		";
$sth = $dbh -> do_placeholder_query($query,$queryVars); 

soooo... $Board -- forum number -- goes in the first ? and $user['USER_ID'] -- goes in the second ? and THEN the query gets executed..

it can be done another way too... (your choice what you like, really)..

PHP Code
$query = "
			SELECT USER_ID
	FROM   {$config['TABLE_PREFIX']}MODERATORS
	WHERE  FORUM_ID = {$Board}
	AND	USER_ID = {$user['USER_ID']}
		";
$sth = $dbh -> do_query($query); 

badabing smile

SD #221810 02/01/2009 12:28 AM
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
i had answered this post in another forum... you are moving around on me!! laugh

oh and moving to mysqli is a VERY simple thing.. matter of fact, i already have mysqli.inc.php up and running on a coupla websites..

works fine / lasts a long time and the changes from the standard mysql.inc.php is VERY minimal wink

SD #221811 02/01/2009 12:37 AM
Joined: Mar 2008
Posts: 326
D
Enthusiast
Enthusiast
D Offline
Joined: Mar 2008
Posts: 326
Thanks for the assist Sirdude! smile

Joined: Jun 2006
Posts: 16,299
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,299
Likes: 116
Moving from Feedback to General Assistance for 7.x


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
0 members (), 476 guests, and 170 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)