[PHP-DB] xml, PHP, MYSQL

2005-04-05 Thread J. Connolly
I think i was dropped from the mailing list. So this message is twofold.
My second part is...
Is there a performance difference in returning a MySQL query in XML 
format? Is it a matter of preference whether the conversion takes place 
in php or mysql? I didn't even know mysql was capable of this until two 
days ago and I am having a difficult time putting the pieces together. I 
have already looked at the SimpleXML in php.net and the parsing 
functions as well.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Object relational mapping in PHP

2005-04-05 Thread Hendy Irawan
Hi all...

Would anyone be kind enough to provide me some pointers about object
relationship mapping [libraries] in PHP?

All I know is there are some DB APIs available: PEAR DB, MDB, ADOdb,
Creole... I currently use MDB for its excellent DB schema management
capabilities. And I use ORM manually, this provides the most
flexbility but from time to time it gets rather annoying, so I'm now
seeking alternatives (if possible, still using MDB, but a switch to
other API is okay though...)

Each API seem to have its own relational-to-OO mapping in form of data
objects... like PEAR DB DataObject, which I would say is an almost-ORM
implementation. Creole's Propel seems to be a bit more advanced than
the others.
What I wanted is more like Java's Hibernate. So it's not just a
wrapper for get() but it actually creates proper OO classes in PHP
based on some meta-information. I don't mind code generation if its
flexible enough and it's directly usable for all circumstances without
handly modifying them (since they'll get regenerated from time to
time).

I also found phpSorm and phpersistence, though these projects seem to
be not maintained now.

Any insight would be greatly appreciated... :-)
-- 
Hendy Irawan - http://dev.gauldong.net - GaulDong Developer Center

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] How to Disable Daylight Savings Time on RedHat 9.0

2005-04-05 Thread dpgirago
We have created a MySQL/ C application that gathers environmental data and 
does inserts into the db once per minute. 
A set of PHP applications reads this data and does some graphical display 
of the values. 
Changing from Standard Time to Daylight Savings Time causes minor 
problems, but in the Fall, DST to ST will screw things up royally.

I did some googling yesterday, and others have asked how to disable the 
automatic DST changeover in Red Hat 9.0, but no one really got an answer, 
leading me to believe that it is not straight forward. Does anyone know 
how to do this?? 

Thanks very much,

David

[PHP-DB] number on the quene, or how to get rank?

2005-04-05 Thread emre
hi everyone, 

I' ve a table named as 'highscores', inserting result scores of a game and 
players name(each player can only play once)  what I want to do is to get the 
current rank of a player over a listing of all rows ordered by scores desc. 


id -name - score 
1 - userA - 8
2 - userB - 3
3 - userC - 10
4 - userD - 2
5 - userE - 7


here is how I figured out this thing:
 

$sql=mysql_query(SELECT userD  FROM highscores ORDER BY score DESC);
$i=1;
while($scorelist=mysql_fetch_array($sql))
{
if($scorelist[name]=='userD')
   echo your rank is:  $i ;
$i++;
}


how can I get a specific row's  formatted no  through all affected rows? Is 
there a MySQL command doing this job that i am unaware of? 

thx  in adv. 




[PHP-DB] Exporting pictures to Excel

