Hello,
Now I've changed the code to;
$item_amount="2.95";
$item_title="Templates, test, ebooks";
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM `items` WHERE `price` = ".$item_amount." AND ((`identify_pos` LIKE '".$item_title."') AND (`identify_pos2` LIKE '".$item_title."')) AND ((`identify_neg` NOT LIKE '".$item_title."') AND (`identify_neg2` NOT LIKE '".$item_title."'))";
$result = mysql_query($sql);
if (mysql_errno()) {
echo 'Error: ' . mysql_error();
} else {
$row=mysql_fetch_assoc($result);
echo $row['item_id'];
}
It doesn't echo anything..
Here is the table structure;
--
-- Table structure for table `items`
--
CREATE TABLE `items` (
`item_id` int(11) NOT NULL AUTO_INCREMENT,
`item_name` varchar(100) NOT NULL DEFAULT '',
`price` varchar(30) NOT NULL DEFAULT '',
`identify_pos` varchar(50) NOT NULL DEFAULT '',
`identify_pos2` varchar(50) NOT NULL DEFAULT '',
`identify_neg` varchar(50) NOT NULL DEFAULT '',
`identify_neg2` varchar(50) NOT NULL DEFAULT '',
`file_id` int(10) NOT NULL DEFAULT '0',
`pack_id` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `items`
--
INSERT INTO `items` (`item_id`, `item_name`, `price`, `identify_pos`, `identify_pos2`, `identify_neg`, `identify_neg2`, `file_id`, `pack_id`) VALUES
(1, '15GB package', '2.95', '15gb', 'templates', 'test', '', 0, 0),
(2, 'not 15gb package', '2.95', 'ebooks', 'templates', '15gb', '', 0, 0);
But it still doesn't return anything! Please help me, what is wrong with it??
Thanks in advance,
Best Regards
Oskar R