 |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6  | This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 13th, 2008, 06:03 AM
|
|
Registered User
|
|
Join Date: Jan 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
PHP:wrox chap7 page197
PHP Parse error: syntax error, unexpected T_STRING in C:\Program Files\Apache S
oftware Foundation\Apache2.2\htdocs\commit.php on line 31
iam getting the above mentioned error in the following code:
-----------------------------------------
<?php
//COMIT ADD AND EDITS
$error ='';
$link=mysql_connect("localhost","root","welcome")
or die("could not connect :" . mysql_error());
mysql_select_db('db',$link) or die (mysql_error());
if (isset($sql ) && !empty($sql))
{
echo "<!-".$sql."->";
$result=mysql_query($sql)
or die("Invalid query:" .mysql_error());
switch ($_GET['type'] )
{
case "edit":
switch( $_GET['type'] )
{
case "people";
$sql = "UPDATE people
SET
people_fullname = '$_POST[$people_fullname]'
WHERE
people_id = '$_GET[$id]'
break;
case "movie":
$movie_name = trim($row['movie_name']);---------line31
if(empty($movie_name))
{
$error .="please+enter+a+movie+name%21%0D%0A";
}
if (empty($_POST['movie_type']))
{
$error .="please+select+a+movie+type%21%0D%0A";
}
if( empty($error))
{
$sql="UPDATE 'movie'
SET
movie_name= '".$_POST['movie_name']."',
movie_year= '".$_POST['movie_year']."',
movie_type='".$_POST['movie_type']."',
movie_leadactor='".$_POST['movie_leadactor']."',
movie_director='".$_POST['movie_director']."'
WHERE
movie_id='".$GET['id']."' ";
}
else
{
header(
"location:movie.php?action=edit&error=".$error."&i d=".$_GET['id'] );
}
break;
}
break;
case "add":
switch($_GET[])
{
case "people":
$sql = "INSERT INTO people
('people_fullname')
VALUES
('".$_POST['people_fullname']."') ";
break;
case "movie" :
$movie_name = trim($row['movie_name']);
if(empty($movie_name))
{
$error .= "please+enter+a+movie%21%0D%0A";
}
if(empty($_POST['movie_type']))
{
$error .= "please+select+a+movie+type%21%0D%0A";
}
if (empty($_POST['movie_year']))
{
$error .= "please+select+a+movie+type%21%0d%0A";
}
if (empty($error) )
{
$sql= "INSERT INTO 'movie'
('movie_name',
'movie_year',
'movie_type',
'movie_leadactor',
'movie_director')
VALUES
( '".$_POST['movie_name']."',
'".$_POST['movie_year']."' ,
'".$_POST['movie_type']."',
'".$_POST['movie_leadactor']."' ,
'".$_POST['movie_director']."') ";
}
else
{
header("location:movie.php?action=add&error=" .$error);
}
break;
}
break;
}
}
?>
<?php
<p align="center" style="color:#ff0000">
Done. <a href="index.php">Index</a>
</p>
?>
|
|

January 23rd, 2008, 03:13 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
$sql = "UPDATE people
SET
people_fullname = '$_POST[$people_fullname]'
WHERE
people_id = '$_GET[$id]'
Try to write string variable in one line. you might have pressed enter key in between. so try following.
$sql = "UPDATE people SET people_fullname = '$_POST[$people_fullname]' WHERE people_id = '$_GET[$id]'";
or
$sql = "UPDATE people";
$sql .=" SET";
$sql .=" people_fullname = '$_POST[$people_fullname]'";
$sql .=" WHERE";
$sql .=" people_id = '$_GET[$id]'";
urt
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| PHP 5, Wrox, CH 7 navigator.php |
Jon_ |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
1 |
August 24th, 2008 01:13 PM |
| wrox php error |
mool |
Pro PHP |
0 |
February 22nd, 2007 02:39 AM |
| Thanks to some outstanding p2p.wrox.com Wrox.com |
jminatel |
Forum and Wrox.com Feedback |
0 |
February 23rd, 2006 11:30 PM |
| Error: movie.php & commit.php on p182-186, ch6 |
willburke |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 |
0 |
October 12th, 2004 02:48 PM |
| Wrox and Wrox.com FAQs (updated March 2, 2004) |
jminatel |
General Announcements |
0 |
June 6th, 2003 09:23 AM |
|
 |