Re: [PHP] Can GD make a JPG thumbnail of a PDF?

2008-11-20 Thread Stephen Johnson
No but you can use imagemagicks convert to convert the pdf to an image and
then make a thumbnail of it.


On 11/20/08 4:39 PM, "Brian Dunning" <[EMAIL PROTECTED]> wrote:

> Well can it?

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--



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



Re: [PHP] Can GD make a JPG thumbnail of a PDF?

2008-12-10 Thread Stephen Johnson
I think you want something like this :
exec("convert -density 360x360 -enhance $pdfFile $pdfFile.gif");


On 12/10/08 4:48 PM, "Brian Dunning" <[EMAIL PROTECTED]> wrote:

> I've spent most of the last week trying to get ImageMagick working on
> my Windows PHP installation. I gather that since I'm going to be
> converting PDFs to JPEGs, I need Ghostscript.
> 
> Well, I've got ImageMagick installed: http://printhq2.com/info.php
> I ran a Ghostscript installer, but it didn't seem to do very much.
> 
> Some site advised me to test my installation like this:
>  echo "";
> system("convert -version");
> echo "";
> ?>
> But it just returns blank. Can anyone help me get ImageMagick working
> on my server?
> 
> 
> On Nov 20, 2008, at 4:41 PM, Stephen Johnson wrote:
> 
>> No but you can use imagemagicks convert to convert the pdf to an
>> image and
>> then make a thumbnail of it.
> 

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--



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



Re: [PHP] PHP or Bridge (card game)

2007-02-10 Thread Stephen Johnson
What an odd question

Personally PHP makes much more sense to me then the many variations of
bridge...



http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: pub <[EMAIL PROTECTED]>
> Date: Sat, 10 Feb 2007 13:19:02 -0800
> To: PHP General List 
> Subject: [PHP] PHP or Bridge (card game)
> 
> To all PHP experts,
> 
> Do any of you also know how to play bridge?
> If yes, which do you think is harder to learn, PHP or bridge?
> 
> Thanks.
> 
> -- 
> 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] Why won't this query go through?

2007-03-12 Thread Stephen Johnson
> From: Richard Lynch <[EMAIL PROTECTED]>
> On Sun, March 11, 2007 11:24 am, Mike Shanley wrote:
>> I am just not understanding what I could have possibly done wrong with
>> this query. All of the variables are good, without special characters
>> in
>> any sense of the word... So why isn't it importing anything?
>> 
>> Thanks!
>> 
>>  $q = "INSERT INTO
>> `visitors`(`username`,`password`,`email`,`firstname`,`lastname`,`birthdate`,`
>> verifythis`)
>> VALUES ('".$username."',
>> '".md5($password1)."',
>> '".$email."',
>> '".$firstname."',
>> '".$lastname."',
>> '".$birthdate."',
>> '".$verifythis."');";
>> mysql_query($q);
> 
> I don't know.
> 
> But MySQL is just DYING to TELL you what went wrong.
> 
> mysql_query($q) or die(mysql_error());
> 
> is what you should be using.
> 
> For now.
> 
> Later, you'll want a better error handling method than "or die()"


And sending this to a MySQL user group, rather then a PHP group, might get a
better response too...

Just for future error reference.. ;)


http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>

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



Re: [PHP] [HAB] PHP or ASP.Net

2005-02-17 Thread Stephen Johnson
I find it humorous that these types of debates keep coming back up -- no
matter what the topic, the IT world can not seem to agree on anything.

OS wars - Browser wars - coding languages.

It all gets very tiring.  Bottom line - go with what you like and with what
can get the job done.  Myself personally, I have never found something that
I could not do in PHP.  However, that being said, a lot of companies simply
do not want to leave off the Microsoft model. So if you want to work for
those companies you will need to know ASP.

In the end, it is all about marketability.  You want to be able to put
yourself in a position where are your needed by a company -- best way to do
that -- learn both.

Just my 2 cents.


http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: Greg Donald <[EMAIL PROTECTED]>
> Reply-To: Greg Donald <[EMAIL PROTECTED]>
> Date: Thu, 17 Feb 2005 15:32:42 -0600
> To: php-general@lists.php.net
> Subject: Re: [PHP] [HAB] PHP or ASP.Net
> 
> On Thu, 17 Feb 2005 13:15:08 -0800 (PST), OOzy Pal <[EMAIL PROTECTED]> wrote:
>> In a long debate with a friend, he tried to convince
>> my that ASP.Net is the language to go for. Me, I don't
>> like MS product. I really could not convince him that
>> PHP is better than ASP.Net. Can you guys/gals help me
>> to convince this guy that PHP is the language to go
>> for.
> 
> ASP vs. PHP discussions:
> http://www.pointafter.com/Archives/nl0203.htm
> http://www.oracle.com/technology/pub/articles/hull_asp.html
> http://www.webxpertz.net/forums/showthread.php?t=19686
> http://www.wrensoft.com/zoom/benchmarks.html
> 
> At the web dev shop I work at, we have two developers who code in both
> PHP and ASP, and they both like ASP better.  *shrug*
> 
> I found this just the other day, discusses PHP vs. Perl:
> http://tnx.nl/php
> 
> 
> -- 
> Greg Donald
> Zend Certified Engineer
> http://destiney.com/
> 
> -- 
> 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] mysql query

2005-02-17 Thread Stephen Johnson
Now I am assuming that 4 and 6 would not always be the next article ID -
otherwise you could just increment your id accordingly.

If you wanted to do that without running multiple queries, this is who I
might do it, rather sloppy, but I think it would work.

$idGet= $_GET['id'];
$sql = "select id, title from articles";
$db->query($sql);
$i=0; 
while($db->getRow()) {
  $id[$i] =  $db->row['id'];
  $title[$i] = $db->row['title'];
  $i++; 
  if($id[$i] == $idGet) {
  $j = $I;
   } 
} 

$prev = $j-1; 
$next = $j+1;

<>



http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Sebastian" <[EMAIL PROTECTED]>
> Date: Thu, 17 Feb 2005 19:24:50 -0500
> To: 
> Subject: [PHP] mysql query
> 
> Hello,
> im working on an article system and looking to avoid running three queries.
> example, i have this query:
> 
> SELECT id,title FROM articles WHERE id=$_GET[id]
> 
> now say $_GET[id] = 5
> 
> I would like to get the previous id 4 and the next id 6 (if there is one)
> so i can do something like:
> 
> << Previous Article [Title]
> Next Article [Ttitle] >>
> 
> i would assume this is impossible without running mulitple queries? just
> thought i'd ask in case i am wrong. i am using mysql 4x
> 
> thanks

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



Re: [PHP] FATAL: emalloc()

2005-02-18 Thread Stephen Johnson
Sounds to me like you need to go out and hire a PHP programmer to go through
your code and get your site back up and running.

Then that same person can give someone in your organization some tutorials
on how to maintain your code so that this sort of thing does not continue to
happen. 

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Matt M." <[EMAIL PROTECTED]>
> Reply-To: "Matt M." <[EMAIL PROTECTED]>
> Date: Fri, 18 Feb 2005 11:18:23 -0600
> To: "George A. Balanos" <[EMAIL PROTECTED]>, PHP general
> 
> Subject: Re: [PHP] FATAL: emalloc()
> 
> On Fri, 18 Feb 2005 12:10:32 -0500 (GMT-05:00), George A. Balanos
> <[EMAIL PROTECTED]> wrote:
>> Thank you Matt, I found that also but to be honest the person who built this
>> server recently passed away.  He was our php specialist and to be honest I
>> have no clue on how to activate this change.  I have someone that knows Linux
>> but after that we have no idea how to go about this change, can you point me
>> in the right direction where I can learn to do this change or if you know a
>> good write up on how to execute this?
> 
> 
> 
> reply to the whole list.  You get more answers that way
> usually you would execute it something like this
> odbc_exec ( $db, 'set textsize ;');
> 
> -- 
> 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] help with adding

2005-02-25 Thread Stephen Johnson
 for ($i = 1; $i <= $sendnum; $i++)
 
 {
 
   $qty = $_POST['qty'.$i];
   $total = $total + $qty;
   echo $qty . '';
 
 }
echo "Total $total";

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
> Organization: Bayou Internet
> Reply-To: <[EMAIL PROTECTED]>
> Date: Thu, 24 Feb 2005 09:39:16 -0600
> To: 
> Subject: [PHP] help with adding
> 
> The code below is echoing the qty correctly (10, 5, 25)
> 
> 
> 
> for ($i = 1; $i <= $sendnum; $i++)
> 
> {
> 
>   $qty = $_POST['qty'.$i];
> 
>   echo $qty . '';
> 
> }

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



Re: [PHP] sentence case

2005-02-28 Thread Stephen Johnson
OK -- dumb question -- what is an OP?


http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: John Nichel <[EMAIL PROTECTED]>
> Date: Wed, 23 Feb 2005 14:13:20 -0500
> To: php Mailing Lists 
> Subject: Re: [PHP] sentence case
> 
> 
> What if the OP doesn't like touching worms?  ;)

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



Re: [PHP] Connecting to a AS/400?

2005-03-02 Thread Stephen Johnson
According to  Larry Hotchkiss on Jan 31,2001



Its my understanding that you use the odbc functions to access db/2
400. I also recall reading that the db2/400 functionality is true db2
functionality and does not use the generic odbc layer even though it is
grouped in. Apparently its smart enough to know. Depending on where you
got your windows ver of php, you should just be able to uncomment the
line in your php.ini so it can use odbc and make sure the extension path
is set correctly.

 


-- 
http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Richard Lynch" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Wed, 2 Mar 2005 10:57:30 -0800 (PST)
> To: "Frank Arensmeier" <[EMAIL PROTECTED]>
> Cc: "php list general" 
> Subject: Re: [PHP] Connecting to a AS/400?
> 
> Frank Arensmeier wrote:
>> Is there anyone who has some experience in connecting to a IBM AS/400
>> server with PHP? Any ideas where to start?
> 
> I know somebody reported success back in the day on this list...
> 
> Actually, it's so far back in the day, it just might be on the predecessor
> to this list, back when all PHP discussion took place pretty much on one
> single list...  But I don't think it's *that* far back.
> 
> Worst case, we're talking back in PHP 3.0 Beta/Release Candidate days,
> possibly, but not before, as that's when I joined up.
> 
> I think they were using "AS400" or "AS 400" without the "/" in their posts.
> 
> IIRC (and that's a big "IF"):
> They originally had nothing, then they got read access, then they achieved
> write access, finally, but I think there was something really skanky about
> getting the write access that made them not real happy with the
> solution...  Like I think it required having "root" be a bit too wide open
> permissive on the AS/400 end.
> 
> Fortunately, the list archives of this list and even that old list are
> linked from:
> http://php.net/mailing-lists.php
> 
> Start with the PHP-General, as I suspect it's in there, though it *could*
> be back in the old old list.
> 
> PS I'm assuming you want to connect to "the database" on an AS/400 and
> that that database is the standard and only database that shipped on those
> suckers.  P-something, right?
> 
> PPS You'd probably be best off getting a CSV dump and migrating to
> hardware/OS less, shall we say, antiquated? :-)
> 
> PPPS I'm not sure if I've ever *seen* an AS/400, so this is definitely
> highly suspect info in this post.
> 
> -- 
> Like Music?
> http://l-i-e.com/artists.htm
> 
> -- 
> 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] Re: A general question

