php-general Digest 27 Jun 2006 01:15:31 -0000 Issue 4207

Topics (messages 238636 through 238673):

Re: Fatal error: Call to a member function fetchRow() on a non-object in 
C:\Xampp\xampp\htdocs...
        238636 by: Jochem Maas

Re: mysql-* versus db-* statements
        238637 by: Jochem Maas

Re: mail() returns false but e-mail is sent ?
        238638 by: Adam Zey

Re: uploading...
        238639 by: BBC
        238640 by: John Meyer
        238671 by: BBC

Strip outgoing whitespace in html
        238641 by: Christopher J. Bottaro
        238642 by: Christopher J. Bottaro
        238643 by: Adam Zey

Preventing double-clicks
        238644 by: Jay Blanchard

PHP 5, Windows, and MySQL
        238645 by: Beauford
        238647 by: Robert Cummings
        238648 by: Adam Zey
        238664 by: Tom Chubb
        238670 by: Beauford
        238673 by: João Cândido de Souza Neto

Re: Preventing double-clicks APPEARS TO WORK FINE
        238646 by: Jay Blanchard
        238653 by: John Meyer
        238657 by: Larry Garfield
        238659 by: Adam Zey
        238663 by: Jay Blanchard
        238666 by: Lester Caine
        238669 by: tedd

If statement question
        238649 by: Alex Major
        238650 by: Adam Zey
        238651 by: Martin Marques
        238652 by: Robert Cummings
        238672 by: Larry Garfield

A variable inside a variable?
        238654 by: Alex Major
        238655 by: Adam Zey
        238656 by: Brad Bonkoski
        238658 by: Jim Moseby
        238660 by: João Cândido de Souza Neto
        238661 by: tg-php.gryffyndevelopment.com
        238662 by: tg-php.gryffyndevelopment.com
        238665 by: Jochem Maas
        238667 by: João Cândido de Souza Neto

Re: templating
        238668 by: Jochem Maas

