php-general Digest 24 Oct 2008 14:20:45 -0000 Issue 5753

2008-10-24 Thread php-general-digest-help

php-general Digest 24 Oct 2008 14:20:45 - Issue 5753

Topics (messages 282380 through 282400):

Re: export data to a ms excel file using php
282380 by: Ashley Sheridan

Re: Method of connecting image
282381 by: Ashley Sheridan
282388 by: Bastien Koert

Re: Politics
282382 by: Colin Guthrie
282390 by: Bastien Koert

Re: web shot script
282383 by: Joey
282385 by: Andrew Barnett
282386 by: Afan Pasalic
282389 by: Andrew Barnett
282391 by: Afan Pasalic
282392 by: Andrew Barnett
282393 by: Paul Scott
282397 by: Richard Heyes

index search
282384 by: Ryan S
282387 by: Robert Cummings
282400 by: Andrew Ballard

PHP/mySQL question using ORDER BY with logic
282394 by: Rob Gould
282395 by: Robert Cummings
282398 by: Colin Guthrie

Re: ZendOptimizer + APC
282396 by: steve

Re: what's the difference in the following code?
282399 by: Yeti

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
On Thu, 2008-10-23 at 13:05 +0530, gopi krishnan wrote:
 Hi,
 
 Could any one explain better. I need just the grid lines for the excel
 sheet. I already tried that table border=1 but it shows the linings only
 to the valued cells. But i need to show the grid as in MS Excel. I tried
 TEXT/XML
 but i get the following error
 
 ---
 
 The XML page cannot be displayed
 
 Cannot view XML input using XSL style sheet. Please correct the error and
 then click the Refresh javascript:location.reload() button, or try again
 later.
 --
 
 A string literal was expected, but no opening quote character was found.
 Error processing resource 'http://localhost/dbtoxl...
 
 table border=1tr td width=10025 /tdtd width=100 jana
 /tdtd  width=100...
 
 
 ---
 
 thanks in advance
 
 
 On Thu, Oct 23, 2008 at 3:21 AM, Nitsan Bin-Nun [EMAIL PROTECTED] wrote:
 
  And what about users who use office version  2003 (which do NOT support
  .xml charts)
  You can google a bit, I'm pretty sure I have already encountered a class
  for this case at Manuel's site (phpclasses).
 
  Nitsan
 
  On Wed, Oct 22, 2008 at 9:00 PM, Ashley Sheridan [EMAIL PROTECTED]
   wrote:
 
  On Wed, 2008-10-22 at 11:20 -0700, Jim Lucas wrote:
   [EMAIL PROTECTED] wrote:
Hi,
   
I have tried your MS-Excel MIME type in PHP. But am facing a small
  problem. I can't get the grid lines as look like in normal Excel file.
   
Am using windows XP, Internet explorer 6.0, MS Excel 2003
   
Thanks in advance.-- Jim Lucas wrote :
abderrazzak nejeoui wrote:
can you help me to export data to a ms excel file using php. i tried
  to
export them to an html format and change the extension to .xls that's
  work
but i have lost the formatting
   
excel and the navigator doesn't interpret my code in the same why
  (celles
are not in the same size)
   
   
Ok, so with the examples of others here, here is the shortest example
  that I came up with that
should get you going.
   
?php
   
header(Content-Type:  application/vnd.ms-excel);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
   
$x = $y = range(0, 12);
   
echo 'table';
   
echo 'trtd /tdtd' . join('/tdtd', $x) . '/td/tr';
   
foreach ( $x AS $xx ) {
echo trtd{$xx}/td;
foreach ( $y AS $yy ) {
echo
  td=sum(.(chr(ord('b')+$yy)).1*a.($xx+2).)/td;
}
echo /tr;
}
echo '/table';
   
?
   
This will output a 14x14 table.  It will calculate the totals for each
  cell in the actual
spreadsheet once excel loads it.
   
If you have any questions, ask away.
   
  
   You could change this line
  
   echo 'table';
  
   to this
  
   echo 'table border=1';
  
   This will give you borders around your content at least.
  
   Example:
  
  http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0001.php
  
   I would checkout phpexcel also
  
   --
   Jim Lucas
  
  Some men are born to greatness, some achieve greatness,
  and some have greatness thrust upon them.
  
   Twelfth Night, Act II, Scene V
   by William Shakespeare
  
  
  I think you really need to save the file as an XML file, with the
  text/xml mime-type. Then, save an Excel file in the M$ Office 2003 XML
  file-type (not the 2007 xlsx!) and look at the code it produces and try
  to mimic that output as closely as possible. All you're doing is
  creating an HTML table and hoping Excel knows what to do with it, which
  is a bit like creating an image, sending it to the browser with a PDF
  mime and hoping it 

