in reply to Cannot run a simple script?help im new
500 errors mean the script couldn't complete, or failed to provide http headers to httpd. You are printing the correct header, so that's not the issue.
You have weak taint mode on, but you haven't detainted $Value. With warnings and strict on, the warnings from that will cause perl to not execute. Also, by using strict, you need to declare your variables lexical with my, or explicitly global with use vars . . .; or our. Again, that will prevent execution.
You are giving only one argument to DBI::connect. Maybe you just erased the $user and $passwd args before posting (wise!), but if they are missing in the real script the connection will fail.
You should also make sure that values fed to $sth are correctly quoted. You have attempted to do so with single quotes, and that might work for most $Values, but it is cleaner to use a placeholder,
$sth = $dbh->prepare("SELECT * FROM stock WHERE name=?"); $dbh->execute($Value);
You should check to see if the database connection succeeds. Testing definedness or truth of $dbh is sufficient for that.
After Compline,
Zaxo
|
|---|