php-general Digest 4 Jul 2006 13:13:27 -0000 Issue 4221

Topics (messages 239105 through 239117):

running multiple updates on a single line
        239105 by: Ryan A
        239106 by: Chris
        239107 by: João Cândido de Souza Neto
        239108 by: Robert Cummings
        239115 by: Ryan A
        239117 by: Ryan A

PHP sessions possibly eating up inodes
        239109 by: Dave M G

READING LDIF FILES
        239110 by: Juanjo Pascual
        239114 by: Chris

Re: WebDav via PHP
        239111 by: Martin Staiger
        239112 by: Martin Staiger

Re: Quick Question re: Windows/Linux PHP]
        239113 by: Jochem Maas

Bitwise operators and check if an bit is NOT within the flag.
        239116 by: Mathijs

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 ---
Hi,
in phpmyadmin, in the SQL part where you can write a
query if I have a double update such as this:


it works without a problem as I am ending each sql
statement with a simicolon, but in my scripts when I
try to run multiple updates in a single line 

eg:
$xyz="update xyz set id=1 where id=0;update xyz set
id=3 where id=2;";


it does not work... any idea why?

Thanks!
Ryan


------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
Ryan A wrote:
Hi,
in phpmyadmin, in the SQL part where you can write a
query if I have a double update such as this:


it works without a problem as I am ending each sql
statement with a simicolon, but in my scripts when I
try to run multiple updates in a single line
eg:
$xyz="update xyz set id=1 where id=0;update xyz set
id=3 where id=2;";


it does not work... any idea why?

try a newline between the queries then phpmyadmin will see them as separate queries and run them properly.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Could any of these lines cousing an error?

"Ryan A" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> Hi,
> in phpmyadmin, in the SQL part where you can write a
> query if I have a double update such as this:
>
>
> it works without a problem as I am ending each sql
> statement with a simicolon, but in my scripts when I
> try to run multiple updates in a single line
>
> eg:
> $xyz="update xyz set id=1 where id=0;update xyz set
> id=3 where id=2;";
>
>
> it does not work... any idea why?
>
> Thanks!
> Ryan
>
>
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
On Mon, 2006-07-03 at 22:47, João Cândido de Souza Neto wrote:
> Could any of these lines cousing an error?
> 
> "Ryan A" <[EMAIL PROTECTED]> escreveu na mensagem 
> news:[EMAIL PROTECTED]
> > Hi,
> > in phpmyadmin, in the SQL part where you can write a
> > query if I have a double update such as this:
> >
> >
> > it works without a problem as I am ending each sql
> > statement with a simicolon, but in my scripts when I
> > try to run multiple updates in a single line
> >
> > eg:
> > $xyz="update xyz set id=1 where id=0;update xyz set
> > id=3 where id=2;";
> >
> >
> > it does not work... any idea why?

RTFM :) -- mysql_query()


-- 
.------------------------------------------------------------.
| 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 ---

--- Chris <[EMAIL PROTECTED]> wrote:

> Ryan A wrote:
> > Hi,
> > in phpmyadmin, in the SQL part where you can write
> a
> > query if I have a double update such as this:
> > 
> > 
> > it works without a problem as I am ending each sql
> > statement with a simicolon, but in my scripts when
> I
> > try to run multiple updates in a single line 
> > 
> > eg:
> > $xyz="update xyz set id=1 where id=0;update xyz
> set
> > id=3 where id=2;";
> > 
> > 
> > it does not work... any idea why?


-->Chris 
> try a newline between the queries then phpmyadmin
> will see them as 
> separate queries and run them properly.

@Chris, 
Tried that... no joy.


-->João
> Could any of these lines cousing an error?

@João, nope, I broke them down to different
statements , put them into an array and ran them in a
for() loop and it works perfectly... problem is,
sometimes I have to run upto 15 updates at a time,
would be great if I can run that in one statement.

--> Robert
> RTFM :) -- mysql_query()

Ok, read it, again.... what am I missing?
I took out the semicolon from the end... then I get an
error.
I did find one user post saying that this runs just
one query at a time...but if thats the case how is
PHPMyAdmin running multiple statements that are
seperated by a semicolon?

Thanks!
Ryan
 