Re: [PHP] Re: ZendOptimizer + APC

2008-10-24 Thread steve
Run APC on the main site. Create a separate instance of apache running
on another port and have it use the ZendOptimizer, and have the admin
stuff there.

Also, have you tried changing the options for the zend thing to not
actually optimize? It only has positive effects if you are also using
their opcode cache. They moved the optimizer part into their decoder
so they could name it that for a typical bait and switch job on
unsuspecting webmasters. Bleh...


On Thu, Oct 23, 2008 at 4:44 AM, Jochem Maas [EMAIL PROTECTED] wrote:
 Nathan Nobbe schreef:
 On Wed, Oct 22, 2008 at 4:39 PM, Martin Zvarík [EMAIL PROTECTED] wrote:

 Jochem Maas napsal(a):

 napsal(a) ... that's even weirder than my 'schreef' :-)

 anyone know whether running ZendOptimizer + APC simultaneously still
 causes allsorts
 of problems ... I know it did in the past but I can't find any very recent
 stuff about the
 issues online.

 I believe you should look up eAccelerator or XCache, which should work with
 ZendOptimizer.


 as Jocheem said before the app is bound to apc; depends on the
 implementation whether it could be ported to another solution.

 technically I can remove/replace APC - but time and desire say otherwise.

 the joke is that the server in question will only be running my app ... with
 the expection of a generic controlpanel thang for server management ...
 which requires ZendOptimizer ... and the sysadmin doesn't want to turn off
 ZendOptimizer because then the controlpanel app won't work
 (the server only exists to run the app/site/foo I wrote for a given client,
 but obviously I'll have to 'fix' my stuff so that the controlpanel can
 continue to run)

 just another wtf. regardless, thanks to those that responded.




 -nathan


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



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



Re: [PHP] web shot script

2008-10-24 Thread Richard Heyes
 The other options is using something like www.browsershots.org (as far
 as I remember thats their URL) and pay them to get the first places on
 their queues.

Wow, That's really a very handy tool.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org

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



[PHP] Re: PHP/mySQL question using ORDER BY with logic

2008-10-24 Thread Colin Guthrie

Robert Cummings wrote:

On Fri, 2008-10-24 at 00:18 -0400, Rob Gould wrote:

Question about mySQL and PHP, when using the mySQL ORDER BY method...


	Basically I've got data coming from the database where a wine  
producer-name is a word like:


Château Bahans Haut-Brion

or

La Chapelle de La Mission Haut-Brion

or

Le Clarence de Haut-Brion

but I need to ORDER BY using a varient of the string:

	1)  If it begins with Château, don't include Chateau in the  
string to order by.
	2)  If it begins with La, don't order by La, unless the first  
word is Chateau, and then go ahead and order by La.



	Example sort:  Notice how the producer as-in comes before the  
parenthesis, but the ORDER BY actually occurs after a re-ordering of  
the producer-string, using the above rules.


Red: Château Bahans Haut-Brion (Bahans Haut-Brion, Château )
	Red: La Chapelle de La Mission Haut-Brion (Chapelle de La Mission  
Haut-Brion, La )

Red: Le Clarence de Haut-Brion (Clarence de Haut-Brion, Le )
Red: Château Haut-Brion (Haut-Brion, Château )
Red: Château La Mission Haut-Brion (La Mission Haut-Brion, Château )
	Red: Domaine de La Passion Haut Brion (La Passion Haut Brion,  
Domaine de )

Red: Château La Tour Haut-Brion (La Tour Haut-Brion, Château )
Red: Château Larrivet-Haut-Brion (Larrivet-Haut-Brion, Château )
Red: Château Les Carmes Haut-Brion (Les Carmes Haut-Brion, Château )


	That logic between mySQL and PHP, I'm just not sure how to  
accomplish?  I think it might involve a mySQL alias-technique but I  
could be wrong.


Right now, my PHP call to generate the search is this:

$query = 'SELECT * FROM wine WHERE MATCH(producer, varietal,  
appellation, designation, region, vineyard, subregion, country,  
vintage) AGAINST ( ' . $searchstring . ')  ORDER BY producer LIMIT  
0,100';


Maybe there's a good way to do it with the table as is... but I'm
doubtful. I would create a second field that contains a pre-processed
version of the name that performs stripping to achieve what you want.
This could be done by a PHP script when the data is inserted into the
database, or if not possible like that, then a cron job could run once
in a while, check for entries with this field empty and generate it.


