not_tekky_ever
02-09-2007, 01:21 PM
Hey folks
I'm new here & very VERY new to PHP & MySQL.
here's the wrap, i need to create a database for calculating somebody's wages.
I've made the calculator, i've created a table that pulls out an employee's information, & i've managed to creat a form & handler that will insert new employee data. However, I dont have a clue how to create a modify page so the user can access the table from the web browser & alter information.
Here's what i've got:
<html>
<head>
</head>
<body>
<?php
$host="local";
$user="c301";
$password="fo";
$dbname="c301";
$tablename="employee";
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Not connected : ' . mysql_error());
{
db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
$dbname="c3018192";
$tablename="employee";
$query = " UPDATE $tablename SET (`number` , `name` , `address` , `postcode`, `telephone` , `email` , `hours`)
VALUES ('$number', '$name', '$address', '$postcode', '$telephone', '$email', '$hours') where primaryky = `number`;";
if (mysql_select_db($dbname, $link, )){;
print"\"ok\"";
}
else
{
print "\"die('Could not connect: ' . mysql_error())\"";
}
mysql_close($con);
?>
</body>
</html>
[/COLOR]
All I seem to get is:
Parse error: parse error, unexpected '=' in c:\inetpub\wwwroot\04\c301\Advanced Web Applications\test folder\test.php on line 17
Dont suppose anybody can help me? my assignments a week late & the tutor hasn't got any information on his site :confused:
Rob
I'm new here & very VERY new to PHP & MySQL.
here's the wrap, i need to create a database for calculating somebody's wages.
I've made the calculator, i've created a table that pulls out an employee's information, & i've managed to creat a form & handler that will insert new employee data. However, I dont have a clue how to create a modify page so the user can access the table from the web browser & alter information.
Here's what i've got:
<html>
<head>
</head>
<body>
<?php
$host="local";
$user="c301";
$password="fo";
$dbname="c301";
$tablename="employee";
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Not connected : ' . mysql_error());
{
db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
$dbname="c3018192";
$tablename="employee";
$query = " UPDATE $tablename SET (`number` , `name` , `address` , `postcode`, `telephone` , `email` , `hours`)
VALUES ('$number', '$name', '$address', '$postcode', '$telephone', '$email', '$hours') where primaryky = `number`;";
if (mysql_select_db($dbname, $link, )){;
print"\"ok\"";
}
else
{
print "\"die('Could not connect: ' . mysql_error())\"";
}
mysql_close($con);
?>
</body>
</html>
[/COLOR]
All I seem to get is:
Parse error: parse error, unexpected '=' in c:\inetpub\wwwroot\04\c301\Advanced Web Applications\test folder\test.php on line 17
Dont suppose anybody can help me? my assignments a week late & the tutor hasn't got any information on his site :confused:
Rob