Hello:
I'm building a program that holds data of court cases.
I'm making a search script for a user to search for a specific case.
Let's say Attorney Jim wants to search for a case that had a issue of "Allowance" and "input1" was who filed/inputted the report into MySQL database.
I've been working about 30 minutes now trying to figure out why I'm getting this error. Althought im not 100% sure that the error is coming from DBI syntax or MySQL syntax, I think its coming from MySQL Syntax.
use DBI;
$dbh = DBI->connect('DBI:mysql:dataflex') or die "Couldn't connect to
+database: " . DBI->errstr;
$sql = "SELECT * FROM dataflex where attorney = '$INPUT{'attorney'}' a
+nd where issue = '$INPUT{'issue'}'";
$sth = $dbh->prepare($sql) or print "preparing: ",$dbh->errstr;
$sth->execute or print "executing: ", $dbh->errstr;
}
$dbh->disconnect;
Prints out:
executing: You have an error in your SQL syntax near 'where issue = 'Allowance'' at line 1
Anyone know why it's giving me a syntax error?
Thank you,
Anthony
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.