Yeah I'd suspect that the storage overhead is nothing compared to the 
speed increase you'll get during the read operations if you don't have 
to dick around with the data :)


(yes I'm comparing bits to time, but I don't have time to explain that bit).


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] what's the difference in the following code?

2008-10-24 Thread Yeti
The difference between the examples are still nothing, it do the same.
But I never use the short version of if, because when I look after some month 
in some projects I have a better overview when there is a long if , its much 
easier to extend.

As explained a couple of times already - there is not supposed to be a
difference.
It's about security and making code maintainance easier.

[quote to Chris's former post]
(..) imagine you're manually reviewing a colleague's code, and you're
looking through a few thousand lines to try to help identify security
problems. (..)
[end quote]

It's the old What's good code and what's bad code? discussion.
In this case ternary operations are bad code.

sorry for my bad english
Die Code tun nicht Unterschiede in Execution. Es ist Sicherheits Frage.
sorry for my bad German

//A yeti

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



Re: [PHP] index search

2008-10-24 Thread Andrew Ballard
On Thu, Oct 23, 2008 at 10:49 PM, Robert Cummings [EMAIL PROTECTED] wrote:
 On Thu, 2008-10-23 at 19:30 -0700, Ryan S wrote:
 Hey all,
 Was wondering how this is done, have a bunch of links like so:
 0-9 : a : b : c - till Z

 these will be linked to the program (so far have done this) but when the 
 user clicks any of those links I want to query the DB for just the first 
 alphabet from the field title, using LIKE is not working for me because 
 its catching alphabets from the middle of the word as well.

 You're using like wrong... you want to use it with one %...

where foo like 'a%'

 Also how to do 0-9? do i have to have 10 if() conditions for that?

 Maybe you could add a new field to the table and set it to the first
 character of the field or 0 if it's a digit. Then you can index it and
 not use like or multiple conditions to match digits.

 Cheers,
 Rob.

I'm pretty sure that if your LIKE statement begins with a constant
value as you have entered above, an index on the regular columns
should still work.  :-)

As for the numeric comparison, I know MySQL has a REGEXP comparison
similar to the LIKE comparator, but I don't know enough about MySQL to
know if it can similarly benefit from indexes the same way. (SQL
Server will let you say WHERE foo LIKE '[0-9]%', but this doesn't seem
to work in MySQL.)

Andrew

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



Re: [PHP] index search

2008-10-24 Thread Robert Cummings
On Fri, 2008-10-24 at 10:20 -0400, Andrew Ballard wrote:
 On Thu, Oct 23, 2008 at 10:49 PM, Robert Cummings [EMAIL PROTECTED] wrote:
  On Thu, 2008-10-23 at 19:30 -0700, Ryan S wrote:
  Hey all,
  Was wondering how this is done, have a bunch of links like so:
  0-9 : a : b : c - till Z
 
  these will be linked to the program (so far have done this) but when the 
  user clicks any of those links I want to query the DB for just the first 
  alphabet from the field title, using LIKE is not working for me because 
  its catching alphabets from the middle of the word as well.
 
  You're using like wrong... you want to use it with one %...
 
 where foo like 'a%'
 
  Also how to do 0-9? do i have to have 10 if() conditions for that?
 
  Maybe you could add a new field to the table and set it to the first
  character of the field or 0 if it's a digit. Then you can index it and
  not use like or multiple conditions to match digits.
 
  Cheers,
  Rob.
 
 I'm pretty sure that if your LIKE statement begins with a constant
 value as you have entered above, an index on the regular columns
 should still work.  :-)
 
 As for the numeric comparison, I know MySQL has a REGEXP comparison
 similar to the LIKE comparator, but I don't know enough about MySQL to
 know if it can similarly benefit from indexes the same way. (SQL
 Server will let you say WHERE foo LIKE '[0-9]%', but this doesn't seem
 to work in MySQL.)

Yeah, I know about MySQL's regexp, but that didn't seem terribly efficient. For 
small databases, under a million records, I prefer to trade space for time.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] index search

2008-10-24 Thread Andrew Ballard
On Fri, Oct 24, 2008 at 10:22 AM, Robert Cummings [EMAIL PROTECTED] wrote:
 As for the numeric comparison, I know MySQL has a REGEXP comparison
 similar to the LIKE comparator, but I don't know enough about MySQL to
 know if it can similarly benefit from indexes the same way. (SQL
 Server will let you say WHERE foo LIKE '[0-9]%', but this doesn't seem
 to work in MySQL.)

 Yeah, I know about MySQL's regexp, but that didn't seem terribly efficient. 
 For small databases, under a million records, I prefer to trade space for 
 time.

 Cheers,
 Rob.