2005-03-07 Thread Stephen Johnson
You have to trick the browser into thinking that the jpg file is something
other then a jpg.  This is sketchy and does not always work.

Something like this maybe
 $len = filesize($file_path);
 header("Content-Type: application/force-download");
 header("Content-Type: application/octet-stream");
 header("Content-Disposition: attachment; filename=$file");
 header("Content-Title: $file_path");
 header("Content-Length: $len");
 readfile($file_path);

$fh=fopen($file_path,'rt');
 @fclose($fh);

HTH

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: zzapper <[EMAIL PROTECTED]>
> Date: Mon, 07 Mar 2005 17:19:30 +
> To: php-general@lists.php.net
> Subject: [PHP] Re: A general question
> 
> 
>> How can I click on a link which is linked to a JPG file and instead of
>> displaying it in the browser save it somewhere on the local machine or
>> open in a different software ?
>> 
>> Please help very urgent
>> 
>> Thanks
>> vaibhav

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



Re: [PHP] using lists in php and sending

2005-03-08 Thread Stephen Johnson
First off - do you have global variables turned on?  If not then you need to
collect the data from the $_POST variable.

Also - when you use a multiple select form field the values come across in
an array. 

So you would need to access the data using something like this:
$i=0;
while($rooms[$i]) {
$room_mail .= " $rooms[$i]";
} 

Then in your mail section replace $rooms with $room_mail.

HTH

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Ross Hulford" <[EMAIL PROTECTED]>
> Date: Tue, 8 Mar 2005 17:34:22 -
> To: php-general@lists.php.net
> Subject: [PHP] using lists in php and sending
> 
> I have a list in php where the user can select 1 or more (rooms book in a
> b&b). The following code is part of the form.
> 
> 
> Single
> Standard
> Single
> EnSuite
> Double
> EnSuite
> Twin En
> Suite
> Family
> Standard
> Family
> EnSuite
> Tripple
> EnSuite
>   
> 
> 
> And then I send using the mail() functin in PHP using the following code but
> the selected rooms do not display. I know it must be an array of sorts
> please help!!!
> 
> 
> msg .= "First Name: $firstname \n"; $msg .= "Second name: $surname \n";
> $msg .= "Email Address: $email \n"; $msg .= "Telephone: $telephone \n"; $msg
> .= "Arrival Date: $arrival \n";
> $msg .= "Departure Date: $depart \n"; $msg .= "$adults   Adults  and   $kids
> Children will be staying \n";
> $msg .= "We will require the following rooms   $rooms\n";
> $msg .= "Message: $addinfo \n";
> $msg .= "-\n\n";
> 
> -- 
> 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] Re: A general question

2005-03-08 Thread Stephen Johnson
Your right -- it is wrong.  I cut and pasted that directly from a File
Sharing app I wrote for our company intranet.
  
I wrote that script a very long time ago (1999 or 2000).  I think that,
originally, the first one didn't work and I added the second.

I forgot to remove it, maybe I though it was a good comment tag.  That whole
file sharing systems was written in the w hours of the morning, so I
should probably go through and alter the code.

My bad. 


http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Richard Lynch" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Tue, 8 Mar 2005 08:56:57 -0800 (PST)
> To: "Stephen Johnson" <[EMAIL PROTECTED]>
> Cc: "zzapper" <[EMAIL PROTECTED]>, "php" 
> Subject: Re: [PHP] Re: A general question
> 
> 
> Call me crazy, but sending TWO Content-type: headers seems just plain
> WRONG to me.
> 
> application/octet-stream will force a download in EVERY http-compliant
> browser.

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



Re: [PHP] PHP help Quotations, Quotations, Quotations

2005-03-10 Thread Stephen Johnson
http://www.php.net/stripslashes
On Mar 10, 2005, at 9:17 PM, stg wrote:
Hello,

I am having a small issue with posting from forms;

It goes like such:

I have a form in which a user can type in a message and in a hidden 
text
field a link is sent, then in the page the form goes to it sends and 
email
to a mailing list with the message and a link underneath bottom.


However when I submit a hyperlink in a form like
http://localhost/knewsl/" >

It is received in the next page with a "\" before every " " " for 
example:

http://localhost/knewsl/file.pdf\";>Click here to view
newsletter -  Which obviously doesn't work.

I would be most grateful if anyone could help.

Cheers,
Simon

*
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Question about "shortening" a string

2005-03-11 Thread Stephen Johnson
Just a quick and dirty solution - but couldn't you explode the name 
into an array and use the first and last array fields ?


On Mar 11, 2005, at 11:39 PM, Steve Slater wrote:
Mario,
Many ways to do it, most using regex. This is not as clean as it
can be but still shows the idea:

This example works for any number of middle names (including zero)
and any number of white spaces between words. You can probably
get this more elegant, but this is one idea.
Steve

In Portgal we have big names.
My complete name, for instance, is "Mário Augusto Machado dos Reis 
Gamito".
"Mário" is the Christian name and "Gamito" - the last one - is always 
the last name of the father.

I have a form where i want to let my users insert their full big name 
like mine, but i want to shorten them just to the first and the last.

For example, if i fill the form with "Mário Augusto Machado dos Reis 
Gamito", i want to change this string to only "Mário Gamito".

The total number of names is not fix.
Could be 3, 4, 5, 6,...
My son name is "Manuel Ramos Gamito". Only 3 names.
Should be changed to "Manuel Gamito", also.
I've looked at the strings functions in the manual, made a lot of 
experiences, but couldn't get there :(

Does anyone knows how to do this ?
Any help would be apreciated.
Warm Regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Steve Slater
[EMAIL PROTECTED]
PHP / MySQL / Web App Security (LAMP) Training:
http://www.handsonsecurity.com/training.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

*
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] odd error

