473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

GD org chart -- image display problem... One function works, the other does not...

I have created a small program that prints out an organization chart in
PHP using the GD lib's imagecreate, imageline and imagestring
functions. Basically, a user selects an employee from a drop-down list
to generate an on-the-fly graphical organization tree. A function is
called to set the selected employee's data into an imagestring and draw
imagelines around it. Next a recursive function is called to query for
and display all direct reports in a hierarchal tree style format.

The code was working just fine until I separated the logic into two
separate functions. The problem is that now that I have set up the
code to be a recursive function, the image no longer will display.
When the recursive part of the code (below) is commented out, the first
function works fine. Both functions call a third function
"makeOrgBox()" to get the x,y positions of all imagestrings and
imagelines for the passed employee so the third function takes the
exact same args.

Anybody know of any issues when looping over results to build
imagestrings and imagelines? What about problems using the same image
handler in multiple functions? I am completely stumped since both
functions work independently, but the recursive function will not
produce the imagestrings or the imagelines and all I get is the dreaded
x in the box to indicate a missing image. Thanks in advance for your
help.

Problem Code Snippet...
------------------------------------
function displaySubordinates($id,$orgbox) {
$sqlquery = "SELECT ID,name,title,dept,level FROM employees WHERE
supervisor = '$id'";

$result = mysql_query($sqlquery);
$total_rec = mysql_num_rows($result);
$i = 0;
if ($total_rec > 0)
{
// process the results
for($i=0; $i < $total_rec; $i++){
$id = mysql_result($result,$i,"id");
$name = mysql_result($result,$i,"name");
$title = mysql_result($result,$i,"title");
$dept = mysql_result($result,$i,"dept");
$level = mysql_result($result,$i,"level");
makeOrgBox($name,$title,$dept,$level,$orgbox);
}
displaySubordinates($id,$orgbox);
}
return($orgbox);
}

function makeOrgBox($name,$title,$dept,$level,$orgbox){
// $orgbox is the image handle
....

Jun 23 '06 #1
0 1914

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: zborisau | last post by:
Hey good people, I've been given a problem to solve recently - and stuck with the solution for a good 4 days already. i have a link which leads to popup window. the purpose of that popup...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
8
by: LB | last post by:
Hello everybody I'm learning how to create pie chart using OWC. I'm able now to create a pie. But I can not figure out how to do the following : - for each pie, when mousing over, I would like...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
1
by: monomaniac21 | last post by:
Hi im trying to get a chart to display using php. I get an error at the moment when i use the function (or any requiring an uploaded font to be used): imagettftext($image, 6, 0, 0,...
3
by: =?Utf-8?B?SlIx?= | last post by:
I would like to add text to an image. I have tried to use DrawString and it works on some images but on others it is very very small. I am pretty sure it has something to do with the size of the...
0
by: Wayne | last post by:
I am charting data from a query that consists of a Date/Time field and a Number field. The Date/Time field is the x scale on my chart. Sometimes data is collected from different times during the...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
9
by: Mel | last post by:
I have some Asp.net 2.0/vb.net code that creates a gantt chart with some dependencies as a new MS Project (.mpp) file. How would I show this resulting .mpp file on an Asp.net webpage? I want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.