![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
The original post:
"SELECT * FROM customer WHERE name LIKE '$name' OR
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#12 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Single quotes only matter when defining a string. ie.
$name = "Fred"; echo "Hello '$name'"; # outputs: Hello 'Fred' echo 'Hello $name'; # outputs: Hello $name Aside from very possibly being vulnerable to injection attacks, of course. If $name and $surname come from user input, then you may want to use mysql_real_escape_string, k4pil: $query = "SELECT * FROM customer WHERE name LIKE '" + mysql_real_escape_string($name) + "' OR surname LIKE '" + mysql_real_escape_string($surname) + "'"; |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|