Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
I've this PHP script that should be able to identify;Code: Select all
$mysql = mysql_connect($host, $username, $password)or die(mysql_error());
mysql_select_db($db_name, $mysql)or die(mysql_error());
$item_name= mysql_real_escape_string($item_name);
$query="SELECT
*
FROM
`items`
WHERE
`price` = $mc_gross
AND ('$item_name' LIKE `identify_pos` AND '$item_name' LIKE `identify_pos2`)
AND ('$item_name' NOT LIKE `identify_neg` AND '$item_name' NOT LIKE `identify_neg2`)
";
$result = mysql_query($query) or die(mysql_error());
if ( false===($ident_row=mysql_fetch_assoc($result)) ) {
// No row found
die;
}
else {
echo 'item_id: ', $ident_row['item_id'], "<br />\n";
}Code: Select all
--
-- 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(10) NOT NULL default '0',
`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',
`list_id` int(5) NOT NULL default '0',
PRIMARY KEY (`item_id`)
) ENGINE=MyISAM 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`, `list_id`) VALUES
(1, 'Package 1', '2.95', '%15GB%', '%templates%', '', '', 0, 1, 0),
(2, 'Package 2', '2.95', '', '', '%15gb%', '%templates%', 0, 2, 0);I hoped that the above structure would result in that all titles that contain 15GB and Templates are identified as Package 1 (and that works good) and that all other item titles that doesn't include the words 15GB and templates would automaticly be identified as Package 2 but that's the problem. If a title doesn't cotain 15gb or templates the script dies without any result.
I really need help with this so any info is appreciated.
Best Regards
Oskar R
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]