Hi,
I'm building a php page to add/edit records in a mySQL db.
I'm having a problem with the following code.
I have written in capital letters on the line above where the error occurs and the error message returned by the browser.
The mySQL db is a single table with ID auto increment(primary key).
I would appreciate any ideas.
Thanks.
<html>
<head>
<title>Outline Vacancies input test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFCC" text="#000000">
<?php
if($submit)
{
require( 'connect_jobs1.php' );
$sql = "INSERT INTO allvacs (ID, company, job, location, salary, hours) VALUES ('','$company','$job','$location','salary','hours');";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
}
else if($update)
{
require( 'connect_jobs1.php' );
$sql = "UPDATE allvacs SET ID='',company='$company',job='$job',location='$location',salary='$salary',hours='$hours',
salary='$salary' WHERE ID=$ID";
$result = mysql_query($sql);
echo "Thank you! Information updated.\n";
}
else if($ID)
{
require( 'connect_jobs1.php' );
$result = mysql_query("SELECT * FROM allvacs WHERE ID=$ID",$db);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="addedit.php">
<input type="hidden" name="id" value="<?php echo $myrow["id"]?>">
**ERROR ON THIS LINE Parse error: parse error, unexpected ':', expecting ',' or ';' in /extra0/ on line 47**
company:<input type="Text" name="company" value="<?php echo
job:<input type="Text" name="job" value="<?php echo $myrow["job"]?>"><br>
location:<input type="Text" name="location" value="<?php echo $myrow["location"]?>"><br>
salary:<input type="Text" name="salary" value="<?php echo $myrow["salary"]?>"><br>
hours:<input type="Text" name="hours" value="<?php echo $myrow["hours"]?>"><br>
<input type="Submit" name="update" value="Update information"></form>
<?
}
else
{
?>
<form method="post" action="addedit.php">
company:<input type="Text" name="company"><br>
job:<input type="Text" name="job"><br>
location:<input type="Text" name="location"><br>
salary:<input type="Text" name="salary"><br>
hours:<input type="Text" name="hours"><br>
<input type="Submit" name="submit" value="Enter information"></form>
<?
}
?>
</html>
I'm building a php page to add/edit records in a mySQL db.
I'm having a problem with the following code.
I have written in capital letters on the line above where the error occurs and the error message returned by the browser.
The mySQL db is a single table with ID auto increment(primary key).
I would appreciate any ideas.
Thanks.
<html>
<head>
<title>Outline Vacancies input test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFCC" text="#000000">
<?php
if($submit)
{
require( 'connect_jobs1.php' );
$sql = "INSERT INTO allvacs (ID, company, job, location, salary, hours) VALUES ('','$company','$job','$location','salary','hours');";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
}
else if($update)
{
require( 'connect_jobs1.php' );
$sql = "UPDATE allvacs SET ID='',company='$company',job='$job',location='$location',salary='$salary',hours='$hours',
salary='$salary' WHERE ID=$ID";
$result = mysql_query($sql);
echo "Thank you! Information updated.\n";
}
else if($ID)
{
require( 'connect_jobs1.php' );
$result = mysql_query("SELECT * FROM allvacs WHERE ID=$ID",$db);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="addedit.php">
<input type="hidden" name="id" value="<?php echo $myrow["id"]?>">
**ERROR ON THIS LINE Parse error: parse error, unexpected ':', expecting ',' or ';' in /extra0/ on line 47**
company:<input type="Text" name="company" value="<?php echo
job:<input type="Text" name="job" value="<?php echo $myrow["job"]?>"><br>
location:<input type="Text" name="location" value="<?php echo $myrow["location"]?>"><br>
salary:<input type="Text" name="salary" value="<?php echo $myrow["salary"]?>"><br>
hours:<input type="Text" name="hours" value="<?php echo $myrow["hours"]?>"><br>
<input type="Submit" name="update" value="Update information"></form>
<?
}
else
{
?>
<form method="post" action="addedit.php">
company:<input type="Text" name="company"><br>
job:<input type="Text" name="job"><br>
location:<input type="Text" name="location"><br>
salary:<input type="Text" name="salary"><br>
hours:<input type="Text" name="hours"><br>
<input type="Submit" name="submit" value="Enter information"></form>
<?
}
?>
</html>