Jump to content

MySql! Little help please.


paulman888888

Recommended Posts

hi people;

 

Its a simple question

// Build SQL Query  
$query = "SELECT * FROM ";
$query.=$search_table;// The Table to Search
$query.=" WHERE ";
$query.=$query_where;//The Column to Search
$query.=" LIKE \"%$trimmed%\" ";// $trimmed is my Search content
$query.=" ORDER BY ";
$query.=$order_by;
$numresults=mysql_query($query);

That's my code but i would like to search in more columns.

 

So here's my question.

How do i make my code search in more columns?

 

I thought of something like the below but not sure if there even the correct syntax.

//The part i think i need to add
$query_where=$column1.' OR ' $column2;// Am i nearly right?
// Build SQL Query  
$query = "SELECT * FROM ";
$query.=$search_table;// The Table to Search
$query.=" WHERE ";
$query.=$query_where;//The Column to Search
$query.=" LIKE \"%$trimmed%\" ";// $trimmed is my Search content
$query.=" ORDER BY ";
$query.=$order_by;
$numresults=mysql_query($query);

 

Thankyou All

Paul

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.