I've never used the regexp in MySQL, so I have no idea how it impacts
performance; I just saw it in the manual (where the comments confirm
that REGEXP does not use indexes - yuk).

In some cases, I agree with you that a small tradeoff in space to save
time is worthwhile. In this case though, I think it would work to say
WHERE foo BETWEEN '0' AND '9' and WHERE foo LIKE 'a%' since both are
able to use an existing index and don't need to maintain an additional
column.

Andrew

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



[PHP] Building an array, kind of?

2008-10-24 Thread Dan Shirah
TGIF?

Apparently my brain isn't working this Friday.

I'm trying to query my table to get the first 16 ID's.  I then want
to assign the ID's to a variable and have them comma seperated.

// My query to select the first 16 rows
$get_charges2 = SELECT FIRST 16 * FROM history WHERE id = '$id;

// Executing the query
 $charge_result2 = ifx_query ($get_charges2, $connect_id);

How would I assign the result to a variable?

For instance, say my query returns rows like:

1234
1235
1236
1237
1238
1239

How would I go about putting that in a variable to equal
1234,1235,1236,1237,1238,1239 ?


Re: [PHP] index search

2008-10-24 Thread Robert Cummings
On Fri, 2008-10-24 at 10:49 -0400, Andrew Ballard wrote:
 On Fri, Oct 24, 2008 at 10:22 AM, Robert Cummings [EMAIL PROTECTED] wrote:
  As for the numeric comparison, I know MySQL has a REGEXP comparison
  similar to the LIKE comparator, but I don't know enough about MySQL to
  know if it can similarly benefit from indexes the same way. (SQL
  Server will let you say WHERE foo LIKE '[0-9]%', but this doesn't seem
  to work in MySQL.)
 
  Yeah, I know about MySQL's regexp, but that didn't seem terribly efficient. 
  For small databases, under a million records, I prefer to trade space for 
  time.
 
  Cheers,
  Rob.
 
 I've never used the regexp in MySQL, so I have no idea how it impacts
 performance; I just saw it in the manual (where the comments confirm
 that REGEXP does not use indexes - yuk).
 
 In some cases, I agree with you that a small tradeoff in space to save
 time is worthwhile. In this case though, I think it would work to say
 WHERE foo BETWEEN '0' AND '9' and WHERE foo LIKE 'a%' since both are
 able to use an existing index and don't need to maintain an additional
 column.

Maintaining that extra column is like a one liner in the insert code.
Also the width of the field at one byte is pretty teency... a few more
bytes if you use UTF and plan to index non ascii characters. Since this
is a library of wine, it's more likely the case of occasional insert and
many many reads. So I think this is an exemplary candidate for a
separate indexed field.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Building an array, kind of?

2008-10-24 Thread David Otton
2008/10/24 Dan Shirah [EMAIL PROTECTED]:

 How would I go about putting that in a variable to equal
 1234,1235,1236,1237,1238,1239 ?


Pseudocode:

$t = array();

foreach($resultset as $row)
$t[] = $row;

$t = join(',',$t);

-- 

http://www.otton.org/

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



Re: [PHP] Building an array, kind of?

2008-10-24 Thread Yeti
?php
$arr = array(1234, 1235, 1236, 1237, 1238, 1239);
$string = implode(', ', $arr);
var_dump($string);
?

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



Re: [PHP] index search

2008-10-24 Thread Andrew Ballard
On Fri, Oct 24, 2008 at 11:08 AM, Robert Cummings [EMAIL PROTECTED] wrote:
 On Fri, 2008-10-24 at 10:49 -0400, Andrew Ballard wrote:
 On Fri, Oct 24, 2008 at 10:22 AM, Robert Cummings [EMAIL PROTECTED] wrote:
  As for the numeric comparison, I know MySQL has a REGEXP comparison
  similar to the LIKE comparator, but I don't know enough about MySQL to
  know if it can similarly benefit from indexes the same way. (SQL
  Server will let you say WHERE foo LIKE '[0-9]%', but this doesn't seem
  to work in MySQL.)
 
  Yeah, I know about MySQL's regexp, but that didn't seem terribly 
  efficient. For small databases, under a million records, I prefer to trade 
  space for time.
 
  Cheers,
  Rob.

 I've never used the regexp in MySQL, so I have no idea how it impacts
 performance; I just saw it in the manual (where the comments confirm
 that REGEXP does not use indexes - yuk).

 In some cases, I agree with you that a small tradeoff in space to save
 time is worthwhile. In this case though, I think it would work to say
 WHERE foo BETWEEN '0' AND '9' and WHERE foo LIKE 'a%' since both are
 able to use an existing index and don't need to maintain an additional
 column.

 Maintaining that extra column is like a one liner in the insert code.