2005-04-05 Thread Perry, Matthew (Fire Marshal's Office)
I am having some difficulties exporting images to excel.

 

I am using the following header:

?PHP

header (Content-type: application/vnd.ms-excel);

header (Content-Disposition: attachment );

?

 

Then I just create a table with my data.  This works beautifully and
generates the file correctly with one exception.

When I include the following HTML in one of the columns:

trtdimg src=images/specificitems/whatever.jpg  width = 73 height =
73/td/tr

It only saves the PATH to the image and not the image itself.  When I am
inside the correct directory the image displays.  As soon as I move it
outside this directory it does not display.

 

This makes sense because that is how HTML works.  But what I want to do is
have PHP export the image to excel and insert this image into the file I am
attempting to generate.

Is there a means to insert the actual image into the generated file instead
of the path?

 

Thank you for your time,

Matthew Perry

 



Re: [PHP-DB] number on the quene, or how to get rank?

2005-04-05 Thread Philip Hallstrom
You could try something like this perhaps...
SELECT score FROM highscores WHERE name = 'userD'
then use the result of that to do this:
SELECT COUNT(*) FROM highscores WHERE score  2
rank would then be the result of the above query plus one.
-philip
On Tue, 5 Apr 2005 [EMAIL PROTECTED] wrote:
hi everyone,
I' ve a table named as 'highscores', inserting result scores of a game and players 
name(each player can only play once)  what I want to do is to get the current 
rank of a player over a listing of all rows ordered by scores desc.
id -name - score
1 - userA - 8
2 - userB - 3
3 - userC - 10
4 - userD - 2
5 - userE - 7
here is how I figured out this thing:
$sql=mysql_query(SELECT userD  FROM highscores ORDER BY score DESC);
$i=1;
while($scorelist=mysql_fetch_array($sql))
{
   if($scorelist[name]=='userD')
  echo your rank is:  $i ;
$i++;
}
how can I get a specific row's  formatted no  through all affected rows? 
Is there a MySQL command doing this job that i am unaware of?
thx  in adv.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] GD Question

2005-04-05 Thread Craig Hoffman
Hello Everyone,
I wrote a GD function that resizes some images and displays them as 
thumbnails. When I put the function in the index.php page I receive an 
error Warning: Headers have already been sent... then it shows a bunch 
of binary.  I do not want re-save the file, I just want resize and show 
it.  What am I doing wrong here?  Any help would be great.
- Craig

//query the DB for image name
	Some query...
//Photo varibale
	$route_photo = $row[route_photo];

//Start GD
//New Image resize
	$new_width = 125;
	$new_height = 225;
	
//Content Type
	header(Content-type: image/jpeg);
	
//Start new image resize	
	list($width_orig, $height_orig) = 
getImageSize(./images/climbs/$route_photo);
	
	if ($new_width  ($width_orig  $height_orig)) {
			$new_width = ($new_height / $height_orig) * $width_orig;
		} else {
			$new_height = ($new_width / $width_orig) * $height_orig;
			}

//resample the image
	$thumb = ImageCreateTrueColor($new_width, $new_height);
	$tmp_image = ImageCreateFromJPEG(./images/climbs/$route_photo);
	ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width, 
$new_height, $width_orig, $height_orig);
	
	ImageJPEG($thumb,'','100');
	ImageDestroy($thumb);

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] GD Question

2005-04-05 Thread Philip Hallstrom
Probably nothing really.  When it complains about headers already being 
sent is the line number the same as your header() line below?  If so, that 
means you're outputting something back to the browser prior to that line.

I'd make sure you don't have any white space before your initial opening 
?php tag and I'd also look at Some query to see if it's spitting out an 
error or some sort...

-philip
On Tue, 5 Apr 2005, Craig Hoffman wrote:
Hello Everyone,
I wrote a GD function that resizes some images and displays them as 
thumbnails. When I put the function in the index.php page I receive an error 
Warning: Headers have already been sent... then it shows a bunch of binary. 
I do not want re-save the file, I just want resize and show it.  What am I 
doing wrong here?  Any help would be great.
- Craig

//query the DB for image name
	Some query...
//Photo varibale
	$route_photo = $row[route_photo];
//Start GD
//New Image resize
	$new_width = 125;
	$new_height = 225;
	//Content 
Type
	header(Content-type: image/jpeg);
	//Start 
new image resize 
list($width_orig, $height_orig) = 
getImageSize(./images/climbs/$route_photo);
		if 
