Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 23rd, 2004, 06:19 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
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'])
?>

Reply With Quote
  #2 (permalink)  
Old August 24th, 2004, 10:47 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
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

Reply With Quote
  #3 (permalink)  
Old August 24th, 2004, 10:54 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
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

Reply With Quote
  #4 (permalink)  
Old August 24th, 2004, 02:05 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
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.
Reply With Quote
  #5 (permalink)  
Old August 24th, 2004, 02:09 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
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!

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.