Agreed.

 Also the width of the field at one byte is pretty teency... a few more
 bytes if you use UTF and plan to index non ascii characters.

Agreed.

 Since this is a library of wine, it's more likely the case of occasional
 insert and many many reads. So I think this is an exemplary candidate
 for a separate indexed field.

Also agreed.  See? I can be rather agreeable.  :-)

I'm not saying that what you proposed is a bad solution. I'll even
grant that in some cases it can be an excellent solution. I just don't
think it's necessary in THIS case.

Andrew

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



Re: [PHP] web shot script

2008-10-24 Thread Jim Lucas
Andrew Barnett wrote:
 You might actually be onto something there Afan.
 
 As long as Ghostscript and Imagemagick are installed on the server, you will
 be able to convert a PDF to an image. So maybe that will help.
 
 Although, is it possible to have a continuous length PDF, or does it only
 fit to specific page sizes.
 
 Its probably worth a shot though Joey.
 
 
 Andrew
 

Isn't the idea of getting different screen shots about SEEING how the page
looks on various system configurations?  Windows, Mac, *nix then throw in
various browsers like IE, FF, Opera, Google?

This is the service that I thought these other companies provided.  You could
probably do something like this on one computer by having VMWare (or similar)
software running to see all the different renderings.

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] index search

2008-10-24 Thread Ryan S

clip
Are you sure LIKE isn't working? I would think LIKE a% would work. For 
0-9, I would think you can use = 9 or you can use BETWEEN 0 and 9.
/clip

Silly me, the reason it was not working was I am so used to %something% and 
used that instead of 
something%

Anyway, it was a not a useless post for me because the 0-9 part was not solved 
in my head but a lot of interesting replies as to how to do it.

Thanks everyone!

/Ryan



  

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



Re: [PHP] Re: ZendOptimizer + APC

2008-10-24 Thread Jochem Maas
steve schreef:
 Run APC on the main site. Create a separate instance of apache running
 on another port and have it use the ZendOptimizer, and have the admin
 stuff there.
 

I did one better .. I got the go ahead to just remove ZendOptimizer :-)

it's better in that it's less work for me ;-)

 Also, have you tried changing the options for the zend thing to not
 actually optimize? It only has positive effects if you are also using
 their opcode cache. They moved the optimizer part into their decoder
 so they could name it that for a typical bait and switch job on
 unsuspecting webmasters. Bleh...

ah ... hmm. well ... yes. :-/

thanks for the info.

 On Thu, Oct 23, 2008 at 4:44 AM, Jochem Maas [EMAIL PROTECTED] wrote:
 Nathan Nobbe schreef:
 On Wed, Oct 22, 2008 at 4:39 PM, Martin Zvarík [EMAIL PROTECTED] wrote:

 Jochem Maas napsal(a):
 napsal(a) ... that's even weirder than my 'schreef' :-)

 anyone know whether running ZendOptimizer + APC simultaneously still
 causes allsorts
 of problems ... I know it did in the past but I can't find any very recent
 stuff about the
 issues online.

 I believe you should look up eAccelerator or XCache, which should work with
 ZendOptimizer.

 as Jocheem said before the app is bound to apc; depends on the
 implementation whether it could be ported to another solution.
 technically I can remove/replace APC - but time and desire say otherwise.

 the joke is that the server in question will only be running my app ... with
 the expection of a generic controlpanel thang for server management ...
 which requires ZendOptimizer ... and the sysadmin doesn't want to turn off
 ZendOptimizer because then the controlpanel app won't work
 (the server only exists to run the app/site/foo I wrote for a given client,
 but obviously I'll have to 'fix' my stuff so that the controlpanel can
 continue to run)

 just another wtf. regardless, thanks to those that responded.



 -nathan

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


 


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



RE: [PHP] Building an array, kind of?

