Forums
New posts
Search forums
News
Security News
Technology News
Giveaways
Giveaways, Promotions and Contests
Discounts & Deals
Reviews
Users Reviews
Video Reviews
Support
Windows Malware Removal Help & Support
Mac Malware Removal Help & Support
Mobile Malware Removal Help & Support
Blog
Log in
Register
What's new
Search
Search titles only
By:
Search titles only
By:
Reply to thread
Menu
Install the app
Install
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
.
Forums
Guides
Programming Guides & Questions
Question about PHP & MySQLi
Message
<blockquote data-quote="SecretKeeper" data-source="post: 516828" data-attributes="member: 47289"><p>Since I was guided here for help about coding, I have a question that I can't find an answer for:</p><p></p><p>So, I have a project in development which I don't wish to name right now, but there's been a dire question that's stopped me in my tracks.</p><p></p><p>I learnt about Prepared Statements not too long ago, and I've been going on a hunt to clear up any SQLi queries that could be rendered as "unsafe" for user input. However, one question remains: "What about queries that are stored in session variables that were extracted from the database?" By this, I mean user ID's. Do any of these need to be in a Prepped Statement or can they just go in as a normal <strong>$</strong> variable with "real_escape_string"? <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite113" alt=":confused:" title="Confused :confused:" loading="lazy" data-shortname=":confused:" /></p><p></p><p>The only reason why I ask is because the code that grabs a user's friends or a stated profile's posts is all cramped into one PHP file with multiple "Post" variables to tell which query to run and the whole thing looks a mess. So if I need to use Prepped Statements, I'll have to start from scratch (Which I really don't mind. As long as I know if it's right or wrong).</p><p></p><p style="text-align: center"><span style="font-size: 10px"><strong>(Feel free to move this if it's in the wrong place).</strong></span></p></blockquote><p></p>
[QUOTE="SecretKeeper, post: 516828, member: 47289"] Since I was guided here for help about coding, I have a question that I can't find an answer for: So, I have a project in development which I don't wish to name right now, but there's been a dire question that's stopped me in my tracks. I learnt about Prepared Statements not too long ago, and I've been going on a hunt to clear up any SQLi queries that could be rendered as "unsafe" for user input. However, one question remains: "What about queries that are stored in session variables that were extracted from the database?" By this, I mean user ID's. Do any of these need to be in a Prepped Statement or can they just go in as a normal [B]$[/B] variable with "real_escape_string"? :confused: The only reason why I ask is because the code that grabs a user's friends or a stated profile's posts is all cramped into one PHP file with multiple "Post" variables to tell which query to run and the whole thing looks a mess. So if I need to use Prepped Statements, I'll have to start from scratch (Which I really don't mind. As long as I know if it's right or wrong). [CENTER][SIZE=2][B](Feel free to move this if it's in the wrong place).[/B][/SIZE][/CENTER] [/QUOTE]
Insert quotes…
Verification
Post reply
Top