View Single Post
  #3 (permalink)  
Old 20-08-2008, 21:13
Ben Ben is offline
Premium Member
 
Join Date: Jan 2007
Location: setcookie()
Posts: 1,605
Send a message via AIM to Ben Send a message via MSN to Ben Send a message via Yahoo to Ben
Default

Flesso is right. You added a WHERE clause near the end of your statement:

Quote:
AND WHERE tel=$tel";
If you want to add clauses for 2 things, as you did, you use AND only; so another WHERE is not necessary, rather incorrect.

Cocatenation operators (.) to seperate two strings as flesso has quoted to you may not be required for variables, but certainly required for functions and variables that are mysql_fetch_object() results, etc.

And don't forget, when you're querying values for specific fields, etc., as flesso has done so, you add single-quotations, like:

Quote:
DELETE FROM table1 WHERE username = '$var'
Correction:

Quote:
$sql = "DELETE FROM table1 WHERE name = '$name' AND tel = '$tel'";
// then query the variable
Visiting the PHP.net and MySQL.com documentation helps .

PHP: Hypertext Preprocessor
MySQL :: The world's most popular open source database
__________________
dynBB.com Blog PHP MySQL Webmaster Tutorials and Articles - blog.dynbb.com - find tutorials and Webmaster articles on PHP, MySQL CodeIgniter and more! also: dynBB forums

Last edited by Ben; 21-08-2008 at 07:15.
Reply With Quote