2005-03-14 Thread Stephen Johnson
It's Hebrew -- it means twice colon.
On Mar 14, 2005, at 8:34 PM, Rob Agar wrote:
hey all
just got this error:
Parse error: parse error, expecting `T_PAAMAYIM_NEKUDOTAYIM'
The line that caused it was this: $db =& null;  (yes I know it's wrong,
it's a typo/brain spasm)
I'm just curious - what language IS that? finnish?
Rob Agar
Web Site Consultant
Wild Lime Media - [EMAIL PROTECTED]
Studio 1, 70 McLeod Street, Cairns 4870
Tel: 07 4081 6677  |  Fax: 07 4081 6679
Web and Software Development Services  - www.wildlime.com
Search Engine Optimisation Services - search.wildlime.com
Professional Website Hosting Services -www.hostonlime.com.au
Winner 2004 Telstra North QLD Media Awards - Best Website - Online
Content & Information

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

*
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] New Website for PHP Coders.. www,lifenit.com

2005-03-17 Thread Stephen Johnson
What is with all the crap india programming sites spamming this list?
I for one, am not interested in web sites that are competing to take my 
clients.  If I have to explain one more time why it is NOT better to 
pay less to deal with a company across the a few oceans versus' paying 
more for local services, I think I might scream.

Can't they just move to the US and take our jobs the old fashioned way. 
J/K

Stephen
On Mar 17, 2005, at 8:22 PM, freshersworld .com wrote:
Hi All,
 This is a very interesting website.
Visit www.lifenit.com
Also I can refer one more sebsite for you..
www.merchantii.com
Hope these were Useful.
Rgds,
 Freshersworld
First Job. Dream Job...  Freshersworld.com
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

*****
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php-not-executing-in-html-file-help

2005-03-20 Thread Stephen Johnson
You need to setup your apache server to accept and parse .html files as PHP.

Add this line or modify it to look like this in your httpd.conf file.

AddType application/x-httpd-php .php .html .shtml

HTH
http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: vijayaraj nagarajan <[EMAIL PROTECTED]>
> Date: Sun, 20 Mar 2005 14:12:38 -0800 (PST)
> To: php-general@lists.php.net
> Subject: [PHP] php-not-executing-in-html-file-help
> 
> hi friends
> i am struggling to solve this problem for the past one
> week...kindly help me..
> 
> my apache runs perfectly...
> this code gives a perfect output in the browser...
> 
> file name: hi.html
> 
> 
> hihihi
> 
> 
> but this code doesnot give any output in the
> browser...
> 
> file name: hi.html
> 
> 
> 
> 
> 
> but, the same file with the php code in it...could be
> executed in the command line, using php... where i am
> getting the expected output...
> 
> i tested to c if my apache doesnt recognise php ...
> 
> this code runs perfectly...in the browser...
> 
> 
> 
> if saved as hi.php file...
> the same code saved as .html, is not giving any output
> in the browser...
> 
> kindly help me to figure out this problem...
> 
> thanks
> 
> vijayaraj nagarajan
> graduate student
> the university of southern mississippi
> MS - USA
> 
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> -- 
> 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] session woes

2005-03-23 Thread Stephen Johnson
You need to make sure that output_buffering is turned on in your php.ini
file on the dev server.



http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Mignon Hunter" <[EMAIL PROTECTED]>
> Date: Wed, 23 Mar 2005 11:20:24 -0600
> To: 
> Subject: [PHP] session  woes
> 
> I had my script working beautifully on my box but when transferring to dev
> server no such luck
> 
> Because we have an older version of php on the webservers, I had to get my
> admin to change the php.ini on the
> session.use_trans_id = 1
> so that the SID wouldnt show in the URL. But I'm not sure if that's what is
> causing my problem now.
> 
> It seems I'm not able to transfer and use session data from one page to
> another. I registerd and stored my var in a session variable and can see it on
> sess_downloads_p2 but then I loose it on p3.
> 
> I'm also getting 
> 
> [23-Mar-2005 09:04:47] PHP Warning:  Cannot send session cookie - headers
> already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in
> /var/www/htdocs/sess_downloads_p2.php on line 60
> [23-Mar-2005 09:04:47] PHP Warning:  Cannot send session cache limiter -
> headers already sent (output started at
> /var/www/htdocs/sess_downloads_p2.php:5) in
> /var/www/htdocs/sess_downloads_p2.php on line 60
> 
> where line 60 is my session_start();
> 
> I'm kinda clueless as to what to try next.
> 
> Thanks for any ideas
> 
> -- 
> 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] html image

2005-03-24 Thread Stephen Johnson
I have done this sort of thing with PDF's but I have never done it with
images. 
It has also always been a web page that is on my site -- I get the
impression that you want to read in someone else's url and do this.

I would start off by looking at the ob_start and other related functions.

Once you have the url in a variable I would think you can do whatever you
want with it. 



http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: delos <[EMAIL PROTECTED]>
> Date: Thu, 24 Mar 2005 20:48:50 +0200
> To: php-general@lists.php.net
> Subject: [PHP] html image
> 
> i would like to produce a script that can make an image ("screenshot")
> based only on the site url. so that i enter an URL and php makes the
> picture.
> 
> can such a thing be done by php? if not, maybe by some other language?

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



[PHP] Adding Fonts to JpGraph

2005-04-04 Thread Stephen Johnson
I am using JPGraph for a project that I am working on right now and I have
hit a small snag -

My client wants to have the user be able to select from a list of about 20
­30 standard fonts.  JPGraph only has about six built into it and the
support in the docs is not very helpful since it wants you to register it to
get font support.  I am willing to do that, BUT, their website says they are
no longer accepting support clients.

So ‹ anyone out there have any advice our a tutorial that I can look at for
some assistance ?

Thanks 

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>



Re: [PHP] test

2005-04-04 Thread Stephen Johnson
你好- 測試被接受。歡迎到小組。


http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: [EMAIL PROTECTED]
> Date: Tue, 5 Apr 2005 09:40:55 +0800
> To: php-general@lists.php.net
> Subject: [PHP] test
> 
>   Shi MuQi
> LangFang ABC (China)  °v°
> Tel:(86)-316-68382!^ /(_)\
> E-mail:[EMAIL PROTECTED] ^ ^
> 

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



Re: [PHP] HELP!

2005-04-12 Thread Stephen Johnson
Yes -- 

In your example - $result_id  would be accessed on page2 as

$result_id = $_GET['result_id'];

Then through out your script on page 2 you could access $result_id.

Hope that helps.


æ-- 
åæçäå- $result_id æèçååé2

$result_id = $_get['result_id ' ];

çåééåæçåæäååé2 æèèå $result_idã

åæååã

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: çæä <[EMAIL PROTECTED]>
> Date: Wed, 13 Apr 2005 11:00:36 +0800
> To: 
> Subject: [PHP] HELP!
> 
> HI,
> 
> Any body give me any hinder I would be very appreciated!
> 
> I want to use a parameter of fist page in the second page, how can I realize
> it.
> 
> For example, there is a segment in the first page:
> 
> â
> 
> com href='/cgi-bin/english/E_new_domain_list.cgi?domainType=1'> $num_com;?>
> 
>  $buy_com_num;?>
> 
> â
> 
> But I wan  to use the parameter  â$result_idâ in the second
> page(autorenew.php) :
> 
> âswitch($result_id){
> 
> case "1" :
> 
>  ââ..;
> 
>  Break;
> 
> case "2" :
> 
>  ââ..;
> 
>  Break;
> 
> Can the parameter â$result_idâ pass from fist page to second
> page(autorenew.php)?
> 
> Sincerely yours,
> 
> justin
> 
>E-mail/MSN: [EMAIL PROTECTED]
> 
> 
> 
> 

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



Re: [PHP] set cookie function problem

2005-04-19 Thread Stephen Johnson
Nothing -- 

However - try adding a path to your cookie statement.  It may not be the
problem - but it has corrected this issue for me in the past.

I.e :
setcookie('myCookie',"blah",time()+3600, "/");

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: "Ospinto" <[EMAIL PROTECTED]>
> Date: Tue, 19 Apr 2005 17:33:07 -0400
> To: php-general@lists.php.net
> Subject: Re: [PHP] set cookie function problem
> 
> ok...what does that have to do with my problem?

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



Re: [PHP] script

2005-04-19 Thread Stephen Johnson
http://php.net/time
http://php.net/date
http://php.net/mktime
one or a combination of these functions will help you do what you want.
HTH
On Apr 19, 2005, at 6:37 PM, tommy wrote:
I'm hoping someone on this list can help me with something I've been 
struggling with lately...

I have a php based web page that I'd like to have load an include file 
only when it is Tuesday 11pm - Weds 1 am Eastern Standard time (USA). 
At other times I would like my page to load and alternate include 
file.

If someone could help me with the code or point me in the right 
direction it would be very appreciated.

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

*****
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] marking words bold

2005-05-11 Thread Stephen Johnson
Include a space in your str_replace statement.

For instance 

$t = str_replace(" $word ", " $word ", $text);

That should prevent the problem your having and ensure only individual words
are bolded. 


http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>


> From: Merlin <[EMAIL PROTECTED]>
> Date: Wed, 11 May 2005 17:34:56 +0200
> To: 
> Subject: [PHP] marking words bold
> 
> Hi there,
> 
> I am trying to mark words inside a sentence bold. Problem is, if there is an
> overlap it does not work anymore.
> I am using this code:  $t = str_replace($word, "$word", $text);
> 
> For eample:
> Mark those words bold: adventure in singapore
> Text: My adventure flying to singapore
> 
> The problem lays in the word "in". The code I use does produce following:
> singapore
> which of course does not work properly.
> 
> Does anybody have a good sugestion on how to improve this?`
> 
> Thank you for any help,
> 
> merlin
> 
> -- 
> 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] getting from one table listing from another

2007-08-18 Thread Stephen Johnson
You might try sending this to a group that is more orientated towards data
basing.. Since that seems to be what your asking about...



On 8/18/07 3:53 PM, "Nate" <[EMAIL PROTECTED]> wrote:

> I know this is kinda crazy but I need it :P
> I have one table that lists name's
> and I have another table that has the name's and points
> I want to know how to list the name's of the first table by the points
> of the second table

-- 
Stephen Johnson
The Lone Coder

http://www.myonlinepros.com
*How can we help you today?*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] two small issues with php mail

2007-11-20 Thread Stephen Johnson
I wrote about this a long time ago ... In a galaxy far far away...

http://www.thelonecoder.com/Blog/?p=7

Be good lemmings and do as you're told...
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Michael McGlothlin <[EMAIL PROTECTED]>
> Date: Tue, 20 Nov 2007 11:19:22 -0700
> To: Per Jessen <[EMAIL PROTECTED]>
> Cc: 
> Subject: Re: [PHP] two small issues with php mail
> 
> I hate top posters. Pure evil.
>>>> OMG the top posting on this freakin' issue is a headache
>>>>   
>>> Whereas removing all of the previous message is like a sensual
>>> massage
>> Pure stress-relief.
>>   
> 
> -- 
> 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] two small issues with php mail OT

2007-11-20 Thread Stephen Johnson
Who says you can't please them all... ;)


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Jay Blanchard <[EMAIL PROTECTED]>
> Date: Tue, 20 Nov 2007 14:25:21 -0600
> To: Stephen Johnson <[EMAIL PROTECTED]>, 
> Conversation: [PHP] two small issues with php mail OT
> Subject: RE: [PHP] two small issues with php mail OT
> 
> [snip]
> I wrote about this a long time ago ... In a galaxy far far away...
> 
> http://www.thelonecoder.com/Blog/?p=7
> 
> Be good lemmings and do as you're told...
> [/snip]
> 
> Sitting squarely on the fence he is
> 
> --
> 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] Re: PHP RFC # 0001 --- List Etiquette

2007-11-28 Thread Stephen Johnson

> From: Daniel Brown <[EMAIL PROTECTED]>
> Date: Wed, 28 Nov 2007 11:37:10 -0500
> To: <[EMAIL PROTECTED]>
> Cc: 
> Subject: Re: [PHP] Re: PHP RFC # 0001 --- List Etiquette
> 
> 
> Further, I think Jason Pruim's suggestion of adding to the welcome
> email opens up an interesting point.  Can the NEWBIE GUIDE that Jay
> Blanchard, et al, have co-created be included in the welcome mail?
> For people who actually want to be a part of this mailing list
> community, it would be a great get-acquainted README-style message
> that could help prevent some flames.


The problem here is that a large portion of users on this list are not
active readers, they join to get an answer to their question and then only
reappear for their next problem.  They are not contributors and don't plan
to be, therefore they will likely ignore any and all welcome messages and
will only pay attention to answers to their questions ...

It may be better for the more long term expert users who are the ones
providing the solutions to identify that in the response they send
[SOLUTION], rather then hoping the requestor is going to identify the
solution [SOLVED].  In most cases, the solution is given right away, and
then there is a 2 or 3 day back and forth while the user bangs his head
against the wall arguing about whether that solution will work, while the
rest of the community gets frustrated with him.

In a couple of other email groups I am on , when we are providing the answer
the email generally gets formatted like :

Problem : (initial question )

Solution : (solution)

This has been very helpful, as it also gives  reference point for the other
users to send the OP back to when they are not getting it..

Good discussion though, since lists like this tend to get very noisy, and
anything that can cut down on unnecessary noise is friend not foe..

--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--

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



Re: [PHP] Banned from #php

2007-12-03 Thread Stephen Johnson
It seems to me... And this is just my unimportant opinion

But... 

Your initial question was a violation of the RTFM and STFW tenets... Both
would have provided you answers to such a basic question rather quickly..

Then when wolfpaws provided you more information (print_r added to your
google search provides the answer in the second listing) you again violated
the above tenets. (second strike if you will )

Then when you were finally spoonfed an answer that you should have known
before ever even starting your first session in PHP... You thanked wolfpaws
by telling him he was obnoxious... (third strike and your banned)...

Again, I am not a member of #php or any irc channel for that matter, and I
have no idea who this wolfpaws is, but his actions seem justified to me...
And that is just from hearing your side of the story ...

Lastly, you said : 

> I hope this is the right place to ask because I simply can't find any place
> else to ask for help.

No, I do not believe that this is the right to ask this question, since it
has nothing to do with PHP, and apparently the moderator of said IRC channel
is not here... 

