Jump to content

Archived

This topic is now archived and is closed to further replies.

anthonydamasco

PHP, MySQL easy quick santax question

Recommended Posts

Really simple

I have 2 columns in a table that I want people to be able to search from

here is my php

[code=php:0]

$result = mysql_query("SELECT * FROM employees WHERE firstname or lastname LIKE '%$search%'");

[/code]

i know "or" is wrong, because its only searching the "lastname" column, what is the correct santax?

Share this post


Link to post
Share on other sites
$result = mysql_query("SELECT * FROM employees WHERE firstname LIKE '%$search%' OR lastname LIKE '%$search%'");

OR is correct.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.