I'm getting this error when I execute my form and it brings up the corresponding .php page.
Invalid query: Unknown column 'DCS' in 'field list' Whole query: SELECT DCS#, CLIREF, GUAR, PAT, ADDR1, ADDR2, CITY, ST, ZIP, SS#, DOB, PHONE, DBAL, TBAL, PAID FROM crossroads10 WHERE CLIREF='ZQ02037/8558'
Here is my code:
<?
$link=mysql_connect('host', 'database', 'password');
if (!$link) {
die('Could not connect: ' .mysql_error());
}
else
{
// Connected to the database
print("Successfully connected to the MySQL database server.<br>\n");
}
$cliacct=$_POST['clientnum'];
$query = "SELECT DCS#, CLIREF, GUAR, PAT, ADDR1, ADDR2, CITY, ST, ZIP, SS#, DOB, PHONE, DBAL, TBAL, PAID FROM crossroads10 WHERE CLIREF='$cliacct'";
$result=mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
while ($row = mysql_fetch_assoc($result)) {
echo $row['GUAR'];
echo $row['PAT'];
echo $row['ADDR1'];
echo $row['ADDR2'];
echo $row['CITY'];
echo $row['ST'];
echo $row['ZIP'];
echo $row['SS#'];
echo $row['DOB'];
echo $row['PHONE'];
echo $row['DBAL'];
echo $row['TBAL'];
echo $row['PAID'];
}
?>
From what I've found, this should work. I've seen where others have had this problem but I have yet to find the solution. Any help would be appreciated.
Thanks