($new_width  ($width_orig  $height_orig)) {
			$new_width = 
($new_height / $height_orig) * $width_orig;
		} else {
			$new_height = 
($new_width / $width_orig) * $height_orig;
			}
//resample 
the image
	$thumb = 
ImageCreateTrueColor($new_width, $new_height);
	$tmp_image = 
ImageCreateFromJPEG(./images/climbs/$route_photo);
	ImageCopyResampled($thumb, 
$tmp_image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);
		ImageJPEG($thumb,'','100');
	ImageDestroy($thumb);

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] GD Question

2005-04-05 Thread Craig Hoffman
The script works fine when I test it on a stand alone page. I'm just 
not sure how to include with the rest of the site.

On Apr 5, 2005, at 1:17 PM, Philip Hallstrom wrote:
Probably nothing really.  When it complains about headers already 
being sent is the line number the same as your header() line below?  
If so, that means you're outputting something back to the browser 
prior to that line.

I'd make sure you don't have any white space before your initial 
opening ?php tag and I'd also look at Some query to see if it's 
spitting out an error or some sort...

-philip
On Tue, 5 Apr 2005, Craig Hoffman wrote:
Hello Everyone,
I wrote a GD function that resizes some images and displays them as 
thumbnails. When I put the function in the index.php page I receive 
an error Warning: Headers have already been sent... then it shows a 
bunch of binary. I do not want re-save the file, I just want resize 
and show it.  What am I doing wrong here?  Any help would be great.
- Craig

//query the DB for image name
	Some query...
//Photo varibale
	$route_photo = $row[route_photo];
//Start GD
//New Image resize
	$new_width = 125;
	$new_height = 225;
	//Content Type
	header(Content-type: image/jpeg);
	//Start new image resize list($width_orig, $height_orig) = 
getImageSize(./images/climbs/$route_photo);
		if ($new_width  ($width_orig  $height_orig)) {
			$new_width = ($new_height / $height_orig) * $width_orig;
		} else {
			$new_height = ($new_width / $width_orig) * $height_orig;
			}
//resample the image
	$thumb = ImageCreateTrueColor($new_width, $new_height);
	$tmp_image = ImageCreateFromJPEG(./images/climbs/$route_photo);
	ImageCopyResampled($thumb, $tmp_image, 0, 0, 0, 0, $new_width, 
$new_height, $width_orig, $height_orig);
		ImageJPEG($thumb,'','100');
	ImageDestroy($thumb);

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] GD Question

2005-04-05 Thread Simon Rees
On Tuesday 05 April 2005 19:19, Craig Hoffman wrote:
 The script works fine when I test it on a stand alone page. I'm just
 not sure how to include with the rest of the site.

You can't do it all from the same script (AFAIK). This is because of the way 
http/browsers work - each image is requested as a separate file. Put your 
image code in a separate script and request it in the src attribute of your 
html image tags. e.g.

img src=display_image.php

Simon

-- 
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] GD Question

2005-04-05 Thread Craig Hoffman
Thanks - it works perfectly!
On Apr 5, 2005, at 1:33 PM, Simon Rees wrote:
On Tuesday 05 April 2005 19:19, Craig Hoffman wrote:
The script works fine when I test it on a stand alone page. I'm just
not sure how to include with the rest of the site.
You can't do it all from the same script (AFAIK). This is because of 
the way
http/browsers work - each image is requested as a separate file. Put 
your
image code in a separate script and request it in the src attribute of 
your
html image tags. e.g.

img src=display_image.php
Simon
--
~~
Simon Rees  | [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel
~~
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] GD Question

2005-04-05 Thread Craig Hoffman
Hi Wendell,
If its not too much trouble, I have one more question.  How can I get 
GD to give me the correct image name and pass a variable to another 
page.  So the image corresponds with the correct title in the DB.  Does 
that make sense?