2008-10-24 Thread Boyd, Todd M.
 -Original Message-
 From: Dan Shirah [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 24, 2008 9:52 AM
 To: PHP LIST
 Subject: [PHP] Building an array, kind of?
 
 TGIF?
 
 Apparently my brain isn't working this Friday.
 
 I'm trying to query my table to get the first 16 ID's.  I then want
 to assign the ID's to a variable and have them comma seperated.
 
 // My query to select the first 16 rows
 $get_charges2 = SELECT FIRST 16 * FROM history WHERE id = '$id;
 
 // Executing the query
  $charge_result2 = ifx_query ($get_charges2, $connect_id);
 
 How would I assign the result to a variable?
 
 For instance, say my query returns rows like:
 
 1234
 1235
 1236
 1237
 1238
 1239
 
 How would I go about putting that in a variable to equal
 1234,1235,1236,1237,1238,1239 ?

I think someone's already used foreach() in an answer, but I don't see
the point in building an array and then immediately joining it to a
string and discarding the array...

$t = '';
foreach($resultset as $row)
$t .= ',' . $row;

Done and done.


Todd Boyd
Web Programmer

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



RE: [PHP] Building an array, kind of?

2008-10-24 Thread Boyd, Todd M.
 -Original Message-
 From: Boyd, Todd M. [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 24, 2008 11:28 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] Building an array, kind of?
 
  -Original Message-
  From: Dan Shirah [mailto:[EMAIL PROTECTED]
  Sent: Friday, October 24, 2008 9:52 AM
  To: PHP LIST
  Subject: [PHP] Building an array, kind of?
 
  TGIF?
 
  Apparently my brain isn't working this Friday.
 
  I'm trying to query my table to get the first 16 ID's.  I then want
  to assign the ID's to a variable and have them comma seperated.
 
  // My query to select the first 16 rows
  $get_charges2 = SELECT FIRST 16 * FROM history WHERE id = '$id;
 
  // Executing the query
   $charge_result2 = ifx_query ($get_charges2, $connect_id);
 
  How would I assign the result to a variable?
 
  For instance, say my query returns rows like:
 
  1234
  1235
  1236
  1237
  1238
  1239
 
  How would I go about putting that in a variable to equal
  1234,1235,1236,1237,1238,1239 ?
 
 I think someone's already used foreach() in an answer, but I don't see
 the point in building an array and then immediately joining it to a
 string and discarding the array...
 
 $t = '';
 foreach($resultset as $row)
   $t .= ',' . $row;
 
 Done and done.

Gah. Well, same amount of work, I guess, since you'll need to either
trim the first comma or add the first row before the foreach() loop.

Damn you, cat skin!


Todd Boyd
Web Programmer

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



Re: [PHP] Building an array, kind of?

2008-10-24 Thread tedd

At 10:52 AM -0400 10/24/08, Dan Shirah wrote:

TGIF?

Apparently my brain isn't working this Friday.

I'm trying to query my table to get the first 16 ID's.  I then want
to assign the ID's to a variable and have them comma seperated.

// My query to select the first 16 rows
$get_charges2 = SELECT FIRST 16 * FROM history WHERE id = '$id;

// Executing the query
 $charge_result2 = ifx_query ($get_charges2, $connect_id);

How would I assign the result to a variable?

For instance, say my query returns rows like:

1234
1235
1236
1237
1238
1239

How would I go about putting that in a variable to equal
1234,1235,1236,1237,1238,1239 ?


from memory.

$var='';
while($row = mysql_fetch_array($charge_result2))
   {
   $var .= $row['id'] . ',';
   }

cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Building an array, kind of?

2008-10-24 Thread Dan Shirah

  from memory.

 $var='';
 while($row = mysql_fetch_array($charge_result2))
   {
   $var .= $row['id'] . ',';
   }

 cheers,

 tedd


Thanks all!

It works and here is the code I used:

$get_charges2 = SELECT FIRST 16 * FROM history WHERE id = '$id;
 $charge_result2 = ifx_query ($get_charges2, $connect_id);
 while ($charge_row2 = ifx_fetch_row($charge_result2)) {
  $charges .= $charge_row2['id'].,;
 }


[PHP] moved code to a new server

2008-10-24 Thread Daniel P. Brown
   Forwarded to General, since this doesn't belong on DB.

On Fri, Oct 24, 2008 at 6:18 PM, Marc Fromm [EMAIL PROTECTED] wrote:
 We moved our website to a new linux server. The code was running on a 
 different linux server. Thus the OS environment is the same.
 We are receiving this error:
 [Fri Oct 24 14:53:37 2008] PHP Fatal error:  require() [a 
 href='function.require'function.require/a]: Failed opening required 'this 
 was a url to a .js file' (include_path='.:/usr/share/pear:/usr/share/php') in 
 /var/www/html/path to .php file on line 4

 I'm not a php programmer thus I am in the dark.

   You don't have to be, you just have to read the error message.  If
you copied that verbatim, then 'this was a url to a .js file' exists
on line 4 of .php in /var/www/html/path, and PHP failed to open it.

   Make sure the file exists exactly where PHP is looking for it, and
that it's accessible and readable to and by the user as which the
server is running when executing `.php` in /var/www/html/path, and
that the target file can be found from that directory.

-- 
/Daniel P. Brown
http://www.parasane.net/ [New Look]
[EMAIL PROTECTED] || [EMAIL PROTECTED]

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



RE: [PHP] moved code to a new server

2008-10-24 Thread Mohamed Ainab

would be very helpfull if you would post the code.

---
http://ainab.com | http://somaliyrics.net 

 Original Message 
Subject: [PHP] moved code to a new server
From: Daniel P. Brown [EMAIL PROTECTED]
Date: Fri, October 24, 2008 3:25 pm
To: php php php-general@lists.php.net, Marc Fromm
[EMAIL PROTECTED]

Forwarded to General, since this doesn't belong on DB.

On Fri, Oct 24, 2008 at 6:18 PM, Marc Fromm [EMAIL PROTECTED] wrote:
 We moved our website to a new linux server. The code was running on a 
 different linux server. Thus the OS environment is the same.
 We are receiving this error:
 [Fri Oct 24 14:53:37 2008] PHP Fatal error: require() [a 
 href='function.require'function.require/a]: Failed opening required 'this 
 was a url to a .js file' (include_path='.:/usr/share/pear:/usr/share/php') in 
 /var/www/html/path to .php file on line 4

 I'm not a php programmer thus I am in the dark.

You don't have to be, you just have to read the error message. If
you copied that verbatim, then 'this was a url to a .js file' exists
on line 4 of .php in /var/www/html/path, and PHP failed to open it.

Make sure the file exists exactly where PHP is looking for it, and
that it's accessible and readable to and by the user as which the
server is running when executing `.php` in /var/www/html/path, and
that the target file can be found from that directory.

-- 
/Daniel P. Brown
http://www.parasane.net/ [New Look]
[EMAIL PROTECTED] || [EMAIL PROTECTED]

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





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



RE: [PHP] moved code to a new server

2008-10-24 Thread Marc Fromm
I think I fixed it. The error said that the file script.js, line 4 of the code, 
could not be found:
4 ? require (http://path/to/the/file/script.js;)?

I changed the line to this and it now works:
? require (script.js) ?

I wonder why on the old server it could find the file based on the full url 
while the new server cannot find the file with the full url.

-Original Message-
From: Mohamed Ainab [mailto:[EMAIL PROTECTED]
Sent: Friday, October 24, 2008 3:34 PM
To: Daniel P. Brown
Cc: php php; Marc Fromm
Subject: RE: [PHP] moved code to a new server


would be very helpfull if you would post the code.

---
http://ainab.com | http://somaliyrics.net

 Original Message 
Subject: [PHP] moved code to a new server
From: Daniel P. Brown [EMAIL PROTECTED]
Date: Fri, October 24, 2008 3:25 pm
To: php php php-general@lists.php.net, Marc Fromm
[EMAIL PROTECTED]

Forwarded to General, since this doesn't belong on DB.

On Fri, Oct 24, 2008 at 6:18 PM, Marc Fromm [EMAIL PROTECTED] wrote:
 We moved our website to a new linux server. The code was running on a 
 different linux server. Thus the OS environment is the same.
 We are receiving this error:
 [Fri Oct 24 14:53:37 2008] PHP Fatal error: require() [a 
 href='function.require'function.require/a]: Failed opening required 'this 
 was a url to a .js file' (include_path='.:/usr/share/pear:/usr/share/php') in 
 /var/www/html/path to .php file on line 4

 I'm not a php programmer thus I am in the dark.

You don't have to be, you just have to read the error message. If
you copied that verbatim, then 'this was a url to a .js file' exists
on line 4 of .php in /var/www/html/path, and PHP failed to open it.

Make sure the file exists exactly where PHP is looking for it, and
that it's accessible and readable to and by the user as which the
server is running when executing `.php` in /var/www/html/path, and
that the target file can be found from that directory.

--
/Daniel P. Brown
http://www.parasane.net/ [New Look]
[EMAIL PROTECTED] || [EMAIL PROTECTED]

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





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



Re: [PHP] moved code to a new server

2008-10-24 Thread Eric Butera
On Fri, Oct 24, 2008 at 6:50 PM, Marc Fromm [EMAIL PROTECTED] wrote:
 I think I fixed it. The error said that the file script.js, line 4 of the 
 code, could not be found:
 4 ? require (http://path/to/the/file/script.js;)?

 I changed the line to this and it now works:
 ? require (script.js) ?

 I wonder why on the old server it could find the file based on the full url 
 while the new server cannot find the file with the full url.

 -Original Message-
 From: Mohamed Ainab [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 24, 2008 3:34 PM
 To: Daniel P. Brown
 Cc: php php; Marc Fromm
 Subject: RE: [PHP] moved code to a new server


 would be very helpfull if you would post the code.

 ---
 http://ainab.com | http://somaliyrics.net

  Original Message 
 Subject: [PHP] moved code to a new server
 From: Daniel P. Brown [EMAIL PROTECTED]
 Date: Fri, October 24, 2008 3:25 pm
 To: php php php-general@lists.php.net, Marc Fromm
 [EMAIL PROTECTED]

 Forwarded to General, since this doesn't belong on DB.

 On Fri, Oct 24, 2008 at 6:18 PM, Marc Fromm [EMAIL PROTECTED] wrote:
 We moved our website to a new linux server. The code was running on a 
 different linux server. Thus the OS environment is the same.
 We are receiving this error:
 [Fri Oct 24 14:53:37 2008] PHP Fatal error: require() [a 
 href='function.require'function.require/a]: Failed opening required 'this 
 was a url to a .js file' (include_path='.:/usr/share/pear:/usr/share/php') 
 in /var/www/html/path to .php file on line 4

 I'm not a php programmer thus I am in the dark.

 You don't have to be, you just have to read the error message. If
 you copied that verbatim, then 'this was a url to a .js file' exists
 on line 4 of .php in /var/www/html/path, and PHP failed to open it.

 Make sure the file exists exactly where PHP is looking for it, and
 that it's accessible and readable to and by the user as which the
 server is running when executing `.php` in /var/www/html/path, and
 that the target file can be found from that directory.

 --
 /Daniel P. Brown
 http://www.parasane.net/ [New Look]
 [EMAIL PROTECTED] || [EMAIL PROTECTED]

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





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



fopen wrappers.

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



Re: [PHP] moved code to a new server

2008-10-24 Thread Jim Lucas
Marc Fromm wrote:
 I think I fixed it. The error said that the file script.js, line 4 of the 
 code, could not be found:
 4 ? require (http://path/to/the/file/script.js;)?
 
 I changed the line to this and it now works:
 ? require (script.js) ?
 
 I wonder why on the old server it could find the file based on the full url 
 while the new server cannot find the file with the full url.
 
 -Original Message-
 From: Mohamed Ainab [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 24, 2008 3:34 PM
 To: Daniel P. Brown
 Cc: php php; Marc Fromm
 Subject: RE: [PHP] moved code to a new server
 
 
 would be very helpfull if you would post the code.
 
 ---
 http://ainab.com | http://somaliyrics.net
 
  Original Message 
 Subject: [PHP] moved code to a new server
 From: Daniel P. Brown [EMAIL PROTECTED]
 Date: Fri, October 24, 2008 3:25 pm
 To: php php php-general@lists.php.net, Marc Fromm
 [EMAIL PROTECTED]
 
 Forwarded to General, since this doesn't belong on DB.
 
 On Fri, Oct 24, 2008 at 6:18 PM, Marc Fromm [EMAIL PROTECTED] wrote:
 We moved our website to a new linux server. The code was running on a 
 different linux server. Thus the OS environment is the same.
 We are receiving this error:
 [Fri Oct 24 14:53:37 2008] PHP Fatal error: require() [a 
 href='function.require'function.require/a]: Failed opening required 'this 
 was a url to a .js file' (include_path='.:/usr/share/pear:/usr/share/php') 
 in /var/www/html/path to .php file on line 4

 I'm not a php programmer thus I am in the dark.
 
 You don't have to be, you just have to read the error message. If
 you copied that verbatim, then 'this was a url to a .js file' exists
 on line 4 of .php in /var/www/html/path, and PHP failed to open it.
 
 Make sure the file exists exactly where PHP is looking for it, and
 that it's accessible and readable to and by the user as which the
 server is running when executing `.php` in /var/www/html/path, and
 that the target file can be found from that directory.
 
 --
 /Daniel P. Brown
 http://www.parasane.net/ [New Look]
 [EMAIL PROTECTED] || [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 

Probably because in your new system it has this in your php.ini file

allow_url_include = Off

Change it to this

allow_url_include = On

Restart your webserver and it should probably work just fine.

You might also want to check into this option too.

allow_url_fopen = Off

Change it to

allow_url_fopen = On

if you would like to allow the opening of remote files via
fopen/file_get_contents/etc...

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


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