 |
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
|
|
|
|

August 23rd, 2004, 06:19 PM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Chacpter 11 MOD
Hello, I modified the code add content to my own DB but I get an error that says "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4"
Here is how I modified it. I did not change anything in Line 4
<?php
session_start();
include "auth_user.inc.php";
include "conn.inc.php";
?>
<html>
<head>
<title>Update Account</title>
</head>
<body>
<h1>Update Account Information</h1>
Here you can update your account information for viewing in your profile.<br><br>
<?php
if ($_POST['submit'] == "Update")
{
$query_update = "UPDATE user_info SET email = '" . $_POST['email'] . "', City
= '" . $_POST['City'] . "', State = '" . $_POST['State'] . "', Zip =
'" . $_POST['Zip'] . "'
WHERE username = '" .
$_SESSION['user_logged']. "' AND password = (password('" .
$_SESSION['user_password'] . "';";
$result_update = mysql_query($query_update) or die(mysql_error());
$query = "SELECT * FROM user_info WHERE username = '" .
$_SESSION['user_logged']. "' AND password = (password('" .
$_SESSION['user_password'] . "'));";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$hobbies = explode(", ", $row['hobbies'])
?>
|
|

August 24th, 2004, 10:47 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think the error is refering to a line on the include files, could you please post them as well?
Thanks
Christian
|
|

August 24th, 2004, 10:54 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
conn.inc.php =
<?php
$conn = mysql_connect("localhost", "lires_qee", "Nestip") or die(mysql_error());
$db = mysql_select_db("lires_clientetd") or die(mysql_error());
?>
auth_user.inc.php =
<?
session_start();
if ($_SESSION['user_logged'] == "" || $_SESSION['user_password'] == "")
{
$redirect = $_SERVER['PHP_SELF'];
header("Refresh: 5; URL=user_login.php?redirect=$redirect");
echo "You are currently not logged in, we are redirecting you, be
patient!<br>";
echo "(If your browser doesn't support this, <a
href=\"user_login.php?redirect=$redirect\">click here</a>)";
die();
}
else {}
?>
---------------------------------------------------------------------
I dont think its them, becuase they were writen word for word but thanks for the help
|
|

August 24th, 2004, 02:05 PM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by 2old2play
$_SESSION['user_password'] . "';";
|
This line should read:
$_SESSION['user_password'] . "'));";
There's an error in the book.
I just ran into this myself this morning and fixed it.
|
|

August 24th, 2004, 02:09 PM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
THANKS SO MUCH!!!!
I can't believe I didn't see that! You rock!
|
|
 |