php-general Digest 21 May 2005 12:53:41 -0000 Issue 3467

Topics (messages 215685 through 215695):

Re: multiple queries, one transaction
        215685 by: Richard Lynch

Re: Code to bypass a certain php.ini directive
        215686 by: Richard Lynch
        215690 by: M Saleh EG

Re: Getting parameters from the URL
        215687 by: Richard Lynch

Re: Should this not return true?!?!
        215688 by: Richard Lynch

Re: Cache Problems
        215689 by: Richard Lynch

Re: ftp_fput() "limit is 10 characters
        215691 by: Richard Lynch

Re: Image Verification - Problems in Safari, Mac OS X
        215692 by: Richard Lynch

update blues
        215693 by: Jim & Sara Feldman
        215694 by: Marek Kilimajer
        215695 by: Brian V Bonini

Administrivia:

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

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

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
On Fri, May 20, 2005 2:02 pm, mayo said:
> I have a site where I need to do multiple queries in sequence.

In sequence, or as one single atomic un-interruptable action?

Cuz, like, just doing them in sequence is real straight forward:

$query = "select ... ";
$meaningful_variable_names_are_good = mysql_query($query...
$query = "select ... ";
$another_good_variable = mysql_query($query...

> I see there is a way to do consider all querys and to fail the entire
> procedure if one query fails. It's a BEGIN and COMMIT statement.

That is called a transaction.

And it is rather hefty performance penalties on your database.

And you need your tables to be innoDB or ??? but not the default MyISAM in
MySQL.

> mysql_query("BEGIN"); // starts the transaction


Just put your queries in here.

ONLY do this if the queries succeed!
If they fail, do mysql_query("ROLLBACK");

> mysql_query("COMMIT"); // ends the transaction
>
> I'm just not certain how it's used.

It's a lot easier to do the queries (you did all the hard work already)
than it is to figure out if you REALLY need them or not...

If you can avoid the transaction, and still have quality data and quality
application, you can gain significant performance that way...

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Fri, May 20, 2005 3:06 pm, M�rio Gamito said:
> I have this server with "display_errors=Off" in php.ini
>
> Now that i'm developing a new site. is there some code i can insert in
> the begining of a .php file to set only for this file (not sitewide)
> "display_errors=On" ?

Search http://apache.org for .htaccess and use "php_value display_errors
1" in it.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Sure you can!
 ini_set("display_errors", "On");
 HTH.

 On 5/21/05, M�rio Gamito <[EMAIL PROTECTED]> wrote: 
> 
> Hi,
> 
> I have this server with "display_errors=Off" in php.ini
> 
> Now that i'm developing a new site. is there some code i can insert in
> the begining of a .php file to set only for this file (not sitewide)
> "display_errors=On" ?
> 
> Thanking you in advance.
> 
> Warm regards,
> M�rio Gamito
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
M.Saleh.E.G
97150-4779817

--- End Message ---
--- Begin Message ---
On Fri, May 20, 2005 1:21 pm, M�rio Gamito said:
> It still doesn't works.
> Maybe it's because it's being launched from outside the site (i. e., the
> referrer is not from the site ?).

That's not it, almost for sure.

The entire Internet www would crumble if that were a common cause of the
problem :-)

> Maybe something's in php.ini ?

Maybe the EGCPS settings have no 'G' in them?

Is PHP itself working???

Put this at the top of your script:
<?php phpinfo();?>

Do you see a huge blue page with all kinds of PHP information?

If not, you don't have PHP working.

> Any ideas ?
>
> Warm Regards,
> M�rio Gamito
>
> Richard Davey wrote:
>> Hello M�rio,
>>
>> Friday, May 20, 2005, 4:48:07 PM, you wrote:
>>
>> MG>
>> http://www.bar.com/[EMAIL PROTECTED]&code=vu782
>>
>> MG> for testing, but it does print nothing. So, i'm not getting the
>> MG> parameters from the URL. I have register_globals=Off in php.ini
>>
>> MG> Why is this wrong and how to make it right ?
>>
>> Try dumping out the whole of $_GET to see if you are receiving
>> anything at all:
>>
>> <?php
>>      print_r($_GET);
>> ?>
>>
>> Best regards,
>>
>> Richard Davey
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Fri, May 20, 2005 1:53 pm, Dustin Krysak said:
> Hi there (newbie here) - I have the following snippet of code......
>
> $sexId = $_POST['sex'];
> $fName = $_POST['fName'];
> $lName = $_POST['lName'];
>
> if ($status = $db->query("INSERT INTO names (nameId, sexId, fName,
> lName) VALUES ('', $sexId, '$fName', '$lName')")) {
>       print "Your data was added to the database successfully!";
> } else {
>       print "Your data could not be added to the database!";
> }
>
> Assuming my query was successful, should it not return true and print
> the success message?

How would we know? :-)