------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
> >>RTFM :) -- mysql_query()
> > 
> > 
> > Ok, read it, again.... what am I missing?
> > I took out the semicolon from the end... then I
> get an
> > error.
> > I did find one user post saying that this runs
> just
> > one query at a time...but if thats the case how is
> > PHPMyAdmin running multiple statements that are
> > seperated by a semicolon?
> > 



> because it manually splits them on the semicolon and
> runs each one 
> trough mysql_query separately.


Aha.... ok, then I guess me running them in a for()
loop is the right way.

Thanks!
 


------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- End Message ---
--- Begin Message ---
PHP List,

Recently, my web hosting server has been maxing out it's alloted hard drive space. It turns out that there are no single large files, but that I have been maxing out my inode usage. Not being a Unix expert, I have a limited understanding of inodes, but it seems they are related to files and, essentially, more files being written to by active process creates more inodes.

I've eliminated log files and email spools as possible causes, and now I think the next most likely cause is PHP sessions not being properly cleared.

This was suggested to me by my web hosting services support staff. It seems likely because a lot of PHP code that I wrote while early in the process of learning PHP is still in use, and so it is easy to believe that I had not properly cleared sessions.

Actually, I thought sessions timed out and cleared automatically, so I erroneously haven't set up any specific cache clearing protocols.

Anyway, I have now begun adding the following code to my scripts:
   $_SESSION = array();
   session_unset();
   session_destroy();

But, it seems that inodes related to earlier, not properly destroyed sessions might still be lingering.

Is there a way I can:

1. Verify that sessions are in fact the cause of inodes being created?

2. Destroy them?

Thank you for any advice.

--
Dave M G

--- End Message ---
--- Begin Message ---
Hey all,

how can I read LDIF files using PHP??

--- End Message ---
--- Begin Message ---
how can I read LDIF files using PHP??

http://www.php.net/file_get_contents
http://www.php.net/fopen

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
I looked up the documentation and did find the same useless hint which you 
are referring to.

No explanation.
No example.


""Richard Lynch"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
> Did you search on php.net using "online documentation" in the popup menu?
>
> Did you find "WebDAV" in this page:
>
> http://us3.php.net/manual/en/ini.core.php
>
> You now know as much about this PHP/WebDAV thingie a I do... :-)
>
> On Sat, July 1, 2006 1:10 pm, Martin Staiger wrote:
>> Dear group,
>>
>> Apache's WebDav-features do not fulfill our requirements concerning
>> file-management since we have to manage complex access-rights to files
>> by
>> our own logic. HOW can we create our own WebDav-Server with PHP ? Are
>> there
>> any alternatives? I couldn't find any examples so far ...
>>
>> Thankful for any useful hint,
>> Marc
>>
>> --
>> 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 ---
I looked up the documentation and did find the same useless hint which you
are referring to.

No explanation.
No example.


""Richard Lynch"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Did you search on php.net using "online documentation" in the popup menu?
>
> Did you find "WebDAV" in this page:
>
> http://us3.php.net/manual/en/ini.core.php
>
> You now know as much about this PHP/WebDAV thingie a I do... :-)
>
> On Sat, July 1, 2006 1:10 pm, Martin Staiger wrote:
>> Dear group,
>>
>> Apache's WebDav-features do not fulfill our requirements concerning
>> file-management since we have to manage complex access-rights to files
>> by
>> our own logic. HOW can we create our own WebDav-Server with PHP ? Are
>> there
>> any alternatives? I couldn't find any examples so far ...
>>
>> Thankful for any useful hint,
>> Marc
>>
>> --
>> 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 ---
but what would I do with my life once I 'got it'?

-------- Original Message --------

It would be nice if you read some of my other threads regarding PHP5 before
opening your mouth and saying something stupid. People like you are the
reason why I don't post very often to these lists. I would rather struggle
for days with it than listen to some halfwit like you who's got nothing
better to do. Get a life moron.



