Wrox Programmer Forums
|
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
 
Old August 23rd, 2004, 06:19 PM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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'])
?>

 
Old August 24th, 2004, 10:47 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think the error is refering to a line on the include files, could you please post them as well?

Thanks
Christian

 
Old August 24th, 2004, 10:54 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old August 24th, 2004, 02:05 PM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old August 24th, 2004, 02:09 PM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

THANKS SO MUCH!!!!

I can't believe I didn't see that! You rock!






Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 11 figure 11-7 relative positioning pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 November 29th, 2007 06:11 AM
ONline Diary Mod Question Mel64081 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 February 8th, 2007 05:18 PM
MOD function in calculator gilgalbiblewheel Java GUI 4 September 24th, 2004 09:25 AM
Mod 10 for application polj74 VB.NET 2002/2003 Basics 0 July 21st, 2004 07:11 PM
Problem with Mod operator LordBeholder VB How-To 2 June 16th, 2004 06:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.