Jump to content

SELECT And Sort


Mr_T

Recommended Posts

Hey, I'm trying to make a script which will match a textbox value against a database, and then sort <=.

 

I've got this so far;

 

<input name="search" id="search" type="text">
<input name="year" id="year" type="text">

$search = $_GET['search'];
$year = $_GET['year'];

SELECT * FROM table WHERE MATCH(Place, Land, Yeartime) AGAINST('%$search%' IN BOOLEAN MODE)

SELECT * FROM table WHERE Yeartime <= '%$year%'

 

This is what I want to accomplish, but the line doesn't seem to work?

 

SELECT * FROM table WHERE MATCH(Place, Land, Yeartime) AGAINST('%$searsearch%' IN BOOLEAN MODE) AND Yeartime <= '%$year%' ORDER BY Yeartime";

 

Link to comment
https://forums.phpfreaks.com/topic/219602-select-and-sort/
Share on other sites

Nevermind I fixed it :) But I got another problem, when i'm trying to display the value in one of the columns in the database the value gets cut in half? I'm guessing there is a character limit. I've tried raising VARCHAR(30) to VARCHAR(60), nothing happened so i'm guessing the problem isn't there?

 

$shortDescription = substr($description, $searchPosition, 150);

 

I just realized that its this line that has to change. What do I change it to? 0? or simply just remove "150" ?

Link to comment
https://forums.phpfreaks.com/topic/219602-select-and-sort/#findComment-1138676
Share on other sites

Archived

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

×
×
  • 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.