General discussions related to php
2 posts • Page 1 of 1
in mysql, the ampersand (&) is the operator for a bitwise 'and' comparison. 'A & B' translates to 0. instead of using mysql functions, you should use PDO. the syntax is similar enough that you'll catch on quickly and pdo functions are much faster and more secure. a good example of use can be seen at http://jream.com/learning/videos/php-oo ... o-examples . it's a 12 minute video that goes over some basics and advantages, including using prepared statements. Whether you switch to pdo or not, you should also not delete based on a field that is not a primary key, as it creates the possibility for error. You should have a findByName() if you like that returns a record or id, and then delete based only on the id or a unique field. then you won't have to limit results, or risk your data if someone re-uses a name. quoting your fields (using PDO::quote() or mysqli::real_escape_string) should avoid the current issue you're having though.
Who is online
Users browsing this forum: No registered users and 2 guests