Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

[Need Help] SQL Query for Double quotes string

The mysqli functions have been deprecated by the introduction of the PDO class.
Developers creating websites with SQL database interaction are urged to use the PDO class instead of mysqli.

PHP Code

<?php 
$id 
= '"' . $id . '"'; 

Why are you trying to assign $id to a string of it's self?
This has no use at all, the value of $id is already assigned to the $_GET superglobal.
Just remove that line from your code.

Also if you're going to use mysqli make sure to use the htmlspecialchars function.
(Jun 3, 2015 01:49 AM)Squito Wrote:  Please stop spreading this! MySQLi is NOT deprecated! The outdated and not supported mysql extension is deprecated. Eventually the MySQLi (its full name is "MySQL Improved Extension") and PDO extensions are both the replacement for the mysql extension.

> It isn't deprecated.

In the documentation it clearly states that it is deprecated.
Why would you want to use mysqli anyways when you have the amazing advantage of using PDO?
PDO is still more recommended than mysqli.
MySQLi is NOT deprecated. 'Nuff said. Maybe you mean the MySQL functions being deprecated.

OP is using MySQLi here. It's just the procedural approach. You should look into prepared
statements, they're more secure.

Also, the error that you encountered is normal. The $_GET['id'] is not always defined, so you should
add a code that checks if it is defined.

PHP Code

<?php 
if(isset($_GET['id'])) {
 
// do code here if $_GET['id'] is defined and set
} 
I assure anyone that MySQLi is not deprecated, but I will state my opinion of PDO being easier to use than MySQLi. Remember, just an opinion.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by blackcoder00Aug 30, 2020 10:47 AM 8 219 Aug 30, 2020 10:47 AM
Last Post: newQuery
[PHP] by NuminousApr 5, 2020 09:38 AM 2 151 Apr 5, 2020 09:38 AM
Last Post: Yck
[PHP] by deadsh0tFeb 5, 2018 01:26 PM 7 257 Feb 5, 2018 01:26 PM
Last Post: Charger