I'm trying to retrieve data through a form that allows user input. The script below works on the command line but I cant seem to execute via a form.
select credit.ExternalID
from credit,invoice
where credit.Purchaser = invoice.User
and invoice.ExternalID = 24607;
Here is what I've done so far, with no luck, to try to accomplish this'
<?php
/ Connecting, selecting database /
$link = mysql_connect(" ", "dbname", "")
or die("Could not connect : " . mysql_error());
mysql_select_db("dbname", $link) or die("Could not select database");
$searchterm=$http_post_vars['searchterm'];
/ Performing SQL query /
$query = "select credit.ExternalID" ;
$query .="from credit,invoice";
$query .="where credit.Purchaser = invoice.User";
$query .="and invoice.ExternalID = '" .$searchterm ."'";
$result = mysql_query($query,$link) or die("Query failed : " .
mysql_error());
print "<br>" . $result . "<br>";
/ Closing connection /
mysql_close($link);
Any help appreciated.