Administrivia:

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

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

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> Hello 
> 
> I am pleased if someone could explain me since is wrong the following 
> function call: ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
> $_SESSION["searchFormVars"]["offset"]+$rowCounter));
> as you will find them on the bottom of the email. By the way, fetchRow() is 
> an object from class DB(.php). However mysql_fetch_row() should have same 
> functionality but the argument resp. the identity is different. I hardly try 
> to do not mix up functionality from mysql- with db- members. 
> 
> 
> $search = ($_SESSION["searchFormVars"]["search_eb"]);
> $link = mysql_connect("localhost", "root", "040573");
>  
> mysql_select_db("knowledge", $link);
> 
> $query = setupQuery($_SESSION["searchFormVars"]["search"]);     
> 
> [EMAIL PROTECTED]($query);
> 
>         
>      
>  
>    for ( $rowCounter = 0;
>             ($rowCounter < SEARCH_ROWS) &&
>             (( $rowCounter + $_SESSION["searchFormVars"]["offset"]) <  
> mysql_num_rows($result))  && 
>                ($row = & $result->fetchRow(DB_FETCHMODE_ASSOC, 
> $_SESSION["searchFormVars"]["offset"]+$rowCounter));
>            $rowCounter++)
>       {   

$result is not an object. why not lookup in the manual what mysql_query() 
returns you?

as you have already been told: don't mix mysql_*() function called at random 
with
calls to what seem to be PEAR DB methods.

problems with PEAR should be directed to the pear specific list btw.

> 
> 
> Error message:
> Fatal error: Call to a member function fetchRow() on a non-object in 
> C:\Xampp\xampp\htdocs\www2\knowledge_db\searchnew.php on line
> 
> 
> best regards, Georg
> 

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> 

...

>>  $link = mysql_connect("localhost", "root", "040573");

what was your IP address again?

--- End Message ---
--- Begin Message ---
Leonidas Safran wrote:
Hello,

Show us the full context of the code. The example you give us will work fine 
but that doesn't tell us what's really going on in your code.

Here is the function I use to allow french special characters in the subject 
line (copied from german university tutorial 
http://www-cgi.uni-regensburg.de/~mim09509/PHP/list.phtml//www-cgi/home/mim09509/public_html/PHP/mail-quote.phtml?datei=%2Fwww-cgi%2Fhome%2Fmim09509%2Fpublic_html%2FPHP%2Fmail-quote.phtml%2Crfc822-syntax.txt):

function quote_printable($text, $max=75){
/* $text ist ein String (mit neue Zeilen drin), $max ist die max. Zielenlaenge
Ergebnis ist auch ein String, der nach rfc1521 als Content-Transfer-Encoding: 
quoted-printable verschluesselt ist.*/

 $t = explode("\n", ($text=str_replace("\r", "", $text)));
 for ($i = 0; $i < sizeof($t); $i++){
  $t1 = "";
  for ($j = 0; $j < strlen($t[$i]); $j++){
   $c = ord($t[$i][$j]);
   if ( $c < 0x20 || $c > 0x7e || $c == ord("="))
    $t1 .= sprintf("=%02X", $c);
   else $t1 .= chr($c);
  }
  while (strlen($t1) > $max+ 1){
   $tt[] = substr($t1, 0, $max)."=";
   $t1 = substr($t1, $max);
  }
  $tt[] = $t1;
 }
 return join("\r\n", $tt);
}
        
function qp_header($text){
 $quote = quote_printable($text, 255);
 if ($quote != $text)
  $quote = str_replace(" ", "_","=?ISO-8859-1?Q?" . $quote . "?=");
 return $quote;
}

So, before I enter:

$sent = mail($destination, $subject, $content, $headers);
I have:
$subject = qp_header($subject);

That's all... As said before, the e-mail is sent, but the mail() function 
returns false !


Thank you for your help

LS

And what code is checking the return value of mail()? Trust me, we've all made stupid mistakes, they're nasty little buggers that can sneak in and ruin anyone's day; best to include it since it might be relevant.

Regards, Adam.

--- End Message ---
--- Begin Message --- "Fatal error: call to a member function an o non object in /url/data.php on line 34"
and the syntax is in line 34, so what can I do..?

Please give us output of the error that mysql returns.
cheers,

BBC wrote:
hi all...
I have the problem about this syntax:

   $db->query("INSERT INTO `products`

(`code`,`size`,`description`,`material`,`ads`,`price`,`new`,`categorynr`)
   VALUES
       ('$code',
        '$size',
        '$description',
        '$material',
        '$ads',
        '$price',
        '$new',
        '$categorynr')");

the syntax above could work properly in my computer which using PHP 4.1.1
but the problem is when I publish it the server where I hosted couldn't run such syntax (server uses PHP 4.4.2
I don't know why. is any one can help me?
please tell me the right syntax...

Best Regard
-------------BBC---------------

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


--- End Message ---
--- Begin Message ---
BBC wrote:
"Fatal error: call to a member function an o non object in /url/data.php on line 34"
and the syntax is in line 34, so what can I do..?


Could you point out which line is line 34?

--- End Message ---
--- Begin Message ---
OK John....
I'm sorry if my question was not specific
- The out put error was:
    "Fatal error: call to a member function an o non object in /url/data.php
on line 34"
- And the lines are:
34.   $db->query("INSERT INTO `products`
35.
(`code`,`size`,`description`,`material`,`ads`,`price`,`new`,`categorynr`)
36.   VALUES
37.       ('$code',
38.        '$size',
39.        '$description',
40.        '$material',
41.        '$ads',
42.        '$price',
43.        '$new',
44.        '$categorynr')");

So, do you have any idea about the problem above..?
I'm wondering does any one advance have solution for it..?
                     Best Regards
============BBC===============

--- End Message ---
--- Begin Message ---
I'm wondering if there's a convenient way to globally add a final step for
apache w/php that will remove unnecessary whitespace from text/html before
it gets sent to the client. Some sort of global config like thing would be
ideal. For what it's worth we're using the smarty template engine too, but
I suppose I'd prefer a solution that doesn't depend on it. Maybe something
like another AddHandler? 

--- End Message ---
--- Begin Message ---
Opps, we just found mod_tidy.  :)

Christopher J. Bottaro wrote:

> I'm wondering if there's a convenient way to globally add a final step for
> apache w/php that will remove unnecessary whitespace from text/html before
> it gets sent to the client. Some sort of global config like thing would be
> ideal. For what it's worth we're using the smarty template engine too, but
> I suppose I'd prefer a solution that doesn't depend on it. Maybe something
> like another AddHandler?
> 

--- End Message ---
--- Begin Message ---
Christopher J. Bottaro wrote:
Opps, we just found mod_tidy.  :)

Christopher J. Bottaro wrote:

I'm wondering if there's a convenient way to globally add a final step for
apache w/php that will remove unnecessary whitespace from text/html before
it gets sent to the client. Some sort of global config like thing would be
ideal. For what it's worth we're using the smarty template engine too, but
I suppose I'd prefer a solution that doesn't depend on it. Maybe something
like another AddHandler?


Also consider mod_gzip (or mod_deflate), they will get you a LOT more space savings than mod_tidy will, and should still work with every browser made in the past decade or so ;)

From what I've seen, the CPU load induced by compression is quite small, at least on my test site that had about a quarter million pageviews (hence compressed documents) per day. Definitely worth the enormous bandwidth savings!

Regards, Adam Zey.

--- End Message ---
--- Begin Message ---
I am going to do some thinking (typing) out loud here because I need to
come up with a solution to double-clicking on a form button issue.

The steps are;

1. Fill out form
2. Click 'Submit'
3. Data gets stored (including unique data and time stamp data in this
case....which should work out well)
If the process sees the unique data and a timestamp sometime within the
last minute it should ignore the subsequent attempt.
4. A reply is returned to the user based on the first click. The data
returned to the user would be different for each click, that is why this
is so important. The first data returned is the correct data.

My confusion is in this (as I have mentioned in the past couple of
weeks, most of the confusion is as a result of a lack of rest, which
leads to not thinking clearly, which leads to me feeling ignorant); upon
the second click, where I check to see if the data has been entered and
find that it has how do I get it to return the data back to the user. I
think I see it now......let's see.....if I;

Select * from foo where data is what it is and time is within last
interval that I decide upon;

if(1 == mysql_num_rows(that query up there)){
   get that data for return to the user;
} else {
   Insert data, do calcs, return data back to user;
}

Does that look reasonable, or am I missing something?

Thanks for any insight!

--- End Message ---
--- Begin Message ---
Aside from my previous gd problems, here's another problem. It appears that
PHP5 (for Windows anyways) does not support MySQL (which in itself is
riduculous), but here's my problem. I have a script I just downloaded that
works perfectly on Linux/Apche/MySQL/PHP5, but when I run it on Windows 2000
with PHP 4.4 I get a page full of errors. Lets forget about the errors, does
anyone have any idea how to get PHP5 and MySQL to work on Windows. I have
already tried 100 different variations of things from information I found
searching out this problem, but maybe someone has a new idea.

If it were me I'd just run this site on Linux, but this is for a friend who
wants to use IIS. If your curious the errors are below.

Thanks

B

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 207

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at G:\Websites\Webtest\caalogin\include\database.php:207)
in G:\Websites\Webtest\caalogin\include\session.php on line 46

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
G:\Websites\Webtest\caalogin\include\database.php:207) in
G:\Websites\Webtest\caalogin\include\session.php on line 46

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 207

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