Remember, when coding, php.net and google are friends.  Everyone else hates
you.  It is not personal, it's just a fact.



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Brenden Wilson <[EMAIL PROTECTED]>
> Date: Mon, 3 Dec 2007 11:19:17 -0800
> To: 
> Subject: [PHP] Banned from #php
> 
> I hope this is the right place to ask because I simply can't find any place
> else to ask for help.
> 
> I have been banned from chatting in ##php and I really don't deserve it.
> 
> The chat log can be found here:
> http://pastebin.com/f6941dae7
> (I've deleted conversations from other people)
> 
> 
> Wolfpaws banned me for calling him obnoxious.  I don't know if he does this
> to everybody, but he rarely helps me but almost always calls me an idiot for
> asking questions.  He has been doing this for several weeks now and I have
> only once said something in return to him.  He didn't even give me a
> warning
> 
> 
> How can I get unbanned?  I'm not a problem in the least bit and when I can
> legitimately answer somebody else's question, I always do.
> 
> 
> 
> Thanks,
> Brenden Wilson

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



Re: [PHP] Banned from #php

2007-12-03 Thread Stephen Johnson
Well, I understand the concept of "I have paid, so I get to ask whatever I
want." and if he indeed did pay for access to that IRC channel, then he
should strive to get his money back for being banned.

However, paid or not, I subscribe to the "give a man a fish or teach a man
how to fish" philosophy, and answering lazy questions breeds lazy
programmers, which in the end hurts us all.

Part of this job is learning how to learn, and so many times people just
want you to write the code for them.


 
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: bruce <[EMAIL PROTECTED]>
> Date: Mon, 3 Dec 2007 13:10:48 -0800
> To: 'Stephen Johnson' <[EMAIL PROTECTED]>,
> 
> Subject: RE: [PHP] Banned from #php
> 
> Hey Stephen..
> 
> gotta kind of agree with you about the friends aspect of the net!!! i've
> often thought that there's a business to be had, by actually setting up irc
> channels/forums/threads where you have people pay some small amount to
> actually be able to be part of a system where you're going to get reasonable
> answers to questions...
> 
> you minimize the blatant lazy questions, as you've had to pay to belong to
> the channel... and at the same time, you can still help people with really
> basic questions who really are trying to resolve something, but they simply
> need help...
> 
> you could probably easily get businesses to sponsor this as well..
> 
> peace..
> 
> 
> -Original Message-
> From: Stephen Johnson [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 03, 2007 12:47 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Banned from #php
> 
> 
> It seems to me... And this is just my unimportant opinion
> 
> But...
> 
> Your initial question was a violation of the RTFM and STFW tenets... Both
> would have provided you answers to such a basic question rather quickly..
> 
> Then when wolfpaws provided you more information (print_r added to your
> google search provides the answer in the second listing) you again violated
> the above tenets. (second strike if you will )
> 
> Then when you were finally spoonfed an answer that you should have known
> before ever even starting your first session in PHP... You thanked wolfpaws
> by telling him he was obnoxious... (third strike and your banned)...
> 
> Again, I am not a member of #php or any irc channel for that matter, and I
> have no idea who this wolfpaws is, but his actions seem justified to me...
> And that is just from hearing your side of the story ...
> 
> Lastly, you said :
> 
>> I hope this is the right place to ask because I simply can't find any
> place
>> else to ask for help.
> 
> No, I do not believe that this is the right to ask this question, since it
> has nothing to do with PHP, and apparently the moderator of said IRC channel
> is not here...
> 
> Remember, when coding, php.net and google are friends.  Everyone else hates
> you.  It is not personal, it's just a fact.
> 
> 
> 
> --
> Stephen Johnson c | eh
> The Lone Coder
> 
> http://www.thelonecoder.com
> continuing the struggle against bad code
> 
> http://www.thumbnailresume.com
> --
> 
> 
> 
> 
>> From: Brenden Wilson <[EMAIL PROTECTED]>
>> Date: Mon, 3 Dec 2007 11:19:17 -0800
>> To: 
>> Subject: [PHP] Banned from #php
>> 
>> I hope this is the right place to ask because I simply can't find any
> place
>> else to ask for help.
>> 
>> I have been banned from chatting in ##php and I really don't deserve it.
>> 
>> The chat log can be found here:
>> http://pastebin.com/f6941dae7
>> (I've deleted conversations from other people)
>> 
>> 
>> Wolfpaws banned me for calling him obnoxious.  I don't know if he does
> this
>> to everybody, but he rarely helps me but almost always calls me an idiot
> for
>> asking questions.  He has been doing this for several weeks now and I have
>> only once said something in return to him.  He didn't even give me a
>> warning
>> 
>> 
>> How can I get unbanned?  I'm not a problem in the least bit and when I can
>> legitimately answer somebody else's question, I always do.
>> 
>> 
>> 
>> Thanks,
>> Brenden Wilson
> 
> --
> 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
> 

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



Re: [PHP] How to handle rows of checkboxes upon form submit?

2007-12-06 Thread Stephen Johnson
You will be passing the checkboxes as arrays ...

So you will need to access them that way on the next page

Your post field would look something like  (off the top of my head, so don't
quote me): 

 

Array
(
[selected_fid] =>
[0] => apples
[1] => oranges
[2] => bananas
) 


This assumes that the user selected all the results.  If for instances they
did not (say they checked apples and bananas), then your post array would
look like :
Array
(
[selected_fid] =>
[0] => apples
[1] => bananas
) 


The array will automatically increment starting at zero.  However, you can
prefill the array with specific information, in case you need to know which
boxes where checked and which were not...

 

There is no reason to do this with hardcode values, but if you were
accessing information from a database, and dynamically creating a series of
checkboxes, then it would be more useful to preload the array with the id
from the database rather then let it auto increment.

Hope you find this useful.


I would suggest for your reading enjoyment :

http://php.net/array

http://us.php.net/manual/en/reserved.variables.php  // specifically the
section on $_POST



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Rob Gould <[EMAIL PROTECTED]>
> Date: Thu, 06 Dec 2007 22:12:22 -0800
> To: 
> Subject: [PHP] How to handle rows of checkboxes upon form submit?
> 
> Let's say I have a PHP script which lists a series of objects for sale at a
> yard sale, each with a checkbox to the left of the name of the item.
> 
> If I wanted to have a submit button, and run through the list of items that
> were checked and act on them, how would I do that?
> 
> To gain some knowledge, I went into phpMyAdmin and looked at their checkboxes,
> and I see their code:
> 
>  name="selected_fld[]">
>  name="selected_fld[]">
>  name="selected_fld[]">
> 
> 
> So it looks like they do something with name="select_fld[]", which must be
> part of the secret to making this work.
> 
> Any advice is greatly appreciated.
> 
> -- 
> 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] Generating Random Numbers with Normal Distribution

2007-12-10 Thread Stephen Johnson
True randomization is only really possible in nature, so I am not sure you
ever be completely happy with programming random numbers... But it may help
you get better results if you include srand() in your randomization code.


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: AmirBehzad Eslami <[EMAIL PROTECTED]>
> Date: Mon, 10 Dec 2007 22:58:36 +0330
> To: PHP General list 
> Subject: [PHP] Generating Random Numbers with Normal Distribution
> 
> Dear list,
> 
> For some computer-based simulation, i need to
> generate random numbers that have a normal distribution.
> 
> It seems that PHP's rand() and mt_rand() functions return
> uniformly distributed numbers which is not suitable for
> simulation purposes.
> 
> Is there any way to generate random numbers with
> normal distribution in PHP?
> 
> Thanks in advance
> -abe
> 
> -- 
> 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] Generating Random Numbers with Normal Distribution

2007-12-10 Thread Stephen Johnson
LOL..

Guess I need to keep up with the change log a little better...


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Nathan Nobbe <[EMAIL PROTECTED]>
> Date: Mon, 10 Dec 2007 14:40:36 -0500
> To: Stephen Johnson <[EMAIL PROTECTED]>
> Cc: AmirBehzad Eslami <[EMAIL PROTECTED]>, PHP General list
> 
> Subject: Re: [PHP] Generating Random Numbers with Normal Distribution
> 
> On Dec 10, 2007 2:37 PM, Stephen Johnson <[EMAIL PROTECTED]> wrote:
> 
>> True randomization is only really possible in nature, so I am not sure you
>> ever be completely happy with programming random numbers... But it may
>> help
>> you get better results if you include srand() in your randomization code.
> 
> 
> the seeding methods have been deprecated; this from the manual:
> 
> *Note*: As of PHP 4.2.0, there is no need to seed the random number
> generator with srand() <http://us3.php.net/manual/en/function.srand.php> or
> mt_srand() <http://us3.php.net/manual/en/function.mt-srand.php> as this is
> now done automatically.
> 
> -nathan

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



Re: [PHP] Generating Random Numbers with Normal Distribution

2007-12-10 Thread Stephen Johnson
Wow... You clearly put a lot of thought into randomization...  I am
impressed..LOL 

Personally, most of my web applications do not have to factor 13.7 billion
years of space drift in to the calculations, so php's rand function has been
great for me... ;) 

--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Robert Cummings <[EMAIL PROTECTED]>
> Organization: InterJinn
> Date: Mon, 10 Dec 2007 14:46:47 -0500
> To: Stephen Johnson <[EMAIL PROTECTED]>
> Cc: AmirBehzad Eslami <[EMAIL PROTECTED]>, PHP General list
> 
> Subject: Re: [PHP] Generating Random Numbers with Normal Distribution
> 
> 
> Can you say for certain nature is truly random? Just because the seed
> may have occurred 13.7 billion years ago and we don't know what that
> initial state was and we couldn't possibly calculate all the
> interactions since, doesn't mean that everything since hasn't been
> happening in accordance with some universal formula and in absence of
> randomness. We know that there appear to be certain laws in physics,
> would they not have applied to that initial state in a non random
> manner? It may just be that due to the hugantic sample space from which
> to draw arbitrary values that we think things are random.
> 
> Food for thought :)

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



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Stephen Johnson


On 12/11/07 6:02 PM, "Chris" <[EMAIL PROTECTED]> wrote:

> Jochem Maas wrote:
>> Chris wrote:
>>> Dan wrote:
>>>> First off I must ask, why do you need to run windows commands when you
>>>> don't even know how to use a PHP function.
>>> That's a pretty extreme response -
>> 
>> maybe he's an extreme programmer :-P
>> 
>>> maybe the OP forgot the function name
>>> or didn't know it in the first place.
>>> 
>>> There is a lot of stuff in php and there's no way anyone will remember
>>> every part of it.
>> 
>> let's not forget the place you learned the command in the first place?!?!
>> 
>> manual meet the new guy, new guy meet the manual -
>> may you have many beautiful children together.
> 
> Doesn't help if you don't know what to look for in the first place :)
> 
> I'm all for rtfm type responses but if you're not sure what category to
> start looking in how does it help? Don't tell me you'd scan the 189
> categories for lack of a better term (taken from
> http://www.php.net/manual/en/funcref.php) to look for a particular fn
> that you don't know the name of let alone which area it belongs in.

OK then how about a STFW answer...

Google : php exexcute windows commands

You can even hit the "I'm feeling lucky button." ;)

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Assign variable to a block of html code