Of the 10,000 PHP Database Abstraction classes out there, you haven't told
us which one you are using.

So there is *NO* *WAY* to tell what the query() method returns, is there?

Actually, you don't even tell us which DATABASE you are using, so while I
say MySQL below, I mean "whatever database you are using"

When it *DOES* fail, why don't you log the error message MySQL provides?
error_log(@mysql_error());

Only, most likely, the database abstraction layer you haven't told us
about has some fancy method to get that information.

> For some reason it is doing just the opposite. The data is added, but
> it displays the error instead.

Then, most likely, the particular database abstraction layer you have
chosen doesn't work the same way as mysql_query().  So you have to adjust
your code to work with the API of that database abstraction layer, which
we can't possibly begin to tell you how to do, since we don't know what
database abstraction software you are using.

> Am I misunderstanding something?

Definitely how to ask a good question :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Fri, May 20, 2005 12:11 pm, Rahul S. Johari said:
> My whole Auto-Image verification application and has come to get stuck at
> the Cache in IE. It�s working fine in Safari on Mac, but IE is picking up
> the image from the Cache no matter what. I�ve tried the following:

Are you clearing out the cache after you add these headers?

Cuz, like, if it gets IN the cache, the new headers you send don't count,
cuz it never asks for them.

> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

Send something in the past, but not that far...  It might decide to ignore
you if you lie that much.

> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Cache-Control: post-check=0, pre-check=0", false);

I think having too many of these is going to mess you up...

> header("Pragma: no-cache");
>
> Which I understood is to tell the browser not to load the page or it�s
> images from the Cache.. But it still does. Nothing is working out. I don�t
> know how to get that page to load fresh from the server and not IE�s cache
> so it won�t display the same Image over and over.

If you really want to guaranteee no cahing in all browsers for all time,
the random URL is the way to go.  It's a shame that browsers will ignore
the caching headers, but since they do, I don't feel guilty making them
suck down more images then they should.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Fri, May 20, 2005 7:31 am, mayo said:
> I'm trying to ftp a file. I looked in the php manual and I don't see a
> character limit for ftp_fput().
> I'm getting the following error
>
> ftp_fput(): Specified object name too long, limit is 10 characters:
> CF-20050520. in /home/www/cf/test.php on line 45
> There was a problem while uploading CF-20050520.txt

That's because it's your FTP server imposing that limit, not PHP, not FTP
in general, just that server.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Thu, May 19, 2005 6:05 am, Rahul S. Johari said:
> I did actually remove the Header which declared it as a Image/PNG and
> everything seemed to work in both the browsers.

Great.  Now it works in 2 browsers, and breaks in 237.

You MUST separate the two.

Period.

> Here's my situation though... I can't separate out these two files because
> when a user is on the verification page, where the Image exists, in case
> he
> "reloads" or "refreshes" the page, a new image should be generated and
> displayed, so that the verification code is different each time you reach
> the verification page. If I was to keep the image code in a different
> page,
> the verification page will pick up the same PNG image and display the same
> security code over and over without changing it.

