Subject: Problem with graf. CHPT16 page 575(Polish ver).
Posted By: RABARBAR Post Date: 2/16/2004 7:03:47 AM
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,65',
            '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','425,440',
            'pieniądze,bank,bankowość,czeki,depozyty,bankomat,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,chipsy,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,435',
            '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,adidasy,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);
?>

Reply By: RABARBAR Reply Date: 2/16/2004 7:11:53 AM
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).

Reply By: RABARBAR Reply Date: 2/16/2004 8:00:47 AM
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.



Go to topic 9831

Return to index page 948
Return to index page 947
Return to index page 946
Return to index page 945
Return to index page 944
Return to index page 943
Return to index page 942
Return to index page 941
Return to index page 940
Return to index page 939