2007-12-19 Thread Stephen Johnson
What you have will work, you just need to escape out the double quotes in
the html.  




On 12/19/07 7:38 PM, "php mail" <[EMAIL PROTECTED]> wrote:

> Hi All,
> 
> Is it possible to assign variable to a block of html code ?
> 
> Something like this :
> 
> $myblokvar = "
> 
>   
> 
>   
>  height="30" />
>  
>   
>   
>  cellspacing="2">
>   
> 
> 
> 
>   
>   
>  
>   
>   
>  
>  
>   
> 
>   
> 
> ";
> 
> Although example above is not working, what I want to achieve is something
> like that. Is it possible how can I do that ?
> 
> Regards,
> 
> Feris

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Why I sart getting "Fatal error: Allowed memory size..." after php upgrade?

2007-12-20 Thread Stephen Johnson
It sounds to me like the "allowed memory size" went back to the default
after they upgraded php.

I usually have to update some of my config files after an upgrade.  Nothing
seems strange to me here... But maybe I am missing something.


> I'm going to edit php.ini though what if "client" doesn't have a clue
> what's php.ini or how to do it?

Your clients shouldn't have a clue about the php.ini file, nor should they
ever have to worry about it.  However, I assume you mean the clients of the
hosting company, which would be you.  It is my opinion that you, as a PHP
developer, have a responsibility to understand what the php.ini file is,
what it does, and how to change it if necessary and you should have this
knowledge before you begin writing code that would be used by anyone but
yourself.



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: afan pasalic <[EMAIL PROTECTED]>
> Date: Thu, 20 Dec 2007 12:37:07 -0500
> To: php-general 
> Subject: [PHP] Why I sart getting "Fatal error: Allowed memory size..." after
> php upgrade?
> 
> The hosting company I have one account (and several Add Domains)
> upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I
> start getting the error message:
> Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
> allocate 122880 bytes) in...
> on domains they use Gallery2 or are CMS (Joomla or Drupal) based.
> 
> I contacted Tech. Support (Live Chat) and he told me I have to edit
> memory limit in php.ini (for each domain).
> 
> I asked him why it started so suddenly, did upgrade caused the problem
> and I got as an answer: "Your scripts have begun to use more memory.
> That would be the only reason for this error."
> It doesn't make a sense to me and sounds like "let's blame something
> else" type of answer.
> 
> I'm going to edit php.ini though what if "client" doesn't have a clue
> what's php.ini or how to do it?
> 
> I would like to hear your opinion what caused the problem.
> I'll edit php.ini, I'm not going to make a big deal of it, though, I
> just want to know why it happened.
> 
> Thanks for help.
> 
> -afan
> 
> -- 
> 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] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Stephen Johnson


> From: Jason Pruim <[EMAIL PROTECTED]>
> Date: Tue, 8 Jan 2008 13:18:40 -0500
> To: Jack Mays <[EMAIL PROTECTED]>
> Cc: php-general General List 
> Subject: Re: [PHP] New years resolution: To get serious with my programming!
> Anyone wanna help? :)
> 
> 
> 
> Actually, the problem isn't the query... the query works fine. What I
> want is for if it doesn't work, I want it to tell the user that it
> didn't work.
> 
> Right now I'm just blindly accepting that the insert succeeded, and I
> want to get away from that! :)
> 
> Does that explain it a little better?

If you are simply wanting to do a check on whether the insert was successful
or not, then grab the id form the insert and check to see if it is there...

$success = mysql_insert_id();

If(!$success){ 
   echo "no joy.. Insert failed.";
} 

Because mysql_insert_id() acts on the last performed query, be sure to call
mysql_insert_id() immediately after the query that generates the value.


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--

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



Re: [PHP] checking for and enforcing https

2008-02-25 Thread Stephen Johnson
> Or you can cheat...
> 
>  $url = $_SERVER['SERVER_NAME'];
>  header( 'Location:https://'.$url.'');
> 
> 

I think that would cause an infinite loop of redirection...

This would be better

https://www.domain.com$pageTo";);
   exit;
}
?> 


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Wolf <[EMAIL PROTECTED]>
> Date: Mon, 25 Feb 2008 13:55:41 -0500
> To: Rick Pasotto <[EMAIL PROTECTED]>
> Cc: 
> Subject: Re: [PHP] checking for and enforcing https
> 
> 
>  Rick Pasotto <[EMAIL PROTECTED]> wrote:
>> What is the best or recomended proceedure for making sure that a page is
>> accessed only via a secure connection?
>> 
> 
> Make the server only send over 443 instead of 80...
> 
> But if you don't have the ability to change .htaccess or httpd.conf then you
> can use the $SERVER variables and make them work that way...
> 

> Wolf
> 
> -- 
> 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] checking for and enforcing https

2008-02-25 Thread Stephen Johnson
OK.. I was referring to the lack of if checking on your post.. But I  should
have assumed that you did it that way.

As long as your validating whether you are secure before you try and go
secure is what I was getting at.

Also, I agree on odd usage of port numbers, most of my stuff runs on
standard ports, so I have never had any issues on that front.
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Wolf <[EMAIL PROTECTED]>
> Date: Mon, 25 Feb 2008 14:26:12 -0500
> To: Stephen Johnson <[EMAIL PROTECTED]>
> Cc: Rick Pasotto <[EMAIL PROTECTED]>, 
> Subject: Re: [PHP] checking for and enforcing https
> 
> Nope, it works like a charm for me, but I have it in an IF statement checking
> to see if the requestor is https or not to begin with.
> 
> I actually have it called as a function that passes in the rest of the path of
> the file that is being requested, which is called within an included page,
> which is included via a function call in a page that is automagically
> pre-pended to every page on the site.
> 
> And it works like a charm no matter where you are trying to hit it or how many
> sites/links you move in an out of.
> 
> Wolf

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



Re: [PHP] Are these Truthful Proof about PHP ??

2008-02-27 Thread Stephen Johnson
> I thought ASP was the language and .NET was the framework.

I was under this impression as well..  I always equated .NET to ASP the same
way I would ZEND to PHP...


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Robert Cummings <[EMAIL PROTECTED]>
> Organization: InterJinn
> Date: Wed, 27 Feb 2008 15:12:12 -0500
> To: Greg Donald <[EMAIL PROTECTED]>
> Cc: 
> Subject: Re: [PHP] Are these Truthful Proof about PHP ??
> 
> 
> 
> I thought ASP was the language and .NET was the framework. Maybe I'm
> wrong, but I pointed out that glaring issue when I mentioned GD and
> ImageMagick versus the .NET image lib. And the target of my *lol* was
> the whole question of comparison... the outdated document, the obvious
> ugliness of ASP code, the FUD, etc, etc.
> 
> So is ASP really a framework? Did I get that wrong... I'm not always
> right you know, especially about MS crap.
> 
> Thanks for letting me know I'm predictable BTW, I wouldn't want to
> surprise.

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



Re: [PHP] Guidance

2008-02-27 Thread Stephen Johnson
This is AWESOME!... I am so saving this post for my next Review...

Couldn't have said it better Dan...
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Daniel Brown <[EMAIL PROTECTED]>
> Date: Wed, 27 Feb 2008 15:59:31 -0500
> To: Matty Sarro <[EMAIL PROTECTED]>
> Cc: Stut <[EMAIL PROTECTED]>, 
> Subject: Re: [PHP] Guidance
> 
>  It is.  And in my opinion, web developers - specifically
> PHP-on-*nix developers - are cream-of-the-crop programmers.  Not to
> toot my own horn.
> 
> We know - and are not afraid to use - the following technologies,
> and employ them on a daily basis:
> * PHP (and usually at least a working knowledge of C/C++ and
> some others)
> * HTML
> * JavaScript
> * AJAX
> * Web design
> * Human Interface/Graphical User Interface (GUI) layout and design
> * SQL (specifically MySQL, but many also know PostgreSQL,
> INNODB, Sybase, etc.)
> * *nix architecture and path structure (usually many flavors:
> RHEL, Debian, BSD, Sun, Mac)
> * Shell scripting (BASh, tcl, Expect, AppleScript, Korn, and so forth)
> * HTTP (at least the fundamentals)
> * Code portability and platform-independence techniques
> * Socket programming
> * Code optimization
> * Source compilation and module installation
> * Server administration
> * A variety of control panels (cPanel, Plesk, Helm, Webmin,
> blah, blah, blah)
> * Security (SSL, encryption, obfuscation, et cetera)
> * DNS (at least the fundamentals)
> * API programming and creation
> * Interfacing with a variety of external technologies (mail,
> databases, filesystems, etc.)
> * QA and bugtracking
> * Non-RAD, non-IDE development
> * Command line programming
> *  and more
> *  and that's ON TOP of what we all know how to do on Windows.
> 
> So let this be at least a basic retort to those who don't consider
> web development "real programming."  Because you'd be surprised how
> much I hear, "oh, you work with web stuff, I thought you meant you
> were a real programmer."
> 
> Well, I'm not.  I'm an engineer.  At least according to my paycheck.  ;-P

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



Re: [PHP] Are these Truthful Proof about PHP ??

2008-02-27 Thread Stephen Johnson
Talk about a thread hijack... LOL