--- End Message ---
--- Begin Message ---
On Mon, 2006-06-26 at 13:50, Beauford wrote:
> Aside from my previous gd problems, here's another problem. It appears that
> PHP5 (for Windows anyways) does not support MySQL (which in itself is
> riduculous), but here's my problem. I have a script I just downloaded that
> works perfectly on Linux/Apche/MySQL/PHP5, but when I run it on Windows 2000
> with PHP 4.4 I get a page full of errors. Lets forget about the errors, does
> anyone have any idea how to get PHP5 and MySQL to work on Windows. I have
> already tried 100 different variations of things from information I found
> searching out this problem, but maybe someone has a new idea.
> 
> If it were me I'd just run this site on Linux, but this is for a friend who
> wants to use IIS. If your curious the errors are below.
> 
> Thanks
> 
> B
> 
> Warning: mysql_numrows(): supplied argument is not a valid MySQL result
> resource in G:\Websites\Webtest\caalogin\include\database.php on line 207


The fact that you get an invalid resource error from a mysql_xxx()
function indicates that you do indeed have a working MySQL lib. Looking
at the error further indicates that you are not passing a valid mysql
result handle to the function. Please show us the rest of the code where
you perform the query and attempt to retrieve the result. Since I see no
errors about connecting to the MySQL database, I assume that you have
that part working.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Beauford wrote:
Aside from my previous gd problems, here's another problem. It appears that
PHP5 (for Windows anyways) does not support MySQL (which in itself is
riduculous), but here's my problem. I have a script I just downloaded that
works perfectly on Linux/Apche/MySQL/PHP5, but when I run it on Windows 2000
with PHP 4.4 I get a page full of errors. Lets forget about the errors, does
anyone have any idea how to get PHP5 and MySQL to work on Windows. I have
already tried 100 different variations of things from information I found
searching out this problem, but maybe someone has a new idea.

