Jump to content

trying to insert


ckdoublenecks

Recommended Posts

I get the following message:

name4Query failed: Unknown column 'late' in 'field list'

with this code.  What does it mean?

<?php
$apt=$_POST['search_term'];
$stat = mysql_connect("localhost","root","");
$stat = mysql_select_db("prerentdb");
$query = "SELECT name FROM payments WHERE late = 'L'";
$stat = @mysql_fetch_assoc(mysql_query($query));
echo $stat["name"];
$name=$_POST['name'];  
$apt=$_POST['apt']; 
$amtpaid=$_POST['amtpaid'];  
$rentdue=$_POST['rentdue'];  
$prevbal=$_POST['prevbal'];
$hudpay=$_POST['hudpay'];  
$tentpay=$_POST['tentpay']; 
$datepaid=$_POST['datepaid'];
$late=$_POST['late']; 
$comments=$_POST['comments'];  
$paidsum=$_POST['paidsum'];
$query = "
INSERT INTO payhist (name,apt,amtpaid,rentdue,prevbal,
hudpay,tentpay,datepaid,late,comments,paidsum)
VALUES('$name','$apt','$amtpaid','$rentdue','$prevbal',
'$hudpay','$tentpay','$datepaid','$late','$comments','$paidsum')";
$stat = mysql_query($query) or die('Query failed: ' . mysql_error());  
mysql_close();
echo "data inserted<br /><br />"; 
?>

Link to comment
Share on other sites

it means exactly what it says. Your query failed, because there is no column called 'late'.

 

This is some of the worst code of seen for a while. This in particular....

 

$stat = @mysql_fetch_assoc(mysql_query($query));

 

How do you expect to handle errors here?

Link to comment
Share on other sites

  • 1 year later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.