ckdoublenecks Posted January 22, 2011 Share Posted January 22, 2011 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 https://forums.phpfreaks.com/topic/225270-trying-to-insert/ Share on other sites More sharing options...
trq Posted January 22, 2011 Share Posted January 22, 2011 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 https://forums.phpfreaks.com/topic/225270-trying-to-insert/#findComment-1163394 Share on other sites More sharing options...
Samza Posted May 14, 2012 Share Posted May 14, 2012 I'm having basically the same error. I get this; "Sql ErrorUnknown column 'sentto' in 'field list'". What can I do? Link to comment https://forums.phpfreaks.com/topic/225270-trying-to-insert/#findComment-1345204 Share on other sites More sharing options...
Pikachu2000 Posted May 14, 2012 Share Posted May 14, 2012 Start a new thread with your code posted inside of . . . tags, and the exact errors you're getting. Link to comment https://forums.phpfreaks.com/topic/225270-trying-to-insert/#findComment-1345208 Share on other sites More sharing options...
Recommended Posts