Thanks again.
Craig
On Apr 5, 2005, at 1:41 PM, Wendell Frohwein wrote:
So, your index.php page is the one with the image in it. How are you
calling the image? When I do something similar, In my index.php page I
would of course have the html code:
img src=doimage.php height=20 width=100 border=0
My doimage.php is the actual code to retrieve / create the thumbnail 
for
you. If you were trying to have the code that creates the thumbnail in
your index.php, this explains why you were getting binary information 
in
your code.

I hope that helps.
PS
You might want to try creating thumbnails when you initially upload 
your
image. This saves on cpu power.
Yes I know.  Thanks.
-Wendell
-Original Message-
From: Craig Hoffman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 05, 2005 11:04 AM
To: php-db@lists.php.net
Subject: [PHP-DB] GD Question
Hello Everyone,
I wrote a GD function that resizes some images and displays them as
thumbnails. When I put the function in the index.php page I receive an
error Warning: Headers have already been sent... then it shows a bunch
of binary.  I do not want re-save the file, I just want resize and show
it.  What am I doing wrong here?  Any help would be great.
- Craig
//query the DB for image name
Some query...
//Photo varibale
$route_photo =
$row[route_photo];

//Start GD
//New Image resize
$new_width = 125;
$new_height = 225;

//Content Type
header(Content-type:
image/jpeg);

//Start new image resize
list($width_orig, $height_orig)
=
getImageSize(./images/climbs/$route_photo);

if ($new_width  ($width_orig 
$height_orig)) {
$new_width =
($new_height / $height_orig) * $width_orig;
} else {
$new_height =
($new_width / $width_orig) * $height_orig;
}

//resample the image
$thumb =
ImageCreateTrueColor($new_width, $new_height);
$tmp_image =
ImageCreateFromJPEG(./images/climbs/$route_photo);
ImageCopyResampled($thumb,
$tmp_image, 0, 0, 0, 0, $new_width,
$new_height, $width_orig, $height_orig);

ImageJPEG($thumb,'','100');
ImageDestroy($thumb);
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] GD Question

2005-04-05 Thread Bastien Koert
img src=doimage.php?id=$some_id
Bastien
From: Craig Hoffman [EMAIL PROTECTED]
To: Wendell Frohwein [EMAIL PROTECTED]
CC: php-db@lists.php.net
Subject: Re: [PHP-DB] GD Question
Date: Tue, 5 Apr 2005 14:10:50 -0500
Hi Wendell,
If its not too much trouble, I have one more question.  How can I get GD to 
give me the correct image name and pass a variable to another page.  So the 
image corresponds with the correct title in the DB.  Does that make sense?

Thanks again.
Craig
On Apr 5, 2005, at 1:41 PM, Wendell Frohwein wrote:
So, your index.php page is the one with the image in it. How are you
calling the image? When I do something similar, In my index.php page I
would of course have the html code:
img src=doimage.php height=20 width=100 border=0
My doimage.php is the actual code to retrieve / create the thumbnail for
you. If you were trying to have the code that creates the thumbnail in
your index.php, this explains why you were getting binary information in
your code.
I hope that helps.
PS
You might want to try creating thumbnails when you initially upload your
image. This saves on cpu power.
Yes I know.  Thanks.
-Wendell
-Original Message-
From: Craig Hoffman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 05, 2005 11:04 AM
To: php-db@lists.php.net
Subject: [PHP-DB] GD Question
Hello Everyone,
I wrote a GD function that resizes some images and displays them as
thumbnails. When I put the function in the index.php page I receive an
error Warning: Headers have already been sent... then it shows a bunch
of binary.  I do not want re-save the file, I just want resize and show
it.  What am I doing wrong here?  Any help would be great.
- Craig
//query the DB for image name
Some query...
//Photo varibale
$route_photo =
$row[route_photo];
//Start GD
//New Image resize
$new_width = 125;
$new_height = 225;
//Content Type
header(Content-type:
image/jpeg);
//Start new image resize
list($width_orig, $height_orig)
=
getImageSize(./images/climbs/$route_photo);
if ($new_width  ($width_orig 
$height_orig)) {
$new_width =
($new_height / $height_orig) * $width_orig;
} else {
$new_height =
($new_width / $width_orig) * $height_orig;
}
//resample the image
$thumb =
ImageCreateTrueColor($new_width, $new_height);
$tmp_image =
ImageCreateFromJPEG(./images/climbs/$route_photo);
ImageCopyResampled($thumb,
$tmp_image, 0, 0, 0, 0, $new_width,
$new_height, $width_orig, $height_orig);
ImageJPEG($thumb,'','100');
ImageDestroy($thumb);
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Pre-Include File -- Global Include Pre/Post by filename