If it were me I'd just run this site on Linux, but this is for a friend who
wants to use IIS. If your curious the errors are below.

Thanks

B

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 207

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at G:\Websites\Webtest\caalogin\include\database.php:207)
in G:\Websites\Webtest\caalogin\include\session.php on line 46

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
G:\Websites\Webtest\caalogin\include\database.php:207) in
G:\Websites\Webtest\caalogin\include\session.php on line 46

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 207

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

While it probably has nothing to do with your errors, mysql_numrows() is a deprecated alias to mysql_num_rows(), which should be used instead.

As for your problem, have you checked the PHP docs on how to install MySQL support for PHP5 on Windows?

http://www.php.net/manual/en/ref.mysql.php

Regards, Adam Zey.

--- End Message ---
--- Begin Message ---
I use apache2triad (http://apache2triad.net/) which is an AMP package with
PHP 5.
I vaguely remember the first time I installed it (on Win XP Pro though) I
got similar problems with MySQL. I uninstalled it and reinstalled as I
wasn't sure if I accidentally clicked a dialog box without reading what it
said then it worked ok.
HTH...

PS - I had GD working ok on a simple thumbnail generation script.


On 26/06/06, Beauford <[EMAIL PROTECTED]> wrote:

Aside from my previous gd problems, here's another problem. It appears
that
PHP5 (for Windows anyways) does not support MySQL (which in itself is
riduculous), but here's my problem. I have a script I just downloaded that
works perfectly on Linux/Apche/MySQL/PHP5, but when I run it on Windows
2000
with PHP 4.4 I get a page full of errors. Lets forget about the errors,
does
anyone have any idea how to get PHP5 and MySQL to work on Windows. I have
already tried 100 different variations of things from information I found
searching out this problem, but maybe someone has a new idea.

If it were me I'd just run this site on Linux, but this is for a friend
who
wants to use IIS. If your curious the errors are below.

Thanks

B

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 207

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

Warning: session_start(): Cannot send session cookie - headers already
sent
by (output started at
G:\Websites\Webtest\caalogin\include\database.php:207)
in G:\Websites\Webtest\caalogin\include\session.php on line 46

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
G:\Websites\Webtest\caalogin\include\database.php:207) in
G:\Websites\Webtest\caalogin\include\session.php on line 46

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 207

Warning: mysql_numrows(): supplied argument is not a valid MySQL result
resource in G:\Websites\Webtest\caalogin\include\database.php on line 218

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




--
Tom Chubb
[EMAIL PROTECTED]
07915 053312

--- End Message ---
--- Begin Message ---
>From what I have been reading this is a known issue with PHP5. There is
something in the php_mysql.dll which is not compatible. 

I wasted 3 hours today trying all the tips and tricks I could find, but the
bottom line is that it won't work. 

This was my reason for posting to this group to see if anyone has any ideas.

Here is one of the many links I was looking at to try and solve this. 
http://codewalkers.com/forum/index.php?action=displaythread&forum=phphelp&id
=370&realm=default

Thanks

