Greetings andrew,
First off, there's really not enough information in your post to help me/us figure out what's wrong and let you know. What are some of the example data sets that fill your variables like $search and $id?
Next, and very important: FOR THE LAST TIME, LEARN TO USE PLACEHOLDERS AND USE THEM! Several different people have told you about placeholders on several different occations. Please, please use them. In your SQL above, let's say you want $search to be "andrew's sql". Well, the way you have it coded now, badness because the single quote in $search will get interpreted by your database to be the end if the $search string. You'll get a SQL error. Using placeholders saves you headaches.
$sth = $dbh->prepare(q{ SELECT * FROM items WHERE category = ? AND description LIKE ? OR itemid LIKE ? OR longdescription LIKE ? LIMIT ?, ? }); $sth->execute( $id, '%' . $search . '%', '%' . $search . '%', '%' . $search . '%', $offset, $limit ) or die $dbh->errstr;
So try the above code to see if it helps. If not, then post back some additional code or information about your specific situation.
gryphon
code('Perl') || die;
In reply to Re: MYSQL while function
by gryphon
in thread MYSQL while function
by andrew
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |