Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
quote_smart function question
Old 01-26-2009, 12:36 PM quote_smart function question
Skilled Talker

Posts: 83
Trades: 0
Hi,

I have a question about the quote_smart() funtion. There are some variants available, but what they all do is wrap text-strings in quotes:

PHP Code:
function quote_smart($value)
{
$value stripslashes($value);
if (!
is_numeric($value))
$value "'" mysql_real_escape_string($value) . "'";
return 
$value;

Why is this necessary? What if i already have quotes in my query:
PHP Code:
mysql_query("SELECT * FROM table WHERE name='".quote_smart($value)
.
"'"
Thanks for explaining.

Matt
killerwhale65 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-26-2009, 02:20 PM Re: quote_smart function question
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
Then I suggest you plainly remove the single quotes from your query, because this quote_smart also adds some safety by escaping the string for MySQL.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Old 01-26-2009, 02:32 PM Re: quote_smart function question
Skilled Talker

Posts: 83
Trades: 0
ok, so it's actually the same quotes as in the query, thats what i needed to know. I am used to putting my quotes in the query, so i can remove this from the quote_smart function. Thanks.
killerwhale65 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to quote_smart function question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24967 seconds with 12 queries