-----Original Message-----
From: Janet Valade [mailto:[EMAIL PROTECTED] 
Sent: June 26, 2006 4:08 PM
To: Beauford
Subject: Re: [PHP] PHP 5, Windows, and MySQL

Activating MySQL in PHP 5 is pretty simple. Open the php.ini file and
uncomment the line for the extension that you want to use--php_mysql.dll or
php_mysqli.dll. Restart the web server.

Using the mysql functions is described in the php documentation. 
http://us3.php.net/manual/en/ref.mysql.php or
http://us3.php.net/manual/en/ref.mysqli.php

Janet

Beauford wrote:

> Aside from my previous gd problems, here's another problem. It appears 
> that
> PHP5 (for Windows anyways) does not support MySQL (which in itself is 
> riduculous), but here's my problem. I have a script I just downloaded 
> that works perfectly on Linux/Apche/MySQL/PHP5, but when I run it on 
> Windows 2000 with PHP 4.4 I get a page full of errors. Lets forget 
> about the errors, does anyone have any idea how to get PHP5 and MySQL 
> to work on Windows. I have already tried 100 different variations of 
> things from information I found searching out this problem, but maybe
someone has a new idea.
> 
> If it were me I'd just run this site on Linux, but this is for a 
> friend who wants to use IIS. If your curious the errors are below.
> 
> Thanks
> 
> B
> 
> Warning: mysql_numrows(): supplied argument is not a valid MySQL 
> result resource in G:\Websites\Webtest\caalogin\include\database.php 
> on line 207
> 
> Warning: mysql_numrows(): supplied argument is not a valid MySQL 
> result resource in G:\Websites\Webtest\caalogin\include\database.php 
> on line 218
> 
> Warning: session_start(): Cannot send session cookie - headers already 
> sent by (output started at 
> G:\Websites\Webtest\caalogin\include\database.php:207)
> in G:\Websites\Webtest\caalogin\include\session.php on line 46
> 
> Warning: session_start(): Cannot send session cache limiter - headers 
> already sent (output started at
> G:\Websites\Webtest\caalogin\include\database.php:207) in 
> G:\Websites\Webtest\caalogin\include\session.php on line 46
> 
> Warning: mysql_numrows(): supplied argument is not a valid MySQL 
> result resource in G:\Websites\Webtest\caalogin\include\database.php 
> on line 218
> 
> Warning: mysql_numrows(): supplied argument is not a valid MySQL 
> result resource in G:\Websites\Webtest\caalogin\include\database.php 
> on line 207
> 
> Warning: mysql_numrows(): supplied argument is not a valid MySQL 
> result resource in G:\Websites\Webtest\caalogin\include\database.php 
> on line 218
> 


--
Janet Valade -- janet.valade.com

--- End Message ---
--- Begin Message ---
I've got it running fine on my windows.

Mysql 5.0.19
PHP 5.1.4

I just activate php_mysql.dll and php_mysqli.dll.

Which versions of php and mysql are you using?

""Beauford"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:!&!AAAAAAAAAAAYAAAAAAAAAFzLTDhDwWBHpzgX5w1qDiPigAAAEAAAAJiz/[EMAIL 
PROTECTED]
> Aside from my previous gd problems, here's another problem. It appears 
> that
> PHP5 (for Windows anyways) does not support MySQL (which in itself is
> riduculous), but here's my problem. I have a script I just downloaded that
> works perfectly on Linux/Apche/MySQL/PHP5, but when I run it on Windows 
> 2000
> with PHP 4.4 I get a page full of errors. Lets forget about the errors, 
> does
> anyone have any idea how to get PHP5 and MySQL to work on Windows. I have
> already tried 100 different variations of things from information I found
> searching out this problem, but maybe someone has a new idea.
>
> If it were me I'd just run this site on Linux, but this is for a friend 
> who
> wants to use IIS. If your curious the errors are below.
>
> Thanks
>
> B
>
> Warning: mysql_numrows(): supplied argument is not a valid MySQL result
> resource in G:\Websites\Webtest\caalogin\include\database.php on line 207
>
> Warning: mysql_numrows(): supplied argument is not a valid MySQL result
> resource in G:\Websites\Webtest\caalogin\include\database.php on line 218
>
> Warning: session_start(): Cannot send session cookie - headers already 
> sent
> by (output started at 
> G:\Websites\Webtest\caalogin\include\database.php:207)
> in G:\Websites\Webtest\caalogin\include\session.php on line 46
>
> Warning: session_start(): Cannot send session cache limiter - headers
> already sent (output started at
> G:\Websites\Webtest\caalogin\include\database.php:207) in
> G:\Websites\Webtest\caalogin\include\session.php on line 46
>
> Warning: mysql_numrows(): supplied argument is not a valid MySQL result
> resource in G:\Websites\Webtest\caalogin\include\database.php on line 218
>
> Warning: mysql_numrows(): supplied argument is not a valid MySQL result
> resource in G:\Websites\Webtest\caalogin\include\database.php on line 207
>
> Warning: mysql_numrows(): supplied argument is not a valid MySQL result
> resource in G:\Websites\Webtest\caalogin\include\database.php on line 218 

--- End Message ---
--- Begin Message ---
[snip]
I am going to do some thinking (typing) out loud here because I need to
come up with a solution to double-clicking on a form button issue.
[/snip]

Because the data is contained in session variables this became an easy
issue once I logiced it out

/*
 * we have to find out if a double click occurred but we are going to
allow for a much longer time interval
 * of 30 minutes in order to make sure that the ESN can be provisioned
again, just not today.
 */
 
 $getESNDate =  "SELECT `ezESN` FROM `test`.`provision` ";
 $getESNDate .= "WHERE `updated` BETWEEN DATE_SUB(NOW(), INTERVAL 1800