2005-04-05 Thread Peter Beckman
Back in 2000 I remember there being a file that could be created in the
include path that, if existed, would be called and executed before any
other PHP script was executed.  There was also a script that if named
correctly and put in the include path, would execute AFTER the called
script was executed.
Was this depreciated, or does it still exist?  I can't remember what to
call it, and I can't seem to find the right page in the manual.  Any help?
Beckman
---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Pre-Include File -- Global Include Pre/Post by filename

2005-04-05 Thread Peter Beckman
Dear Peter --
Had you waited two more minutes to post (after looking for only a paltry 47
minutes), you would have found the auto_prepend_file and auto_append_file
php.ini configuration directives which do what you want.
Though it is a little difficult to find them on the PHP site, and Google
wasn't entirely helpful, they are there for you to enjoy.
Beckman
On Tue, 5 Apr 2005, Peter Beckman wrote:
Back in 2000 I remember there being a file that could be created in the
include path that, if existed, would be called and executed before any
other PHP script was executed.  There was also a script that if named
correctly and put in the include path, would execute AFTER the called
script was executed.
Was this depreciated, or does it still exist?  I can't remember what to
call it, and I can't seem to find the right page in the manual.  Any help?
---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Pre-Include File -- Global Include Pre/Post by filename

2005-04-05 Thread dpgirago
Peter,

Perhaps you are referring to these directive in php.ini:

; Automatically add files before or after any PHP document.
auto_prepend_file =
auto_append_file =

David






Peter Beckman [EMAIL PROTECTED]

04/05/2005 03:39 PM



 

To:
PHP-DB Mailing List php-db@lists.php.net
cc:





Subject:
[PHP-DB] Pre-Include File -- Global Include Pre/Post by filename



Back in 2000 I remember there being a file that could be created in the
include path that, if existed, would be called and executed before any
other PHP script was executed.  There was also a script that if named
correctly and put in the include path, would execute AFTER the called
script was executed.

Was this depreciated, or does it still exist?  I can't remember what to
call it, and I can't seem to find the right page in the manual.  Any help?

Beckman
---
Peter Beckman  Internet 
Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP-DB] How to Disable Daylight Savings Time on RedHat 9.0

2005-04-05 Thread dpgirago
 We have created a MySQL/ C application that gathers environmental data and 

 does inserts into the db once per minute. 
 A set of PHP applications reads this data and does some graphical 
display 
 of the values. 
 Changing from Standard Time to Daylight Savings Time causes minor 
 problems, but in the Fall, DST to ST will screw things up royally.

 I did some googling yesterday, and others have asked how to disable the 
 automatic DST changeover in Red Hat 9.0, but no one really got an 
answer, 
 leading me to believe that it is not straight forward. Does anyone know 
 how to do this?? 

Solved.

Turns out this is a multi-step process in Linux involving creating a text 
file with new time zone rules, running it against 'zic' ( as in -- zic 
newRules.tx ), then soft linking the output file to /etc/localtime. 

See this link: 
http://avi.alkalay.net/linux/docs/TimePrecision/TimePrecision.html#tz.linux

about which the author was kind enough to respond, and see 'man zic' for 
more basic info and some additional examples.

-- David