PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Im getting the odd error "Unknown column 'test' in 'field list'" when i try to use it. (thats when i put test in) . I cant really see the problem with it all but im really rusty with php so ive probably done somthing stupid.
<?php
include('includes/header.txt');
include('db.php');
$subjectname = $_POST['subjectname'];
if ($subjectname == '')
{
echo("<b>You forgot to fill in all of the form.</b><br><br>");
include('includes/subjectform.txt');
}
else
{
echo("<b>You forgot to fill in all of the form.</b><br><br>");
db_query(false,"INSERT INTO tt_subjects (SubjectName)
VALUES ($subjectname)");
}
include('includes/footer.txt');
?>
And that is called by a simple html form. If you want to try it out for yourself its here http://www.kzar.co.uk/project
<?
//...
if ($subjectname == '')
{
echo("<b>You forgot to fill in all of the form.</b><br><br>");
include('includes/subjectform.txt');
}
else
{
echo("<b>You forgot to fill in all of the form.</b><br><br>"); //take this out, bad idea
db_query(false,"INSERT INTO tt_subjects (SubjectName)
VALUES ($subjectname)"); //try the query i gave you
//put in a success message
//...
?>
<?
//...
if ($subjectname == '')
{
echo("<b>You forgot to fill in all of the form.</b><br><br>");
include('includes/subjectform.txt');
}
else
{
echo("<b>You forgot to fill in all of the form.</b><br><br>"); //take this out, bad idea
db_query(false,"INSERT INTO tt_subjects (SubjectName)
VALUES ($subjectname)"); //try the query i gave you
//put in a success message
//...
?>
Good luck.
Cheers mate. Yea the error on both outcomes was because i copied the error but forgot to change it to a success message! Anyway that sql worked a treat.