SECOND) AND DATE_SUB(NOW(), INTERVAL 1 SECOND) ";
 $getESNDate .= "AND `ezESN` = '".$_POST['psESN']."' ";
 if(!($dbESNDate = mysql_query($getESNDate, $udc))){
        echo mysql_error();
        exit();
 }
 
 
 /* does it test positive for ESN within the past few minutes? */
 if(0 != mysql_num_rows($dbESNDate)){
        /* the session data is already set, so go to activation receipt
*/
        header("Location: ezActivationReceipt.php");
        exit();
 } else {
        /* process normally */
      /* lines and lines of code */
 }

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
[snip]
I am going to do some thinking (typing) out loud here because I need to
come up with a solution to double-clicking on a form button issue.
[/snip]


Isn't there a javascript method that you could use to accomplish the same thing? Either that, or on the first click, you could disable that button.


--
Online library -- http://pueblonative.110mb.com
138 books and counting.

--- End Message ---
--- Begin Message ---
On Mon, June 26, 2006 2:05 pm, John Meyer said:
> Jay Blanchard wrote:
>> [snip]
>> I am going to do some thinking (typing) out loud here because I need to
>> come up with a solution to double-clicking on a form button issue.
>> [/snip]
>>
>
> Isn't there a javascript method that you could use to accomplish the
> same thing?  Either that, or on the first click, you could disable that
> button.

That would be the Javascript method to accomplish the same thing. :-) 
It's probably more efficient than a PHP-based solution, modulo the usual
Javascript caveats (user can disable, etc.).

--Larry Garfield

--- End Message ---
--- Begin Message ---
John Meyer wrote:
Jay Blanchard wrote:
[snip]
I am going to do some thinking (typing) out loud here because I need to
come up with a solution to double-clicking on a form button issue.
[/snip]


Isn't there a javascript method that you could use to accomplish the same thing? Either that, or on the first click, you could disable that button.



JavaScript can't be used for such things, or at least it can't be relied upon. What if the user has disabled JavaScript? Or what if the user has specifically disabled the JavaScript behaviour you are relying on?

For example, some websites very wrongly try to disable right-clicking on webpages. Firefox provides an option (I'm not sure if it is enabled by default) that prevents pages from disabling right-click. So using said JavaScript code to disable right-clicks is not a valid way of preventing people from viewing page source or downloading files. The same would apply to any other security measure; it'd be just fine to use JavaScript to discourage multiple clicks, but it wouldn't solve the underlying problem; he'd still have to solve the problem on the backend.

Regards, Adam.

--- End Message ---
--- Begin Message ---
[snip]
JavaScript can't be used for such things, or at least it can't be relied

upon. What if the user has disabled JavaScript? Or what if the user has 
specifically disabled the JavaScript behaviour you are relying on?
[/snip]

Egg Zachary. That was why I wanted a PHP method. Since the SESSION data
is set for the activation receipt I do not have to query the database
again, save for the initial query to check and see if the data exists.

--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:

[snip]
JavaScript can't be used for such things, or at least it can't be relied

upon. What if the user has disabled JavaScript? Or what if the user has specifically disabled the JavaScript behaviour you are relying on?
[/snip]

Egg Zachary. That was why I wanted a PHP method. Since the SESSION data
is set for the activation receipt I do not have to query the database
again, save for the initial query to check and see if the data exists.

I found that my own problem with double click was caused by simply not updating the session flag early enough! i.e. before trying to do anything with the database connection ;)

--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
Hi gang:

I don't know who originally asked, but if you generate and use a token with a 
session, you can prevent double posting (clicking).


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

--- End Message ---
--- Begin Message ---
Hi list.
Basically, I'm still learning new things about php and I was wondering if
things inside an if statement get 'looked at' by a script if the condition
is false.
For example, would this mysql query get executed if $number = 0 ?

If ($number == 1) {
    mysql_query($blah)
}

I know that's not really valid php, but hope it gets my point across. I was
just wondering from an optimisation perspective, as I don't want sql
commands being executed when they don't need to be (unnecessary server
usage). 

Thanks in advance for your responses.
Alex.

--- End Message ---
--- Begin Message ---
Alex Major wrote:
Hi list.
Basically, I'm still learning new things about php and I was wondering if
things inside an if statement get 'looked at' by a script if the condition
is false.
For example, would this mysql query get executed if $number = 0 ?

If ($number == 1) {
    mysql_query($blah)
}

