$query = "SELECT * FROM customers WHERE firstname = '$firstname', lastname = '$lastname'";
    $result = mysql_query($query);

i keep getting Error: Query was empty

Recommended Answers

Use AND OR not comma. The logical operators available for MySQL are these: http://dev.mysql.com/doc/refman/5.0/en/logical-operators.html

So your query becomes:

$query = "SELECT * FROM customers WHERE firstname = '$firstname' AND lastname = '$lastname'";
Jump to Post

All 3 Replies

It works! So i guess it is always better to use the "worded" versions of operations?

Yes, AND is defined by the standard ANSI/SQL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.