Wrox Programmer Forums
|
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 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 25th, 2010, 02:44 PM
Authorized User
 
Join Date: Aug 2010
Posts: 50
Thanks: 7
Thanked 0 Times in 0 Posts
Default Chapter 4 pg 114 (Improving your Table)

Hi,

I keep getting this error when working Chapter 4 example. Any help would be appreciated.

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 6

PHP Code:
<?php

//take in the id of a director and return his/her full name
function get_director($director_id) {
  global 
$db;

    
$query 'SELECT
            people_fullname
       FROM
           people
       WHERE
           people_id = ' 
$director_id;
    
$results mysql_query($query) or die(mysql_error());

    
$row mysql_fetch_assoc($results);
    
extract($row);

    return 
$people_fullname;
}
 
Old September 5th, 2010, 03:25 PM
Registered User
 
Join Date: Sep 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you may have forgotten the $db in the brackets for:
Code:
$results = mysql_query($query) or die(mysql_error());
should be:
Code:
$results = mysql_query($query,$db) or die(mysql_error($db));
...hope it works





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4 pg 127 yorlik BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 August 11th, 2010 10:44 AM
P112 bottom of pg - $table?? ababb BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 January 7th, 2005 03:18 PM
Chapter 4 pg. 114-115 mjc2928 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 August 25th, 2004 07:09 AM
Chapter 4 pg 131 cpkaiser BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 May 2nd, 2004 01:50 PM





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