I know that's not really valid php, but hope it gets my point across. I was
just wondering from an optimisation perspective, as I don't want sql
commands being executed when they don't need to be (unnecessary server
usage).
Thanks in advance for your responses.
Alex.

Stuff inside an if statement will be compiled (So it has to be free of syntax errors and such), but it won't be executed unless the condition is true.

Regards, Adam Zey.

--- End Message ---
--- Begin Message ---
On Mon, 26 Jun 2006 19:10:59 +0100, Alex Major <[EMAIL PROTECTED]> wrote:
> Hi list.
> Basically, I'm still learning new things about php and I was wondering if
> things inside an if statement get 'looked at' by a script if the condition
> is false.
> For example, would this mysql query get executed if $number = 0 ?
> 
> If ($number == 1) {
>     mysql_query($blah)
> }

NO!

-- 
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' || 
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador, 
    del Litoral             |   Administrador
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
On Mon, 2006-06-26 at 14:10, Alex Major wrote:
> Hi list.
> Basically, I'm still learning new things about php and I was wondering if
> things inside an if statement get 'looked at' by a script if the condition
> is false.
> For example, would this mysql query get executed if $number = 0 ?
> 
> If ($number == 1) {
>     mysql_query($blah)
> }
> 
> I know that's not really valid php, but hope it gets my point across. I was
> just wondering from an optimisation perspective, as I don't want sql
> commands being executed when they don't need to be (unnecessary server
> usage). 

I can't think of any language that processes the contents of a
conditional block when the test condition fails.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Monday 26 June 2006 13:10, Alex Major wrote:
> Hi list.
> Basically, I'm still learning new things about php and I was wondering if
> things inside an if statement get 'looked at' by a script if the condition
> is false.
> For example, would this mysql query get executed if $number = 0 ?
>
> If ($number == 1) {
>     mysql_query($blah)
> }

Nope.  That's the definition of an if statement (conditional), in any 
language.  If the text fails, the contents of the block never happen.  

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Thanks for your help with my other question, heres a new one for you.

I need to nest a variable, inside another variable. For example:

$($buildingname)level

How (if at all) is this possible?

Thanks.
Alex.

--- End Message ---
--- Begin Message ---
Alex Major wrote:
Thanks for your help with my other question, heres a new one for you.

I need to nest a variable, inside another variable. For example:

$($buildingname)level

How (if at all) is this possible?

Thanks.
Alex.

Why? What are you doing that requires that that cannot be done with associative arrays? As in, what is wrong with:

$level[$buildingname]

(I'm only guessing at the correct naming scheme)

Regards, Adam.

--- End Message ---
--- Begin Message ---
This might help...
http://www.php.net/manual/en/function.array.php

-B

Alex Major wrote:

Thanks for your help with my other question, heres a new one for you.

I need to nest a variable, inside another variable. For example:

$($buildingname)level

How (if at all) is this possible?

Thanks.
Alex.


--- End Message ---
--- Begin Message ---
> 
> Thanks for your help with my other question, heres a new one for you.
> 
> I need to nest a variable, inside another variable. For example:
> 
> $($buildingname)level
> 
> How (if at all) is this possible?


http://us3.php.net/manual/en/language.variables.variable.php

JM

--- End Message ---
--- Begin Message ---
$var=1;
$var2="$var";
echo $$var2;

It´ll echo the $var´s value.

Hope it´ll help you.

"Alex Major" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> Thanks for your help with my other question, heres a new one for you.
>
> I need to nest a variable, inside another variable. For example:
>
> $($buildingname)level
>
> How (if at all) is this possible?
>
> Thanks.
> Alex. 

--- End Message ---
--- Begin Message ---
I've never found a use for it myself, but yes.. php provides for 'variable 
variables':

http://us3.php.net/manual/en/language.variables.variable.php

$a = 'varname';
$varname = 'test';

echo $$a;

> test

-TG

= = = Original message = = =

Thanks for your help with my other question, heres a new one for you.

I need to nest a variable, inside another variable. For example:

$($buildingname)level

How (if at all) is this possible?

Thanks.
Alex.


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
You were on the right track, but this isn't going to work.. for a couple 
reasons:

$var = 1; # this is fine
$var2 = "$var";  # $var2 == 1 at this point
echo $$var2; # you're going to echo $1

Putting $var in double quotes makes PHP evaluate it before assigning it to 
$var2, so you won't get $var but the value of $var (1).

If you did use single quotes, you'd get this:

$var = 1; # this is fine
$var2 = '$var';  # $var2 == '$var' (literal)
echo $$var2; # you're going to echo $$var

It seems like you might get $var2 evaluate to $var..  then with $$var have it 
evaluate to 1, but doesn't look like PHP digs that deeply.  When I ran it, I 
got NULL back.

This might be what you were aiming for:

$var = 1; # this is fine
$var2 = 'var';  # remove the $..  then you can use single or double quotes
echo $$var2; # $var == var,  $var == 1, this should output correctly

Good lesson in 'gotchas' though.

-TG

= = = Original message = = =

$var=1;
$var2="$var";
echo $$var2;

It~ll echo the $var~s value.

Hope it~ll help you.


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
Alex Major wrote:
> Thanks for your help with my other question, heres a new one for you.
> 
> I need to nest a variable, inside another variable. For example:
> 
> $($buildingname)level
> 
> How (if at all) is this possible?

it's possible but probably an array is a better solution:

$someBuildinglevel = "foo";
$buildingname = "someBuilding";

echo ${$buildingname."level"}; // outputs "foo"

now go lookup variable variables in the manual to for your penance ;-)

