Search the Community
Showing results for tags 'match'.
-
Hello, I have the following code that should select all strings that start with "rog" (like rogers, etc). SELECT user_id, first_name AS name, gender FROM user_details WHERE MATCH (first_name) AGAINST('rog*') The problme it's that shows me zero results. In first_name column I have a lot of words with "rogers". first_name column have Fulltext assign. If I use just "...AGAINST ('rogers')" it return corect data. It's something wrong with my sentence? Thank you
-
I currently have a fulltext search that works. It matches against a item title column in mysql database. Now I would like to include another column to match against. How can that be done properly? Here's my code. Where it says MATCH, I would like to include the type_1 column as well; like this(type_1.type_1_name). $get_records = $db->prepare("SELECT items.*, type_1.* FROM items LEFT JOIN type_1 ON items.type_1 = type_1.type_1_id WHERE MATCH(items.item_title) AGAINST('$search_query' IN BOOLEAN MODE) ORDER BY items.item_id DESC LIMIT {$limit} OFFSET ".$offset); $get_records->execute(); $result_records = $get_records->fetchAll(PDO::FETCH_ASSOC); if(count($result_records) > 0){ foreach($result_records as $row) { // get results } }
-
Hi I want to echo out something when I post the value of a radio button and this value matches the same name of a html file. How can I formulate my code to achieve that? What I have so far: <?php if (isset($_POST['submitradio'])) { $selected_dir = $_POST['radio1']; echo substr($selected_dir, 0, -4); echo '<img src="'.$selected_dir.'" />'; } ?> So far I get for example the name of the image(order.gif) and the image order. gif. What I now want is to formulate my code so that I can say if I have an image called "order.gif" and a file called "order.html" that I can then echo out some thing. I don't want to actually name the image or the html file. I just want to say if I have two different file types that start with the same name then I can echo out what ever. How can I do that?
-
I have some questions about match phrase (more than 1 word) with phrase. I have some items with keywords which I need to match. Case 1: the keyword is "lady's-shoes" and I need to get items with keywords "lady's-shoes lady's-shoe woman's-shoe" but not to match "lady's-jeans lady's-pants". Case 2: the keyword is "long dress green" and I need to get items with keywords "long dress" and "long dress green" and "long dress green for woman" but not "green shoe " nor "long dress red" Which one do I need to use, LIKE or MATCH AGAINST? Do I need '%%' for the LIKE? Case 3: case 1 without dash (-). Is it better to find if I use dash between words? Thank's. Rgds, ayok
-
Hey all, I have a two column webpage. I would like to make my left column equal the height of the right column. The left column contains my navigation and future advertisements. My right column is my content. I would like to learn how to match the column height of the left column to that of the right column so I can add some Jquery and make the navigation/ad scroll with the user. How can this be achieved? The page is: http://cronanpilotcar.byethost33.com/page/states
-
Hello, I'm trying to create a script which searchs through several columns in a table, using a keyword to search. I use mysqli and a query with MATCH AGAINST. I have got a code but it does not work and I do not know why. It does not give any error, but it basicly returns nothing. Here is my code: <?php if (isset($_POST['submit'])) { $tag = $_POST['tag']; include("database/database.php"); $query = ("SELECT Tutorialid, Title, Author FROM tutorials WHERE MATCH (Title, Body1, Body2, Body3, Body4, Author) AGAINST (?)"); if ($stmt = $connection->prepare($query)){ $stmt->bind_param("s",$tag); $stmt->execute(); $stmt->bind_result($id, $title, $author); $html_table = '</br></br><table class="cats" cellpadding="10" cellspacing="0"> <tr> <th class="cath">Title</th> <th class="cath">Author</th> <th class="cath">Link</th> </tr>'; while ($stmt->fetch()) { $link = "<a href='http://everytutorial.net/tutorials/".$id."'>Click here to open</a>"; $html_table .= '<tr><td class="catd">' .$title. '</td><td class="catd">' .$author.'</td><td class="catd">'.$link.'</td></tr>'; } $html_table .='</table></br></br></br>'; if (empty($id)) { echo "<p>No tutorials found milord.</p>"; } else { echo $html_table; $stmt->free_result(); $connection->close(); } } } I'm not sure what's wrong with it - any help could be great, thanks!