Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

How to write $table contains, instead of equals?

Codes here !

Moderators: macek, egami, gesf

How to write $table contains, instead of equals?

Postby Tony121076 » Mon Feb 03, 2003 7:38 am

I want mySQL to return rows in table "comp", where c_addr contains (but may not equal) $kword.

I know how to write...

$query = "SELECT * FROM comp WHERE c_addr = '$kword'";

but I don't know how to ask for rows that just contain, but may not equal my $kword. Is this even possible? Please help. Thank you for you time and attention.
Tony121076
New php-forum User
New php-forum User
 
Posts: 28
Joined: Fri Jan 03, 2003 4:00 pm

I found the answer...

Postby Tony121076 » Mon Feb 03, 2003 9:02 am

the answer is,

$query = "SELECT * FROM comp WHERE c_addr LIKE '%$kword%'";
Tony121076
New php-forum User
New php-forum User
 
Posts: 28
Joined: Fri Jan 03, 2003 4:00 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.