Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 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 February 16th, 2004, 08:03 AM
Authorized User
 
Join Date: Dec 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with graf. CHPT16 page 575(Polish ver).

i doing everything like book.
BUT drawmall.php dosen't work(the same is with mall.php).
now i'm stop :(( i don't know what to do?
Maybe something is wrong with my php.ini?
Here are both file:

Map_data.sql:

use mapping;
CREATE TABLE mall (
 m_id int(11) DEFAULT '0' NOT NULL AUTO_INCREMENT,
 m_floor char(1) NOT NULL,
 m_shop varchar(64) NOT NULL,
 m_name varchar(64) NOT NULL,
 m_phone varchar(64),
 m_area varchar(128) NOT NULL,
 m_center varchar(64) NOT NULL,
 m_desc varchar(128),
 PRIMARY KEY (m_id)
);

INSERT INTO mall VALUES (1,'G','G1','Fast Snak',
            '555-7089','150,0,150,100,200,100,200,0','175,50',
            'jedzenie,s³odycze,napoje,drinki,chipsy,cola,sa³ atki,frytki');
INSERT INTO mall VALUES (2,'G','G2','Kolporter',
            '555-6843','300,0,300,100,350,100,350,0','325,50',
            'gazety,magazyny,periodyki,materia³y piœmiennicze,kolportarz,prasa');
INSERT INTO mall VALUES (3,'G','G3','Dom mody',
            '555-7521','350,0,350,100,400,150,500,150,500,0','425,6 5',
            'ubrania,bielizna,buty,suknie,garnitury,p³aszcze' );
INSERT INTO mall VALUES (4,'G','G4','Hip-Hop',
            '555-0459','400,150,400,250,500,250,500,150','450,200',
            'cd,dvd,muzyka,kasety,wideo,rock,pop,hiphop');
INSERT INTO mall VALUES (5,'G','G5','Zielony Zak¹tek',
            '555-9561','400,250,400,350,500,350,500,250','450,300',
            'ogrodnictwo,kwiaty,florystyka,aran¿acja,roœliny ');
INSERT INTO mall VALUES (6,'G','G6','Bank Narodowy',
            '555-3675','400,350,350,400,350,500,500,500,500,350','4 25,440',
            'pieni¹dze,bank,bankowoϾ,czeki,depozyty,bankom at,gotówka');
INSERT INTO mall VALUES (7,'G','G7','Cukiereczek',
            '555-7659','300,400,300,500,350,500,350,400','325,450',
            's³odycze,cukierki,ciastka,cola,napoje,drinki,chi psy,chrupki');
INSERT INTO mall VALUES (8,'G','G8','Klasyka',
            '555-4395','150,400,150,500,200,500,200,400','175,450',
            'cd,dvd,muzyka,jazz,muzyka klasyczna');
INSERT INTO mall VALUES (9,'G','G9','Matrix',
            '555-7001','100,350,150,400,150,500,0,500,0,350','65,43 5',
            'pc,komputery,akcesoria,oprogramowanie,sprzêt,ksi ¹¿ki,cd');
INSERT INTO mall VALUES (10,'G','G10','Bibliofil',
            '555-3752','100,250,100,350,0,350,0,250','50,300',
            'ksi¹¿ki,magazyny,periodyki,czytanie,lektura');
INSERT INTO mall VALUES (11,'G','G11','Wielka Stopa',
            '555-2564','0,150,100,150,100,250,0,250','50,200',
            'buty,obuwie,sanda³y,************************y,stopy');
INSERT INTO mall VALUES (12,'G','G12','Aktywny wypoczynek',
            '555-7269','0,0,0,150,100,150,150,100,150,0','65,70',
            'turystyka,kamping,rafting');


<?php
//drawmall.php
include "./common_db.inc";

Header("Content-type: image/png");
$image = ImageCreate(501,501);
$white = ImageColorAllocate($image,255,255,255);
$black = ImageColorAllocate($image,0,0,0);

$link_id = db_connect('mapping');

$query = "SELECT m_area FROM mall";
$mallResult = mysql_query($query,$link_id);

while ($mallRow = mysql_fetch_array($mallResult)) {
   $area = explode(",", $mallRow[0]);
   for ($i=0; $i < count($area)-2; $i=$i+2) {
      ImageLine($image,$area[$i],$area[$i+1],$area[$i+2],$area[$i+3],$black);
   }
   ImageLine($image,$area[count($area)-2],
                    $area[count($area)-1], $area[0], $area[1], $black);
}

for ($i=0; $i<count($area)-2; $i=$i+2) {
   ImageLine($image,$area[$i], $area[$i+1], $area[$i+2], $area[$i+3], $black);
}
ImageLine($image, $area[count($area)-2],
                  $area[count($area)-1], $area[0], $area[1], $black);
   ImagePNG($image);
   ImageDestroy($image);
   mysql_free_result($mallResult);
?>

 
Old February 16th, 2004, 08:11 AM
Authorized User
 
Join Date: Dec 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i just want add to my pronouncement:
this script almost work but i dont see the pictures.I see only icon(standard icon when IE can't show pictures).

 
Old February 16th, 2004, 09:00 AM
Authorized User
 
Join Date: Dec 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found the problem.
That was wrong function in common_db.inc files.
Name this function: db_connect().
I don't know why, but this function in CHPT 16 is with parametr: function db_connect($dbname='') {...}
Old function was:
function db_connect(){..}
Now this scripts working.







Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP ADO Query not showing Polish Letters karoljoc Classic ASP Professional 0 September 12th, 2006 07:07 AM
page 40 not in pdf ver ??? AmR EiSa BOOK: Ivor Horton's Beginning Visual C++ 2005 1 June 27th, 2006 09:26 PM
Want to get Polish characters from mySQL db zarol Beginning PHP 2 April 13th, 2005 09:20 AM
ver of crystal report in vs2003? drachx Crystal Reports 0 October 26th, 2004 10:19 PM
CHPT16 mall.php page579 RABARBAR BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 February 16th, 2004 03:43 PM





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