Re: ORDER BY
Dies funktioniert:
$select = 'SELECT *';
$from = 'FROM Info';
$where = ' WHERE active = 1';
$searchtext = $_POST['searchtext'];
if ($searchtext != '') {
$where .= " AND Start LIKE '%$searchtext%' OR End LIKE '%$searchtext%' OR Title LIKE '%$searchtext%' OR Person LIKE '%$searchtext%'";
Dies funktioniert nicht:
$select = 'SELECT *';
$from = 'FROM Info';
$where = ' WHERE active = 1 ORDER BY id DESC';
$searchtext = $_POST['searchtext'];
if ($searchtext != '') {
$where .= " AND Start LIKE '%$searchtext%' OR End LIKE '%$searchtext%' OR Title LIKE '%$searchtext%' OR Person LIKE '%$searchtext%'";
Error message:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND Strat LIKE '%wald%' OR End LIKE '%wald%' OR Title LIKE '%wald%' OR Person' at line 1
Tabelle:
CREATE TABLE `Info` (
`id` int(11) NOT NULL auto_increment,
`Start` text NOT NULL,
`End` text NOT NULL,
`Title` text NOT NULL,
`Person` text NOT NULL,
`active` int(11) default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=76 ;
Danke.
Subject
Views
Written By
Posted
9189
January 19, 2009 08:51AM
3594
January 19, 2009 10:16AM
Re: ORDER BY
3619
January 20, 2009 04:13AM
3497
January 20, 2009 04:30AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.