In my day we had to write basic going up hill in the snow... Both ways...



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Shawn McKenzie <[EMAIL PROTECTED]>
> Date: Wed, 27 Feb 2008 16:01:22 -0600
> To: 
> Subject: Re: [PHP] Are these Truthful Proof about PHP ??
> 
> Shawn McKenzie wrote:
>> Daniel Brown wrote:
>>> On Wed, Feb 27, 2008 at 4:34 PM, Shawn McKenzie <[EMAIL PROTECTED]>
>>> wrote:
>>>> Daniel Brown wrote:
>>>>> On Wed, Feb 27, 2008 at 3:46 PM, Matty Sarro <[EMAIL PROTECTED]> wrote:
>>>>>> Completely off subject, but man I miss quickbasic... that was such a fun
>>>>>>  language to program in way back-in-the-day. So simple!
>>>>> 
>>>>> Not to mention the ability to add (at the time) decent graphics to
>>>>> an application as opposed to:
>>>>> 
>>>>> 10 SCREEN 12
>>>>> 20 WINDOW (0,0) - (1000,750)
>>>>> 30 FOR N=1 TO 50
>>>>> 40 LINE (N*20,0) - (0,750-N*15)
>>>>> 50 NEXT N
>>>>> 
>>>>> 
>>>>  Maybe for you.  For me, crap...
>>>> 
>>>>  10 SCREEN 12
>>>>  15 WINDOW (0,0) - (1000,750)
>>>>  20 FOR N=1 TO 50
>>>>  30 LINE (N*20,0) - (0,750-N*15)
>>>>  40 NEXT N
>>> Not sure what you meant by "crap" when you just changed line numbers.
>>> 
>> Sorry...
>> 
>> 10 SCREEN 12
>> 20 FOR N=1 TO 50
>> 30 LINE (N*20,0) - (0,750-N*15)
>> 40 NEXT N
>> 
>> run
>> 
>> *crap*
>> 
>> 10 SCREEN 12
>> 15 WINDOW (0,0) - (1000,750)
>> 20 FOR N=1 TO 50
>> 30 LINE (N*20,0) - (0,750-N*15)
>> 40 NEXT N
> 
> Actually, if I recall correctly, I normally had to start with increments
> of 100.
> 
> -Shawn
> 
> -- 
> 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] the Y2K38 BUG

2008-05-06 Thread Stephen Johnson
Seriously If your apps are still being used in 2038 ... WOW!

This is an issue that will more then likely be well resolved LONG before
2038... 


On 5/6/08 10:50 PM, "Nathan Nobbe" <[EMAIL PROTECTED]> wrote:

> On Tue, May 6, 2008 at 10:57 PM, Paul Scott <[EMAIL PROTECTED]> wrote:
> 
>> 
>> On Wed, 2008-05-07 at 10:03 +0530, Chetan Rane wrote:
>>> Have guys heard of the the Y2K38 Bug more details are on this link
>>> 
>> 
>> Nope, but I can guess what its about.
>> 
>>> Can there be a possible solution. As the system which I am developing
>>> for my client uses Unix timestamp.
>>> 
>> 
>> There are probably multiple solutions. AFAIK time is a 32 bit signed
>> int, making it unsigned would add like 100 years onto your app.
>> 
>>> This might effect my application in the future
>>> 
>> 
>> If your app survives that long! Why not just maintain it and when times
>> change, your app changes? :)
>> 
>> Seriously, this is really not a big deal!
> 
> 
> true-that ;)
> anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> value.  so if you use it you should be good to go.
> 
> php > echo date_create('2040-10-24')->format('M-d-Y');
> Oct-24-2040
> 
> -nathan

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--



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



Re: [PHP] About Login Authentication

2007-07-20 Thread Stephen Johnson
What type of authentication are you looking to do ???

How secure, and how detailed do you want to be with it?


On 7/20/07 9:49 PM, "Kelvin Park" <[EMAIL PROTECTED]> wrote:

> What's a good place in the Internet where I could learn about creating login
> and member authentication enabled web site?
> I would appreciate any good references.

-- 
Stephen Johnson
The Lone Coder

http://www.thumbnailresume.com
*Network with your Resume, not just your card.*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Can "output_buffering" be set in a script?

2006-03-30 Thread Stephen Johnson
http://us2.php.net/ob_start

Hope this helps

http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: Todd Cary <[EMAIL PROTECTED]>
> Date: Thu, 30 Mar 2006 08:02:16 -0800
> To: 
> Subject: [PHP] Can "output_buffering" be set in a script?
> 
> I do not have access to the php.ini file and I need to have
> output_buffering turned on.  Can this be done within a script?
> 
> Thank you
> 
> -- 
> 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] PHP Post & forms

2006-04-13 Thread Stephen Johnson

On 4/13/06 7:40 PM, "Gary E. Terry" <[EMAIL PROTECTED]> wrote:

> Quite possibly a stupid question, but here goes.
>  
> I have a form that is a list of jobs. On that list is a
> checkbox. The form field is named 'changedate'.
>  
> I also have a hidden field called 'JobID'.
>  
> What I am trying to accomplish is if a checkbox is
> checked, when the form is submitted, I want all of
> the JobID's to be updated by an SQL query.
>  
> But it seems to me that $_POST will only contain
> the last JobID in the form, no matter what. Am I correct
> on this?
> 
> Is what I am trying to accomplish not possible with a
> form post?
>  
> I think I remember doing something similar with Cold Fusion
> years ago, but I have never attempted this with PHP.
>  
> Any suggestions? 

You need to pass the checkboxes as an array value with the JobID as the
identifier. 

Then on the other side, you can run through the list of JobID's and see
which ones need to be updated.

Hope this helps




-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Semi-ADVERT, OT

2008-08-20 Thread Stephen Johnson
On 8/20/08 6:57 AM, "tedd" <[EMAIL PROTECTED]> wrote:

> Seriously, I saw a new invention recently. The inventor made
> underwear with three leg holes. The idea was to rotate the underwear
> as needed.
> 
> What people won't invent.
> 
> Cheers,
> 
> tedd
> -- 

That is disturbing.


-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--



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



[PHP] Does this seem wrong to anyone else?

2008-08-20 Thread Stephen Johnson
I am debugging someone else¹s code, and this is what they have :


1055function mkdir_recursive($pathname, $mode)
1056{
1057is_dir(dirname($pathname)) ||
mkdir_recursive(dirname($pathname), $mode);
1058return is_dir($pathname) || @mkdir($pathname, $mode);
1059}

The part that bothers me is that mkdir_recursive calls itself from within
itself.  

I am not an expert on this particular type of thing, and maybe that is
allowed, but it seems wrong to me, and this error is being generated:


Fatal error: Call to undefined function mkdir_recursive() in x.php on
line 1057


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--





Re: [PHP] Does this seem wrong to anyone else?

2008-08-20 Thread Stephen Johnson
Thanks everyone ... It was a brain fart ...

Long bad day today, and I am not paying proper attention  ... :)


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--



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



Re: [PHP] CSV output.

2008-09-08 Thread Stephen Johnson
It sounds like you simply need to number format the data to ensure that PHP
does not truncate 

http://php.net/number_format


If excel, or whatever your using to view the csv file, is truncating then
you will need to properly format that cell.


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Tom Shaw <[EMAIL PROTECTED]>
> Date: Mon, 8 Sep 2008 15:53:58 -0500
> To: PHP list - not junk 
> Subject: [PHP] CSV output.
> 
> I'm outputting a bunch of numerical values for a spreadsheet to calculate
> total sales among other things on a client shopping cart. I'm running into
> problems with values that contain zeros after the decimal. If a value is
> 234.55 the value outputs fine to the CSV file but if the value is 234.00
> only 234 shows up. Is there any way to force the zeros into the spreadsheet?
> 
> 
>  
> 
> Thanks
> 
>  
> 
> Tom Shaw
> 
> [EMAIL PROTECTED]
> 



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



[PHP] Calculation assistance.. :)

2008-09-19 Thread Stephen Johnson
OK.. Math is NOT my forte ...

I am converting a site from ASP to PHP ... And this calc is in the ASP Code
: 

$nMonthlyInterest = $nRate / (12 * 100)

//' Calculate monthly payment
$nPayment = $nPrincipal * ( $nMonthlyInterest / (1 - (1 +
$nMonthlyInterest) ^ -$iMonths))

Which then gives me in PHP
0.00104167 = 1.25 / (12 * 100);
-2.170138889 = 25000 * ( 0.00104167 / (1 - (1 +
0.00104167) ^ -12)) ::

^  is the problem ...

The solution SHOULD be  2,097.47 ... Not ­2.17

Would be willing to help correct this and make it valid in PHP?


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--





Re: [PHP] Calculation assistance.. :)

2008-09-19 Thread Stephen Johnson
Right ... But that is producing even funkier results...

 doing pow( (1-(1+$nMonthlyInterest)) , ($iMonths*-1) ) ;

Gives me : 

4.2502451372964E-35 = 25000 * (0.00104167 / 6.1270975733019E+35);


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Eric Gorr <[EMAIL PROTECTED]>
> 
> I believe what you are looking is:
> 
> http://us2.php.net/manual/en/function.pow.php
> 
> number pow  ( number $base  , number $exp  )
> Returns base raised to the power of exp
> 
> 
> 
> On Sep 19, 2008, at 3:34 PM, Stephen Johnson wrote:
> 
>> OK.. Math is NOT my forte ...
>> 
>> I am converting a site from ASP to PHP ... And this calc is in the
>> ASP Code
>> :
>> 
>>$nMonthlyInterest = $nRate / (12 * 100)
>> 
>>//' Calculate monthly payment
>>$nPayment = $nPrincipal * ( $nMonthlyInterest / (1 - (1 +
>> $nMonthlyInterest) ^ -$iMonths))
>> 
>> Which then gives me in PHP
>> 0.00104167 = 1.25 / (12 * 100);
>> -2.170138889 = 25000 * ( 0.00104167 / (1 - (1 +
>> 0.00104167) ^ -12)) ::
>> 
>> ^  is the problem ...
>> 
>> The solution SHOULD be  2,097.47 ... Not ­2.17
>> 
>> Would be willing to help correct this and make it valid in PHP?
> 



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



Re: [PHP] Calculation assistance.. :)

2008-09-19 Thread Stephen Johnson
Eric ... I LOVE YOU...

Thanks 
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--