So you need some kind of "secret token" buried in the HTML which you can
decode in the image and in their submit to see if they actually used human
eyeballs to see the image.

There are dozens of scripts out there that do this -- Perhaps you should
review them to see how they work.

The simplest solution I know of is to make up a random string and store it
in an SQL table with the word in the image.

http://php.net/uniquid http://php.net/md5 etc.

-- 
Like Music?
http://l-i-e.com/artists.htm

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

I have a partially finished app using PHP and MySQL that runs on Mac G4 running System 10.3.9. Undoubtedly, I upgraded too many things all at the same time. Something broke. PHP and MySQL are both running. I can use the latest phpMyADMIN and everything is there in the database, so that should check both PHP and MySQL. Here are the changes in hardware and software:

                New             Old

Mac             G5              G4
System          Tiger (10.4)    10.3.9
PHP             4.3.10          4.3.4
MySQL           4.1.11          4.0.17
myAdmin 2.6.2           2.5.4

When I run the app, I get the login page with no difficulty, but that takes me back to the page member.php which attempts to start a session and then from there to check the validity of the login by comparing the login variables to those stored in the database. The attempt to use session_start(); now gets me the the following two warnings:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) in /Library/WebServer/Documents/testit/Logsafe_project/member.php on line 14

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) in /Library/WebServer/Documents/testit/Logsafe_project/member.php on line 14

No cookie is created, so it is not obvious why it is complaining. I suspect something in the apache script for starting php. Can anyone suggest a good place to look?

Jim
--
Jim Feldman
14 Linda Lane
Newton, MA 02461

617-527-0509

--- End Message ---
--- Begin Message ---
Jim & Sara Feldman wrote:
Hi:

I have a partially finished app using PHP and MySQL that runs on Mac G4 running System 10.3.9. Undoubtedly, I upgraded too many things all at the same time. Something broke. PHP and MySQL are both running. I can use the latest phpMyADMIN and everything is there in the database, so that should check both PHP and MySQL. Here are the changes in hardware and software:

        New        Old

Mac        G5        G4
System        Tiger (10.4)    10.3.9
PHP        4.3.10        4.3.4
MySQL        4.1.11        4.0.17
myAdmin    2.6.2        2.5.4

When I run the app, I get the login page with no difficulty, but that takes me back to the page member.php which attempts to start a session and then from there to check the validity of the login by comparing the login variables to those stored in the database. The attempt to use session_start(); now gets me the the following two warnings:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) in /Library/WebServer/Documents/testit/Logsafe_project/member.php on line 14

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) in /Library/WebServer/Documents/testit/Logsafe_project/member.php on line 14

No cookie is created, so it is not obvious why it is complaining. I suspect something in the apache script for starting php. Can anyone suggest a good place to look?

It seems php configuration changed with the upgrade. Your old one had output_buffering turned on in php.ini.

Instead of turning it back on you should fix your app, open /Library/WebServer/Documents/testit/Logsafe_project/db_fns.php, go to line 212, something's outputting there something (echo, print, anything outside <?php ?>), maybe even a whitespace character.
--- End Message ---
--- Begin Message ---
On Fri, 2005-05-20 at 23:54, Jim & Sara Feldman wrote:
> Warning: session_start(): Cannot send session cookie - headers 
> already sent by (output started at 
> /Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) 
> in /Library/WebServer/Documents/testit/Logsafe_project/member.php on 
> line 14
> 
> Warning: session_start(): Cannot send session cache limiter - headers 
> already sent (output started at 
> /Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) 
> in /Library/WebServer/Documents/testit/Logsafe_project/member.php on 
> line 14

What's the first 20 lines of member.php look like? And what's at line
212 +/- in db_fns.php




-- 

s/:-[(/]/:-)/g


Brian        GnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
======================================================================
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

--- End Message ---

Reply via email to