> 
> Thanks.
> Alex.
> 

--- End Message ---
--- Begin Message ---
Please excuse-me.

That $ was putted by mistake.

I´sorry...

<[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> You were on the right track, but this isn't going to work.. for a couple 
> reasons:
>
> $var = 1; # this is fine
> $var2 = "$var";  # $var2 == 1 at this point
> echo $$var2; # you're going to echo $1
>
> Putting $var in double quotes makes PHP evaluate it before assigning it to 
> $var2, so you won't get $var but the value of $var (1).
>
> If you did use single quotes, you'd get this:
>
> $var = 1; # this is fine
> $var2 = '$var';  # $var2 == '$var' (literal)
> echo $$var2; # you're going to echo $$var
>
> It seems like you might get $var2 evaluate to $var..  then with $$var have 
> it evaluate to 1, but doesn't look like PHP digs that deeply.  When I ran 
> it, I got NULL back.
>
> This might be what you were aiming for:
>
> $var = 1; # this is fine
> $var2 = 'var';  # remove the $..  then you can use single or double quotes
> echo $$var2; # $var == var,  $var == 1, this should output correctly
>
> Good lesson in 'gotchas' though.
>
> -TG
>
> = = = Original message = = =
>
> $var=1;
> $var2="$var";
> echo $$var2;
>
> It~ll echo the $var~s value.
>
> Hope it~ll help you.
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com. 

--- End Message ---
--- Begin Message ---
I just wanted to add that Richards technique is a good way to go.
I often use something very similar, the only difference being that I
make the head() and foot() function methods in class (an instance
of the class being created by the global include file for the given site
e.g:

class Page
{
        function Page() { /* setup page  */ }
        function head() { /* show header */ }
        function foot() { /* show footer */ }
}

I find that the class has all the benefits of the
structure Richard proposed with the added benefit (my opinion :-)
that you can store page related data in the global 'Page' object
as and when you need to and use that data when you do the output...
the net result means you may probably end up polluting the global
space with less variables.

Richard Lynch wrote:
> On Thu, June 22, 2006 6:10 am, Ryan A wrote:
>> He just needs maybe 5 template
>> pages, same pages, different color.
> 
> For something THIS simple, I truly believe you are Better Off (tm)
> with a simple head() and foot() function in a globals.inc file:
> 
> function head($title = "My Site", $bgcolor = '#ffffff'){
> ?>
> <!DOCTYPE ...>
> <html>
>   <head>
>     <title><?php echo $title?></title>
>   </head>
>   <body bgcolor="<?php echo $bgcolor?>">
> <?php
>   }
> 
>   function foot(){
> ?>
>   </body>
> </html>
> <?php
>   }
> ?>
> 
> Your header and footer are now in one "template-like" file which makes
> it easy to match up tags.
> 
> And the 5 pages will look like:
> 
> <?php
>   require 'globals.inc';
> 
>   head('Page One', '#fcfcfc');
> ?>
> <p>Page One specific content here</p>
> <?php
>   foot();
> ?>
> 
> 
> The reason I prefer this to header/footer includes, is that it's too
> easy to mess up closing tags in footer/header out of sync with
> separate files, but with one file, they're right there and a decent
> HTML editor will pick them out for you.
> 

--- End Message ---

Reply via email to