> From: Eric Gorr <[EMAIL PROTECTED]>
> Date: Fri, 19 Sep 2008 16:13:49 -0400
> To: Stephen Johnson <[EMAIL PROTECTED]>
> Cc: PHP list - not junk 
> Subject: Re: [PHP] Calculation assistance.. :)
> 
> You originally had:
> 
> $nPrincipal * ( $nMonthlyInterest / (1 - (1 + $nMonthlyInterest) ^ -
> $iMonths))
> 
> which, translate to in PHP
> 
> $nPrincipal * ( $nMonthlyInterest / (1 - pow( ( 1 +
> $nMonthlyInterest ), -$iMonths ) ) )
> 
> 
> 
> 
> On Sep 19, 2008, at 3:48 PM, Stephen Johnson wrote:
> 
>> Right ... But that is producing even funkier results...
>> 
>> doing pow( (1-(1+$nMonthlyInterest)) , ($iMonths*-1) ) ;
>> 
>> Gives me :
>> 
>> 4.2502451372964E-35 = 25000 * (0.00104167 / 6.1270975733019E
>> +35);
>> 
>> 
>>> From: Eric Gorr <[EMAIL PROTECTED]>
>>> 
>>> I believe what you are looking is:
>>> 
>>> http://us2.php.net/manual/en/function.pow.php
>>> 
>>> number pow  ( number $base  , number $exp  )
>>> Returns base raised to the power of exp
>>> 
>>> 
>>> 
>>> On Sep 19, 2008, at 3:34 PM, Stephen Johnson wrote:
>>> 
>>>> OK.. Math is NOT my forte ...
>>>> 
>>>> I am converting a site from ASP to PHP ... And this calc is in the
>>>> ASP Code
>>>> :
>>>> 
>>>>   $nMonthlyInterest = $nRate / (12 * 100)
>>>> 
>>>>   //' Calculate monthly payment
>>>>   $nPayment = $nPrincipal * ( $nMonthlyInterest / (1 - (1 +
>>>> $nMonthlyInterest) ^ -$iMonths))
>>>> 
>>>> Which then gives me in PHP
>>>> 0.00104167 = 1.25 / (12 * 100);
>>>> -2.170138889 = 25000 * ( 0.00104167 / (1 - (1 +
>>>> 0.00104167) ^ -12)) ::
>>>> 
>>>> ^  is the problem ...
>>>> 
>>>> The solution SHOULD be  2,097.47 ... Not ­2.17
>>>> 
>>>> Would be willing to help correct this and make it valid in PHP?
>>> 
>> 
>> 
> 



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



[PHP] Required files not being parsed properly...

2008-10-06 Thread Stephen Johnson
OK .. I am upgrading to PHP5 on a clients box, and  after doing so I have
run into the problem that files that get brought in by a require statement,
or include, end up just getting dumped to the browser as text..

For instance : 

require("/home/tnr/incs/tnr_db.php");
$db = new mysql();

Produces what you see here :

http://www.thumbnailresume.com/index.html?allow=1

Any one have any thoughts on what is going on?

--
Stephen Johnson c | eh
The Lone Coder

office:  562.366.4433
fax: 562.278.0133

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.fortheloveofgeeks.com
I¹m a geek and I¹m OK!
--





Re: [PHP] Required files not being parsed properly...

2008-10-07 Thread Stephen Johnson
Hey hey hey ... LOL  This is all VERY old code...I admit that...

The site needed to be closed since it was completely broken.

I figured out the reason .. The new php.ini file had the use short tags
turned off... So I turned that on and it works now.




On 10/7/08 7:32 AM, "Jim Lucas" <[EMAIL PROTECTED]> wrote:

> Eric Butera wrote:
>> On Mon, Oct 6, 2008 at 7:28 PM, Stephen Johnson
>> <[EMAIL PROTECTED]> wrote:
>>> OK .. I am upgrading to PHP5 on a clients box, and  after doing so I have
>>> run into the problem that files that get brought in by a require statement,
>>> or include, end up just getting dumped to the browser as text..
>>> 
>>> For instance :
>>> 
>>> require("/home/tnr/incs/tnr_db.php");
>>> $db = new mysql();
>>> 
>>> Produces what you see here :
>>> 
>>> http://www.thumbnailresume.com/index.html?allow=1
>>> 
>>> Any one have any thoughts on what is going on?
>>> 
>>> --
>>> Stephen Johnson c | eh
>>> The Lone Coder
>>> 
>>> office:  562.366.4433
>>> fax: 562.278.0133
>>> 
>>> http://www.thelonecoder.com
>>> continuing the struggle against bad code
>>> 
>>> http://www.fortheloveofgeeks.com
>>> I¹m a geek and I¹m OK!
>>> --
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> $user_id = $_COOKIE['user_id'];
>> 
>> $logFile = "/home/tnr/query_logs/tnr.".$user_id.".query.log";
>> 
>> uh oh...
> 
> Did you scare the OP or something?  The page isn't available any longer... :)

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--



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



[PHP] Re: [PHP-DB] Letters loop

2005-05-27 Thread Stephen Johnson
Then this is what I would suggest.

$alph = array('*', 'A', 'B','C'...etc) ;

$i=0;
Echo"";
While($alph[$i]){ 
  echo"$alph[$i]";
  $i++; 
}
Echo"";

On 5/25/05 9:54 PM, "MIGUEL ANTONIO GUIRAO AGUILAR"
<[EMAIL PROTECTED]> wrote:

> Yes, because I will create a  field within the for loop, and the
> options of the select should be letters.
> 
> --
> MIGUEL GUIRAO AGUILERA
> Logistica R8 - Telcel
> Tel: (999) 960.7994
> Cel: 9931-6
> 
> - Mensaje original -
> De: Stephen Johnson <[EMAIL PROTECTED]>
> Fecha: Miércoles, Mayo 25, 2005 9:49 pm
> Asunto: Re: [PHP-DB] Letters loop
> 
>> 
>> Why? 
>> 
>> If you need to do a loop that runs 26 times just set your high
>> value for 26.
>> 
>> Is there some reason you need to use letters ?
>> 
>> 
>> 
>> On 5/25/05 8:37 PM, "MIGUEL ANTONIO GUIRAO AGUILAR"
>> <[EMAIL PROTECTED]> wrote:
>> 
>>> Hi!!
>>> 
>>> I wanna a do a for loop with letters, Is this possible?
>>> 
>>> for ($i = 'A'; $i <= 'Z'; $i++){
>>> // code
>>> }
>>> 
>>> --
>>> MIGUEL GUIRAO AGUILERA
>>> Logistica R8 - Telcel
>>> Tel: (999) 960.7994
>>> Cel: 9931-6
>> 
>> -- 
>> Stephen Johnson
>> The Lone Coder
>> 
>> [EMAIL PROTECTED]
>> http://www.thelonecoder.com
>> 
>> *Continuing the struggle against bad code*
>> --
>> 
>> 
>> 
> 
> 

-- 
Stephen Johnson
The Lone Coder

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Concept ional question

2005-06-29 Thread Stephen Johnson
Personally I am an organization freak so I tend to do the first option -
store the images in individual folders, generally using the unique username
to create the folder itself.

That way when I need to look at a group of images/files/whatever for that
user, I can just pull up their directory.

I seriously doubt there is much of a performance hit either way, but it
would be interesting to benchmark that.

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>


> From: Thomas <[EMAIL PROTECTED]>
> Date: Wed, 29 Jun 2005 17:38:10 +0200
> To: 
> Subject: [PHP] Conceptional question
> 
> Hi there,
> 
>  
> 
> I have a conceptional question about storing images/files on a server. When
> the application gives users a possibility to store up to 20 images, would it
> be better to create a new folder for each signed-up user to store the images
> in, or use one large folder. I have done the last quite often (just renamed
> the files to the insert id) with good success.
> 
>  
> 
> Any ideas?
> 
>  
> 
> Thomas
> 

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



Re: [PHP] Conceptional question

2005-06-29 Thread Stephen Johnson

> 
> Any rough estimates what number of images would be too much?
> and does anyone think i should make folders for each user?
> Each user is limited to max 3mb of pics though...
> 
> Thanks,
> Ryan

Personally I believe it is doubtful that you would ever reach the limit
unless you where going to be getting some serious traffic.

Ultimately, though,  I think it is sound judgment to make separate folders
just for your own sanity.  Think about file storage on your own machine
sitting on your desk.  Do you take all your pictures and dump them into one
folder or do they contain some sort of organization.


Then look at your processes regarding how you access your files -- are you
storing the path in your dB ? Or do you read through the directory looking
for the file? If it is the latter then your application will suffer
performance wise searching a mass of files.

I have also been leery of overwriting another users files.  I realize that
if you use a unique identifier on the file itself you prevent this, but
mistakes can be made, and I have always felt more comfortable sending the
user to his own directory where he can do as he likes



http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

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



Re: [PHP] cannot connect to MySQL server and not sure why

2005-07-14 Thread Stephen Johnson
Where do you populate $success ?

It looks too me that $success would always be empty no matter whether you
connected or not. 




On 7/14/05 8:27 AM, "Bruce Gilbert" <[EMAIL PROTECTED]> wrote:

> mysql_pconnect ($mysql_host, $mysql_user, $mysql_password);
> if (!$success)
> 

-- 
Stephen Johnson
The Lone Coder

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] mail()

2005-08-17 Thread Stephen Johnson

Why not change the email address to be a valid one and receive through your
ISP.


On 8/17/05 11:28 AM, "George B" <[EMAIL PROTECTED]> wrote:

> Shaw, Chris - Accenture wrote:
>> 
>> yeah I can send to the SMTP server of my ISP, but no where else.
>> 
>> 
>> If you can send to the smtp server then your ISP should deliver the email.
>> 
>> If you have not filled in the sendmail_from var in the php.ini correctly,
>> they cannot send back a mail saying there was a problem with the delivery.
>> 
>> 
>> 
>> 
>> 
>> 
>> This message has been delivered to the Internet by the Revenue Internet
>> e-mail service
>> 
>> *
> Ok guys! It has sent the mail succesfully everywhere! Now one more
> thing. How do I make it so I can receive mail? I am using my ISP's POP
> server but I dosent send back because my e-mail is [EMAIL PROTECTED] How
> do I setup my own domain and does it cost money for an e-mail?

-- 
Stephen Johnson
The Lone Coder

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] how to clear cache content in IE using php

2005-08-18 Thread Stephen Johnson



On 8/18/05 9:06 PM, "Richard Lynch" <[EMAIL PROTECTED]> wrote:

> 
> Maybe if everybody did this, MS would realize how broken their
> cache-handling is and fix it... Nah.  They'd just break it even worse.


Is someone feeling a bit cynical tonight? Nah.  Not just tonight ;)


-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Error #1136

2005-08-24 Thread Stephen Johnson
Can you include the SQL statement that is creating the error?

The error basically means you are trying to put more data into the dB then
you have data cells for.

For instance : 

Good sql statement:

$sql = "insert into table (name, address, city, state, zip) VALUES ('$name',
'$address', '$city', '$state', '$zip')";

Bad SQL statement :

$sql = " insert into table (name, address, city, state, zip) VALUES
('$name', '$address', '$city', '$state', '$zip', '$phone')";

The addition of the phone variable would create an error since there is no
column to hold that data.


http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: George B <[EMAIL PROTECTED]>
> Date: Wed, 24 Aug 2005 09:42:19 -0700
> To: 
> Subject: [PHP] Error #1136
> 
> Column count doesn't match value count at row 1
> 
> What does that mean? I have an id auto_increment and it breaks everytime
>   because of that error. This has never happend before...
> 
> -- 
> 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] Automatically generated emails

