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 October 6th, 2010, 06:05 PM
Authorized User
 
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
Default

PHP Code:
FROM 
           comic_character c
comic_lair lcomic_zipcode AS 
There is only one AS at line 9!! Try without that!
 
Old October 6th, 2010, 06:16 PM
Authorized User
 
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Ok, I got rid of the AS and tried to run this code:

Code:
<?php
require 'includes/db.inc.php'; 
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect');
mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db));

$character_id = 2;

         $query = 'SELECT 
       c.alias, c.real_name, c.alignment, 
       l.address, z.city, z.state, z.zipcode_id 
       FROM 
           comic_character c, comic_lair l, comic_zipcode z 
       WHERE 
           z.zipcode_id = l.zipcode_id AND 
           c.lair_id = l.lair_id AND 
           c.character_id = '. $character_id;

$result = mysql_query($query, $db) or die(mysql_error($db));

if (mysql_num_rows($result) > 0) {
	$action = 'Edit';
	$character = mysql_fetch_assoc($result);
	echo $character['alias'];
}
?>
I dont' get the MySQL error message anymore, but I get a totally blank white screen.
 
Old October 6th, 2010, 08:59 PM
Authorized User
 
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Oh never mind, I finally figured it out! The MySQL code is correct. I left out a line in the char_transactions.php file that inserted info into the comic_zipcode table. That was screwing up the query. It works fine now. Thank for your kind efforts of helping!
 
Old October 7th, 2010, 03:33 AM
Authorized User
 
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
Default

Good! Well done, bye!





Similar Threads
Thread Thread Starter Forum Replies Last Post
About a SELECT command to execute in my MysQL Database Carcinosi MySQL 1 November 29th, 2009 02:18 AM
Booking System Chp 10, ObjectDataSource, and DataSets dev101 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 March 9th, 2009 12:41 PM
Vusial Basic 6, Mysql and Crystal Report 10 Samuel Banda Access VBA 1 December 20th, 2006 08:31 AM
show just the column names from a MySQL command crmpicco MySQL 5 December 7th, 2006 08:34 AM
TEST THE MYSQL IN THE COMMAND PROMPT jhan316 SQL Server 2005 0 June 25th, 2006 09:16 AM





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