help! not sure how to resolve this error
Posted: Fri Feb 12, 2010 3:47 pm
Basically I'm doing an add function for a small project, and I'm trying to add values from text fields into a database using _POST...
and I think I'm soooooo close to having it work but I'm getting this one error when i try and run it
I'm thinking i might have something to do with how that particular value is an integer in the database, and I'm trying to force it into a string or something? that's just a guess though...
anyway here's my code:
Thanks in advance for any help here, and if you think you need to see any more of my code to sort this just let me know and I'll post it
and I think I'm soooooo close to having it work but I'm getting this one error when i try and run it
Code: Select all
Fatal error: Function name must be a string in /home/a2778613/public_html/add.php on line 3anyway here's my code:
Code: Select all
<?php
$stid = $_POST('stid');
$fname = $_POST('fname');
$sname = $_POST('sname');
$crs = $_POST('crs');
$sch = $_POST('sch');
$yos = $_POST('yos');
$con = mysql_connect("[i]dbhost[/i]", "[i]username[/i]", "[i]password[/i]");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("[i]dbname[/i]", $con);
mysql_query("INSERT INTO students VALUES($stid, $fname, $sname, $crs, $sch, $yos)");
mysql_close($con);
?>