2005-08-29 Thread Stephen Johnson
Ravi - 

http://www.php.net/mail

That page should get you on your way.



http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: Ravi Gogna <[EMAIL PROTECTED]>
> Reply-To: <[EMAIL PROTECTED]>
> Date: Mon, 29 Aug 2005 19:28:58 +0100
> To: Jay Blanchard <[EMAIL PROTECTED]>
> Cc: John Nichel <[EMAIL PROTECTED]>, 
> Subject: Re: [PHP] Automatically generated emails
> 
> Nice to know that newbies are well looked after on these lists. If you
> didn't wanna help, you could have not clicked reply

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



Re: [PHP] need information on sending email using php

2005-09-02 Thread Stephen Johnson
http://www.php.net/mail


On 9/2/05 12:40 PM, "Paul Goepfert" <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> I am new to php.  I am going to be setting up a page that has a form
> on it.  When the user clicks on submit an email should be sent with
> the contents of the form.  My question is How do I do that?
> 
> the webserver that I will be placing this page on has php ver 4.4.0  on it.
> 
> Any help would be appreciated
> 
> Paul

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] mixing $_POST and $_GET vars

2005-09-09 Thread Stephen Johnson
Is there any particular reason that you do not want to mix both type in
foo.php.

I have a few that mix $_SERVER , $_COOKIE, $_POST, and $_FILES.

I do not see a particular performance hit with mixing these since they are
available regardless of whether they are populated or not.




On 9/9/05 4:46 PM, "bruce" <[EMAIL PROTECTED]> wrote:

> hi..
> 
> quick question.. a basic link blah allows you to
> process the vars in foo.php using $_GET, easy/basic enough. however, if i
> have a form from cat.php that does a 'post' of the form information/input to
> the foo.php, i'm then going to have to either change the form to do a 'get'
> or else i'm going to have to do both a $_GET, and a $_POST within foo.php to
> access the vars from the pages that are interfacing with foo.php.
> 
> is there an easier/cleaner/better approach??
> 
> or do i really need/wind up doing something like
> 
> if ($_GET['foo'])...
> 
> if ($_POST['apple'])...
> 
> and just have a mix of both methods within the code...
> 
> thanks
> 
> -bruce
> [EMAIL PROTECTED]

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] searching through a mysql db/tbl

2005-09-10 Thread Stephen Johnson



On 9/10/05 3:13 PM, "bruce" <[EMAIL PROTECTED]> wrote:

> if i allow a user to search on say 'aa', i'd like the user to be able to
> get:
> 
>   name   email   foo...
>   aa [EMAIL PROTECTED] 
>   b1 [EMAIL PROTECTED]123
> 
> any ideas as to how i could go about and create the query, or what would i
> need to do to have this result...

Use like in your select statement ...

Select name, email, foo from tbl where email like '%aa%';



> 2) if i have a query that produces a number of rows, how/what would i need
> to do, to limit the number of rows displayed, and to allow the user to
> select a 'back/next' button that would generate/display the next 'N' items
> in the list/query results...
> 

Use limit in your select statement

Select * from tbl limit 10;

You can also use a start in the limit so the next button would call this
select. 

Select * from tbl limit 10, 10;

> if anybody could direct me to sample docs/code that kind of describes/solves
> what i've described, i'd appreciate it!!!

The folks on the MySQL list can help you with these questions better then
the folks here on the PHP list.



> 
> thanks
> 
> -bruce
> [EMAIL PROTECTED]

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] incrementing in a for loop

2005-09-12 Thread Stephen Johnson


On 9/12/05 12:39 PM, "Peppy" <[EMAIL PROTECTED]> wrote:

> for ($i = 1; $i <= 6; $i++) {
>Is it possible to increment $i by 5?

for ($i = 1; $i <= 6; $i+5) {


-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] incrementing in a for loop

2005-09-12 Thread Stephen Johnson
You are correct -- forgive the typo (I forgot the = ).

That is what I get trying to reply to email while eating a burrito and
talking on the phone. LOL
 
http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: "M. Sokolewicz" <[EMAIL PROTECTED]>
> Date: Mon, 12 Sep 2005 23:48:05 +0200
> To: Stephen Johnson <[EMAIL PROTECTED]>
> Cc: Peppy <[EMAIL PROTECTED]>, 
> Subject: Re: [PHP] incrementing in a for loop
> 
> 
>> 
>> 
> that won't work; have you tried it?
> Because $i++ assigns the result of $i+1 to $i, while yours does not
> assign anything to $i. This means you'll run an eternal loop ;)
> to do what you showed, you'll need to change $i+5 to $i=$i+5 or $i += 5

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



Re: [PHP] Can I call .html file as a form action instead of .php?

2005-10-03 Thread Stephen Johnson
This should work fine -- more then likely you do not have your apache (or
whatever web server you use) configured to allow .html files to be parsed as
php files. 

You will need to update your web server configuration.


On 10/3/05 6:31 AM, "MI SOOK LEE" <[EMAIL PROTECTED]> wrote:

> Hello,
> Some guy told me that I can call the .html file as a form action instead of
> ..php file.
> So he said I could do something like this,
> echo "Edit";
> 
> instead
> echo "Edit";
> 
> editStaff.html and editStaff.php have the same content, only the file name
> is different. But if I do the former way(call editStaff.html as a form
> action), it doesn't work. It calls some files but looks horrible.
> So the advice of the guy was wrong, or did I do something wrong?
> 
> Thanks,

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] 电子传单 ,最廉价的宣传方式

2005-10-13 Thread Stephen Johnson
请停止发送电子邮件到这个列表, 或我将被迫使解开一千头骆驼蚤入您的腋窝。
http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: KOKO电子传单 <[EMAIL PROTECTED]>
> Date: Fri, 14 Oct 2005 06:33:57 +0800
> To: 
> Subject: [PHP] 电子传单,最廉价的宣传方式
> 
>   南海鳄神无法可施,心想:“我既不能杀他,他又不肯求我,这就难了。”一瞥眼,见木婉清满脸关切的神
> 色,灵机一动,猛地纵身过去,抓住她后领,将她身子高高提起,反身几下跳跃,已到了崖边,左足翘起,右
> 足使招‘金鸡独立’势,在那千仞壁立的高崖上摇摇幌幌,便似要和木婉清一齐摔将下去。
>
>   手掌刚要碰到程英后心,一瞥间见她颈中系着一条锦帕,素底缎子上绣着红花绿叶,正是当年自己精
> 心绣就、赠给意中人之物,不禁一呆,倏地收回掌力,往日的柔情密意瞬息间在心中滚了几转,心想:“他
> 虽与那姓何的小贱人成亲,心下始终没忘了我,这块帕儿也一直好好放着。他求我饶他后人,却饶是不
> 饶?”一时心意难决,决定先毙了陆无双再说。拂尘抖处,银丝击向陆无双后心,阳光耀眼之下,却见她颈中
> 也系着一条锦帕,李莫愁“咦”了一声,心道:“怎地有两块帕儿?定有一块是假的。”拂尘改击为卷,裹住陆
> 无双头颈,将她倒拉转来。 

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



Re: [PHP] $_GET and $_POST arrays not working

2005-11-25 Thread Stephen Johnson
You would access them by declaring them as regular variables and then using
the regular variables in your code.

 


As a side note - please do NOT turn global variables on in your php.ini
file.  There is a good reason for why it is shut off and "good" php does not
need to have it turned on.

Hope that helps .


http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: Unknown Unknown <[EMAIL PROTECTED]>
> Date: Fri, 25 Nov 2005 17:38:02 -0500
> To: Richard Davey <[EMAIL PROTECTED]>
> Cc: 
> Subject: Re: [PHP] $_GET and $_POST arrays not working
> 
> 

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



Re: [PHP] Howto search in SQL for a specific character?

2005-11-29 Thread Stephen Johnson
Try this : 

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE  nameOfPedigree like
"'%";

The % is a wildcard and will give you the results you want.


http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: Gustav Wiberg <[EMAIL PROTECTED]>
> Organization: Gustav Wiberg
> Reply-To: Gustav Wiberg <[EMAIL PROTECTED]>
> Date: Tue, 29 Nov 2005 21:55:27 +0100
> To: PHP General 
> Subject: [PHP] Howto search in SQL for a specific character?
> 
> Hi there!
> 
> in PHP i Write..
> 
> 
> $v1 = chr(39); //39 is apostrofe
> 
> 
> $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
> SUBSTR(nameOfPedigree,0,1) = $v1";
> 
> Why doesn't this work?
> 
> I want the sql to select all nameOfPedigree - fields where the first
> character is apostrofe (')
> 
> /G
> http://www.varupiraten.se/
> 
> -- 
> 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] Could you help me to solve this problem?

2005-12-04 Thread Stephen Johnson
When you upload you also need to change the permissions on the file that you
uploaded.

chmod("/somedir/somefile", 0755)

More info : http://us3.php.net/chmod


On 12/4/05 6:35 PM, "CHEN RAN" <[EMAIL PROTECTED]> wrote:

> hi,
> 
> After uploading file to web server with php upload script in
> http://us3.php.net/features.file-upload, I can't access the file with web
> browser. I get error message as "403 Forbidden" or "You are not authorized
> to view this page".
> However, there is no such problem when i using FTP to upload files.
> 
> Please help,
> 
> Thanks a lot.
> 
> Ran

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Variable $_POST vars?

2005-12-10 Thread Stephen Johnson
On 12/10/05 9:06 PM, "The.Rock" <[EMAIL PROTECTED]> wrote:
> Is there a way to do this?
> 
> $var = $_POST["$var"];
> 
> I have a form that submits data, except the name of each input field is
> incrementing. So I need to increment the $_POST var. Any ideas?
> 
> I can't seem to get anything to work
> 
> Chris


What type of field are you using?  In these cases I have always passed the
data in an array and passed the post into an array variable which I could
then increment. 




-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



Re: [PHP] Variable $_POST vars?

2005-12-10 Thread Stephen Johnson
I would do this instead



Increment the $var with the {number} that you are using.

In the following PHP page

You would do 

$var = $_POST['item'];

$var would then be an array accessed the same way you would access it
normally.

Does that make sense.?

On 12/10/05 9:27 PM, "The.Rock" <[EMAIL PROTECTED]> wrote:

> Here is an example of one of the fields:
> 
> 
> I'm looping thru this form several times, so each time the name gets
> incremented. Do you have an example of what your talking about?

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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