-----Original Message-----
From: Jochem Maas [mailto:[EMAIL PROTECTED]
Sent: July 1, 2006 6:41 AM
To: Beauford
Cc: php-general@lists.php.net
Subject: Re: [PHP] Quick Question re: Windows/Linux PHP

Beauford wrote:
> Hi,
> 
> I'm just curious, because I come across this from time to time.
> 
> Why does the code below work on Windows and not on Linux. PHP is 5.0 
> on Linux and 4.4 on Windows (still can't get 5 on Windows). The code 
> at the

what stops you from installing php5 on windows? - it's not like it's very
difficult.

> very bottom is how I got it to work on Linux. Also, why is it with the 
> same

ah yes good of you to point out which line(s) you changed.

> setup I can't call a function within a function in Linux, but can in 
> Windows. Sorry I don't have the error, but something about calling a 
> static

if your too lazy to run the code one more time to copy and paste the error
then why should anyone help you?

> function. Would this be a difference between OS's or with the 
> different versions of PHP?

it's something to do with fact that OO in php4 is a world away from OO in
php5.

> 
> Thanks
> 
> B
> 
> ---------------------------
> 
>       if (empty($subemail)) { $form->setError($field, emailnotentered); 
>               }
>               else {
>                $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"
>                        ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"
>                        ."\.([a-z]{2,}){1}$";
>                if(!eregi($regex,$subemail)){
>                   $form->setError($field, emailinvalid);
>                }
>          $subemail = stripslashes($subemail);
>               }
>               elseif(in_array(strtolower($a), $language))
$form->setError($field,
> profanity);
>               elseif(in_array(strtolower($b), $language))
$form->setError($field,
> profanity);
>               elseif(in_array(strtolower($c), $language))
$form->setError($field,
> profanity);
>         else {
>            $query = "SELECT * FROM users WHERE $subemail = 'email'";
>            $result = mysql_query($query)or $mysqlerror = mysql_error();
>            if ($mysqlerror) {
>                    $form->setError($field, tberror);
>            }
>            else {
>               $numrows = mysql_fetch_row($result);
>               if($numrows = mysql_num_rows($result)) {
>                       $form->setError($field, duplicatepassword);
>               }
>            }
>         }
> 
> ---------------------------
> 
>   $field = "email";
>   list ($a, $b, $c) = split ('[EMAIL PROTECTED]', $subemail);
>   $regex =
> "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]{1,})*\.([a-z]{2
> ,}){1}
> $";
> 
>   if (empty($subemail)) { $form->setError($field, emailnotentered);
>   }
>   elseif(!eregi($regex,$subemail)){
>             $form->setError($field, emailinvalid);
>   }
>   elseif(in_array(strtolower($a), $language)) $form->setError($field, 
> profanity);
>   elseif(in_array(strtolower($b), $language)) $form->setError($field, 
> profanity);
>   elseif(in_array(strtolower($c), $language)) $form->setError($field, 
> profanity);
>                         
>   else {   
>            $query = "SELECT * FROM users WHERE $subemail = 'email'";
>            $result = mysql_query($query)or $mysqlerror = mysql_error();
>            if ($mysqlerror) {
>                    $form->setError($field, tberror);
>                 
>            }
>            else {
>               $numrows = mysql_fetch_row($result);
>               if($numrows = mysql_num_rows($result)) {
>                       $form->setError($field, duplicatepassword);
>               }
>            }
>         }
> 

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

--- End Message ---
--- Begin Message ---
Hello there.

I am working with some bitwise Operators for validating some variables.
Now i need to know if an certain bit is NOT set and an other bit IS set.

Example.

<?php

const VALIDATE_CHECK1 = 1;
const VALIDATE_CHECK2 = 2;
const VALIDATE_CHECK3 = 4;
const VALIDATE_ALL    = 7;

//--Example 1 - This works nice.
$flag1 = self::VALIDATE_CHECK1;

//Do if VALIDATE_CHECK1 is set
if ($flag1 & self::VALIDATE_CHECK1) {
    print 'Validate 1';
}
//Do if VALIDATE_CHECK2 is set
if ($flag1 & self::VALIDATE_CHECK2) {
    print 'Validate 2';
}

//--Example 2 - I want to check if VALIDATE_CHECK3 is not set and then continue.
$flag2 = self::VALIDATE_ALL;

//Do if VALIDATE_CHECK1 is set BUT NOT when VALIDATE_CHECK3 is set.
if ($flag2 & self::VALIDATE_CHECK1 && $flag2 & ~self::VALIDATE_CHECK3) {
    print 'Only Validate 1';
}
//etc...
?>

This last example i can't seem to get to work.
I Want to only do that when for example VALIDATE_CHECK3 is not within the 
$flag2.
How can i do this?

Thx in advanced.

--- End Message ---

Reply via email to