Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
  #11 (permalink)  
Old October 6th, 2010, 06:05 PM
Authorized User
Points: 152, Level: 3
Points: 152, Level: 3 Points: 152, Level: 3 Points: 152, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Location: Bra - Italy
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!
Reply With Quote
  #12 (permalink)  
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.
Reply With Quote
  #13 (permalink)  
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!
Reply With Quote
  #14 (permalink)  
Old October 7th, 2010, 03:33 AM
Authorized User
Points: 152, Level: 3
Points: 152, Level: 3 Points: 152, Level: 3 Points: 152, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2010
Location: Bra - Italy
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
Default

Good! Well done, bye!
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
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



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


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