How to remove double quotes from a sql query using with php?

Member

by deron , in category: PHP General , a year ago

How to remove double quotes from a sql query using with php?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by dalton_moen , a year ago

@deron 

You can remove double quotes from a SQL query using PHP by using the str_replace function. Here's an example:

1
2
3
4
5
6
7
$query = 'SELECT * FROM "users"'; // SQL query with double quotes

// Remove double quotes from the query
$query = str_replace('"', '', $query);

// Use the modified query for further processing
echo $query; // Output: SELECT * FROM users


In the above example, the str_replace function is used to replace all occurrences of double quotes (") with an empty string ('') in the SQL query. This will remove the double quotes from the query.

Related Threads:

How to remove quotes in PHP?
How to return a sql query using jwt in php?
How to escape quotes in PHP?
How to pass double quotations in a php variable?
How to create double structure arc diagram using d3.js?
How to remove duplicates in array using PHP?