php-general Digest 23 Aug 2003 18:07:47 -0000 Issue 2254

Topics (messages 160483 through 160517):

Status Chaing Toggle / Code
        160483 by: Tony Pagliocco
        160492 by: Robert Cummings

Re: Making a cookie never expire
        160484 by: Joe Pemberton

Re: auto_prepend_file
        160485 by: Peter James

Re: google style paginating
        160486 by: Mika Tuupola
        160487 by: Haseeb

Re: Clean Up the sand box time
        160488 by: Nicholas Robinson

Re: text area question
        160489 by: Marek Kilimajer

Re: need help figuring out how to delete rows?
        160490 by: Marek Kilimajer
        160491 by: Marek Kilimajer

Re: Access denied problem, please help
        160493 by: Ryan A
        160505 by: Jim Lucas

Uploading problem = weird warning (was: access denied problem.....)
        160494 by: Ryan A

2 questions
        160495 by: Thomas Hochstetter
        160497 by: Binay Agarwal

Re: eval function
        160496 by: Matthias Wulkow
        160508 by: Tom Rogers
        160509 by: Matthias Wulkow
        160511 by: Matthias Wulkow
        160513 by: Tom Rogers

Random selection
        160498 by: fkeessen.planet.nl
        160501 by: David Otton
        160502 by: Binay Agarwal
        160503 by: fkeessen.planet.nl
        160506 by: Jim Lucas

Help with a script
        160499 by: Stevie D Peele
        160507 by: Jim Lucas
        160517 by: Stevie D Peele

Re: I wish I knew more about multi-dimensional arrays
        160500 by: Verdon vaillancourt

Shell connect
        160504 by: Dennis Dujan - Partycult.de

Re: Easy XML & PHP tutorials ?????
        160510 by: Noivad

how to do this
        160512 by: macromaniac
        160515 by: Ray Hunter

user-defined superglobals?
        160514 by: Matthias Nothhaft
        160516 by: Ray Hunter

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 ---
Ok , I am slightly confused at the moment, maybe someone can shed me some
light about the situation.

I have a php page that pulls a query of all students in a table that have
fit a criteria, in this case, where
the field, named "web", is set to Y

So when you open the page, all people with Y = web , are spit out into a
table.

Name - Address - Printed..

---------
Example:

Joe Smith - 5 Smith Road - Not Printed
Randy bob - 4 Joe Road - Not Printed

-------         

Now when the query outputs, I can click on the "Not Printed" link and it
should
update the persons row to change the vaule of the field named Printed from N
to Y.

Then when I referesh the page, it should look the same but instead of it
saying 
"Not Printed" it should say "Printed" next to the persons row.

So based on the above example, if we were to click on Joe Smith's "Not
Printed" link,
if we were to pull the page up later, it would now show "Printed"

We want to have a list of all students who have Y = Web but also at the same
time
monitor who we have pritned info on and who we dont, hence the reason for
the toggle.

I've included the code below to the function, my update looks correct but
when I'm coming 
back to the query page, its not changing the status of the "Not Printed" ,
so even 
if Printed is Y now in the field, it still says Not Pritned.

Any ideas? TIA everone


<?

## parameter: $student_id

include("../../application2.php");
$CFG->dbname = "ipo_students";

db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
$qid = db_query("SELECT printed FROM outgoing_student
                 WHERE id=$student_id");
$row = mysql_fetch_array($qid);
$printed = $row['printed'];

echo "current value of printed is $printed";
if ($printed == 'n' || $printed == 'N' || empty($printed)) {
  $newvalue = "Y";
} else {
  $newvalue = "N";
}

db_query("UPDATE outgoing_student SET printed='$newvalue' WHERE
          id='$student_id'");

echo "Go to previous page and refresh";


?>



Tony Pagliocco
Systems Administrator
Arizona State University
International Programs Office
Phone: (480) 727-6279
Email: [EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
Code and query look about right -- my guess is you're another one of the
multitude of people who haven't bothered to read the docs about register
globals and how they are now off by default. If the following solves
your problem, then yes indeed, such are you.

include("../../application2.php");
$CFG->dbname = "ipo_students";

//
// $student_id probably came in from $_GET or $_POST.
//
$student_id
    = isset( $_GET['student_id'] )
    ? $_GET['student_id']
    : (isset( $_POST['student_id'] )
        ? $_POST['student_id']
        : null;

if( is_null( $student_id ) )
{
    echo 'You have some other problem!'."\n";
}

db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
$qid = db_query("SELECT printed FROM outgoing_student
                 WHERE id=$student_id");

Cheers,
Rob.

On Fri, 2003-08-22 at 14:45, Tony Pagliocco wrote:
> Ok , I am slightly confused at the moment, maybe someone can shed me some
> light about the situation.
> 
> I have a php page that pulls a query of all students in a table that have
> fit a criteria, in this case, where
> the field, named "web", is set to Y
> 
> So when you open the page, all people with Y = web , are spit out into a
> table.
> 
> Name - Address - Printed..
> 
> ---------
> Example:
> 
> Joe Smith - 5 Smith Road - Not Printed
> Randy bob - 4 Joe Road - Not Printed
> 
> -------         
> 
> Now when the query outputs, I can click on the "Not Printed" link and it
> should
> update the persons row to change the vaule of the field named Printed from N
> to Y.
> 
> Then when I referesh the page, it should look the same but instead of it
> saying 
> "Not Printed" it should say "Printed" next to the persons row.
> 
> So based on the above example, if we were to click on Joe Smith's "Not
> Printed" link,
> if we were to pull the page up later, it would now show "Printed"
> 
> We want to have a list of all students who have Y = Web but also at the same
> time
> monitor who we have pritned info on and who we dont, hence the reason for
> the toggle.
> 
> I've included the code below to the function, my update looks correct but
> when I'm coming 
> back to the query page, its not changing the status of the "Not Printed" ,
> so even 
> if Printed is Y now in the field, it still says Not Pritned.
> 
> Any ideas? TIA everone
> 
> 
> <?
> 
> ## parameter: $student_id
> 
> include("../../application2.php");
> $CFG->dbname = "ipo_students";
> 
> db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
> $qid = db_query("SELECT printed FROM outgoing_student
>                  WHERE id=$student_id");
> $row = mysql_fetch_array($qid);
> $printed = $row['printed'];
> 
> echo "current value of printed is $printed";
> if ($printed == 'n' || $printed == 'N' || empty($printed)) {
>   $newvalue = "Y";
> } else {
>   $newvalue = "N";
> }
> 
> db_query("UPDATE outgoing_student SET printed='$newvalue' WHERE
>           id='$student_id'");
> 
> echo "Go to previous page and refresh";
> 
> 
> ?>
> 
> 
> 
> Tony Pagliocco
> Systems Administrator
> Arizona State University
> International Programs Office
> Phone: (480) 727-6279
> Email: [EMAIL PROTECTED]
> 
> 
-- 
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org   |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.    |
`---------------------------------------------'

--- End Message ---
--- Begin Message ---
You can, however, set the expire date to a date far in the future.  
http:// php.net/setcookie - take a look at the 3rd parameter.  Something
like time()+A_LOT_OF_SECONDS

-----Original Message-----
From: Stevie D Peele [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 5:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Making a cookie never expire

How can I make a cookie never expire?

Thanks,

Stevie

________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

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



--- End Message ---
--- Begin Message ---
Check out php_admin_value, highlighted in the link below

http://216.239.33.104/search?q=cache:mpDXuwrDs_gJ:www.php.net/configuration.changes+php_admin_value+site:www.php.net&hl=en&ie=UTF-8

--
Peter James
Editor-in-Chief, php|architect Magazine
[EMAIL PROTECTED]

php|architect
The Magazine for PHP Professionals
http://www.phparch.com


----- Original Message ----- 
From: "Dennis Gearon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 22, 2003 8:39 PM
Subject: [PHP] auto_prepend_file


> Is there any settings that will silently disable the ability  for a
> <.htaccess> file to use the
>
>     php_value auto_prepend_value "some file name"
>
> directive? Some safe mode thing, or an ini setting or something?
>
> The people at the host I'm at just CAN'T seem to get it working on my
> site. It's an ensim site.
>
> I have errors turned on, and it doesn't even give an error. It's like
> the line doesn't exist.
>
> If I had a browning light with some sabotted tungsten carbide slugs, I'd
> fix the G*^(*^N server,
>
> after three days of messing with this. :-)
>
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
On Thu, 21 Aug 2003, Ted Conn wrote:

> Hi I am new to this newsgroup and I plan on replying to all the posts I can
> for now... but Id like to start out by asking a question. I am trying to
> paginate my sql results in 10 by 10, which I have been able to do no
> problem. but what I want to do is have the pages layed out in google style
> with (1)(2)(3)(4) etc etc and each one is clickeable that will take you to
> that page. I'll show you the code I am using now for next and back
> buttons...
> 

        You might want to check Page and Pager_Sliding classes in PEAR:

        http://pear.php.net/package-info.php?package=Pager
        http://pear.php.net/package-info.php?package=Pager_Sliding

-- 
Mika Tuupola                      http://www.appelsiini.net/~tuupola/


--- End Message ---
--- Begin Message ---
hi,
i have a simple solutions for paging a large query result into pages.
format your SQL Query like this and it will work
 
$nTotal_No_Of_Results_Shown_On_A_Page=20;
 
if (empty($nCurrentPage))
    $nCurrentPage=1;
 
$tablename="tblusers"; // table from where the data is comming from
$fieldtosorton="user_name"; //    a field on wich you want to sort the result returned
$where="user_enabled=1";        // any where clause
 
$strQuery="SELECT TOP ".$nTotal_No_Of_Results_Shown_On_A_Page." * FROM $tablename WHERE $fieldtosorton NOT IN (SELECT TOP " .($nTotal_No_Of_Results_Shown_On_A_Page * ($nCurrentPage -1)) ." ".$fieldtosorton." FROM ".$tablename." WHERE $where ORDER BY ".$fieldtosorton.") ".$where." ORDER BY ".$fieldtosorton;
 
this query will give you just the result that you want to show on the current page. all you have to do is maintain $nCurrentPage. if you change the query slightly you can get the total no of records and when you get total no of records then you can also get total no of pages.
 
HTH,
Haseeb
 
 
-------Original Message-------
 
Date: Saturday, August 23, 2003 01:00:49 PM
Subject: Re: [PHP] google style paginating
 
On Thu, 21 Aug 2003, Ted Conn wrote:
 
> Hi I am new to this newsgroup and I plan on replying to all the posts I can
> for now... but Id like to start out by asking a question. I am trying to
> paginate my sql results in 10 by 10, which I have been able to do no
> problem. but what I want to do is have the pages layed out in google style
> with (1)(2)(3)(4) etc etc and each one is clickeable that will take you to
> that page. I'll show you the code I am using now for next and back
> buttons...
>
 
  You might want to check Page and Pager_Sliding classes in PEAR:
 
 
--
 
 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
____________________________________________________
  IncrediMail - Email has finally evolved - Click Here

--- End Message ---
--- Begin Message ---
On Friday 22 Aug 2003 10:26 pm, John Taylor-Johnston wrote:
> This is my favourite question. Can I clean up my 'if then' statements a
> tad? Must be a cleaner way?
> Still learning, still having fun :)
> Thanks,
> John
>
>  $news = mysql_query($sql) or die(print
> "document.write(\"".mysql_error()."\");");
>
>  $found = 0;
>  while ($mydata = mysql_fetch_object($news))
>  {
>   if($getaddr == $mydata->IPAddress)
>   {
>   $found = 1;
>   }
>  }
>
>   if ($found > 0)
>   {
>   echo "document.write(\"$getaddr already visited. \");";
>   }else{
>   echo "document.write(\"insert $getaddr into $table. \");";
>   }

Not sure at exactly what level you're looking to improve it!

Could you improve the query so you didn't have to search through all the 
records? i. e. add in '..where IPAddress = $getaddr" That way you could do 
away with the while loop altogether.

If you can't then why not break out of the while as soon as you've found the 
IPaddress you're looking for - i.e.

if ( $found = $getaddr == $mydata->IPAddress ) break;

And finally, if you were really having a downer on if statements you could use 
the ternary operator form as in:

document.write( ( $found ) ? "...already vistied" : "insert..." );

Whatever you use, I think Robert's layout not only shows elegance and panache 
but also makes it much easier to read.

HTH

Nick

PS: IP addresses are a notoriously bad way of checking to see if someone's 
visited your site.



--- End Message ---
--- Begin Message --- This DOES correct the error. <textarea> is like <pre> element, white space and newlines are NOT ignored. Try it for yourself.

Keith Higgs wrote:
Only if you're concerned about those few whitespace characters increasing your file size. Granted, there mey be PHP output related issues to a multi-line whitespace within an echo or print operation but, so far as the actual HTML is concerned, white space is white space and it should all be ignored by the browser's rendering engine.

The suggested correction DOES do a lot for programming style by eliminating the superfluous space, and the possibility that you may introduce errors by inserting other code in that area.

D. Keith Higgs <mailto:[EMAIL PROTECTED]> 216-368-0559
 Case Western Reserve University, Webmaster / Database Analyst - University Library
 Additional Information at http://www.cwru.edu/UL/ and http://keith.cwru.edu/
"Never overestimate the sanity of your sysadmin."

No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced.


-----Original Message-----
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 07:08 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] text area question



Your textarea should be: <textarea name= .... ></textarea>

and not
<textarea name= .... >




</textarea>



Angelo Zanetti wrote:



Hi this is slightly off topic but i hope i will be forgived.

I have a textarea and whenever my page loads and I click in

it the cursor


nevers starts at the very beginning and I have to push the

backspace buttton


until i get to the start. is there a property or something

to fix this??


thanx in advance
angelo





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







--- End Message ---
--- Begin Message --- DELETE FROM table ORDER BY timestamp DESC LIMIT 40, 10000000

untested, but should work

Deadsam wrote:

Hi Im making a chatroom using flash and php, the one problem Im having is
deleting rows.
What I'm looking for is when they click on the button to send the message
into php-->mySql  it will also
check to see how many rows are in that table and if they are greater then
40, then to delete the rows
over 40, starting with the oldest ones ASC. I thought about using the chatID
number but that will change
everytime. So I was thinking of having it check for how many rows there is
if its greater then 40 rows then
delete thgose over 40 ASC.
Hope I explained it good enough :)
Anyhow if anyone has a solution for this I would really appreciate it.
Thanks in advance
Deadsam






--- End Message ---
--- Begin Message --- Actualy, it will not. LIMIT can have only one argument with DELETE.
This will ($count is the number of rows you need to get in a previous query):


DELETE FROM table ORDER BY timestamp ASC LIMIT $count-40

Marek Kilimajer wrote:

DELETE FROM table ORDER BY timestamp DESC LIMIT 40, 10000000

untested, but should work

Deadsam wrote:

Hi Im making a chatroom using flash and php, the one problem Im having is
deleting rows.
What I'm looking for is when they click on the button to send the message
into php-->mySql it will also
check to see how many rows are in that table and if they are greater then
40, then to delete the rows
over 40, starting with the oldest ones ASC. I thought about using the chatID
number but that will change
everytime. So I was thinking of having it check for how many rows there is
if its greater then 40 rows then
delete thgose over 40 ASC.
Hope I explained it good enough :)
Anyhow if anyone has a solution for this I would really appreciate it.
Thanks in advance
Deadsam









--- End Message ---
--- Begin Message ---
Oops sorry,
Here are the phpinfo files of the other 2:

bestwebhosters.com/phpinfo.php
321go.biz/phpinfo.php

jumac.com/phpinfo.php


I have noticed that in the other two phpinfo files that it shows
file_uploads as "on" but in jumac it shows it as "1" which according to the
manual at the phpinfo site is the default, maybe i should change it to "on"?
but how via a .htaccess as i dont hvae accsess to the php.ini file...

Thanks,
-Ryan


> how about giving the specs on all three servers?
>
> So WE can see the differences.
>
> Jim Lucas


> > Hi,
> > I am trying to upload something into a directory on my server but always
i
> > am getting a permission denied ONLY from this server...i have tried it
on
> 2
> > other servers and they seem to be working fine but i have to get it
> working
> > on this server as this server is the fastest and our production server.
> >
> > I have looked at the folder permissions and CHMODED/changed them from
644
> to
> > 766 and finally 777 but am getting the same error, i then had a look at
> the
> > php info file (http://jumac.com/phpinfo.php) and i see file_uploading is
> set
> > to 1 and 1, safe mode is off, i am not too familier with file uploading
so
> > is this right? if not, how can i change it? hopefully via a .htaccess as
I
> > dont have access to the php.ini file directly.
> >
> > These are my paths:
> > $UserUploadDir="/usr163/home/r/y/ryanknig/public_html/BWH-Ads-Images";
> > $UserUploadURL = "http://jumac.com/BWH-Ads-Images";;
> >
> >
> > Let me again point out that this problem only seems to be on this
server,
> > the scripts including the upload is working perfectly on the other test
> > servers/sites.
> >
> > Kindly reply,
> > -Ryan A.
> >
> >
> >
> > We will slaughter you all! - The Iraqi (Dis)information ministers site
> > http://MrSahaf.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
>



We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com



--- End Message ---
--- Begin Message ---
These are all converted into boulean once the config file is read.  So it
doesn't matter.

on = yes = 1 = true
off = no = 0 = false

And by what method are you uploading the files?

Can you show the Form and process scripts.  If they are large scripts,
please only include the sections that does the uploading.

Jim Lucas

----- Original Message ----- 
From: "Ryan A" <[EMAIL PROTECTED]>
To: "Jim Lucas" <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 4:06 AM
Subject: Re: [PHP] Access denied problem, please help


> Oops sorry,
> Here are the phpinfo files of the other 2:
>
> bestwebhosters.com/phpinfo.php
> 321go.biz/phpinfo.php
>
> jumac.com/phpinfo.php
>
>
> I have noticed that in the other two phpinfo files that it shows
> file_uploads as "on" but in jumac it shows it as "1" which according to
the
> manual at the phpinfo site is the default, maybe i should change it to
"on"?
> but how via a .htaccess as i dont hvae accsess to the php.ini file...
>
> Thanks,
> -Ryan
>
>
> > how about giving the specs on all three servers?
> >
> > So WE can see the differences.
> >
> > Jim Lucas
>
>
> > > Hi,
> > > I am trying to upload something into a directory on my server but
always
> i
> > > am getting a permission denied ONLY from this server...i have tried it
> on
> > 2
> > > other servers and they seem to be working fine but i have to get it
> > working
> > > on this server as this server is the fastest and our production
server.
> > >
> > > I have looked at the folder permissions and CHMODED/changed them from
> 644
> > to
> > > 766 and finally 777 but am getting the same error, i then had a look
at
> > the
> > > php info file (http://jumac.com/phpinfo.php) and i see file_uploading
is
> > set
> > > to 1 and 1, safe mode is off, i am not too familier with file
uploading
> so
> > > is this right? if not, how can i change it? hopefully via a .htaccess
as
> I
> > > dont have access to the php.ini file directly.
> > >
> > > These are my paths:
> > > $UserUploadDir="/usr163/home/r/y/ryanknig/public_html/BWH-Ads-Images";
> > > $UserUploadURL = "http://jumac.com/BWH-Ads-Images";;
> > >
> > >
> > > Let me again point out that this problem only seems to be on this
> server,
> > > the scripts including the upload is working perfectly on the other
test
> > > servers/sites.
> > >
> > > Kindly reply,
> > > -Ryan A.
> > >
> > >
> > >
> > > We will slaughter you all! - The Iraqi (Dis)information ministers site
> > > http://MrSahaf.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
> >
>
>


--- End Message ---
--- Begin Message ---
Hi,

I had a problem where my upload form was not working on our production
server but was working on two other servers, after checking the phpinfo file
i saw that the others had file_uploads set to ON ON and in the production
server it was 1 1,
So I successfully changed my file_uploads value from 1 to ON via a .htaccess
file (php_value file_uploads ON), before it was giving me an access denied
error even thought the directory was chmoded 777, but after i have made the
"local" file_uploads to ON it is giving me this warning:

Warning: getimagesize: Unable to open '' for reading. in
/usr163/home/r/y/ryanknig/public_html/ads/ads_lib1.php on line 834

I have checked the path and it is perfect.....what do you think the problem
is?

This server is on  FreeBSD 4.6-STABLE while the others are on linux.

You can see the phpinfo files here if you want (first 2 are where the
software is working)
http://321go.biz/phpinfo.php
http://bestwebhosters.com/phpinfo.php

http://jumac.com/phpinfo.php


The people i am hosting with are very nice and i'm pretty sure they will be
willing to change my php.ini for me if needed, but i dont know what to ask
them to change in the first place...

Thanks,
-Ryan




--- End Message ---
--- Begin Message ---
Hi guys.

I have two questions for you today:

1. Weired login problem
I am developinig a site for a conference where i have a login page for
members. This page is called index.php and includes different types of modules,
according to the type of user logged on. The problem is now following:
i have a login function hidden in a class, this function registers a bunch
of variables. After the user has submited the details, index.php (which calls
the session_start()) calls the login function. Then i check whether a session
variable is present ($_SESSION['name']). If yes, we include the members
area, otherwise we include the login table again. Now: on my test server
(XP/Apache/php4.3.2) all is well. However, on the real server (Linux/Apache/php4.0.x)
it just includes the login table anyway, even if the login was successful. I
then have to click on the menu link again to include the member script.
Why is that?

2. Save a large amount of text to a file
On the same page i have some type of cms going. The admin users can change
txt files which relate to text on some of the general pages. I have now found
that it is only transmits a certain amount of text via GET to the function
that writs to the files. Is there a restriction on passing text via url? If yes
(which will be the case), how could i do this otherwise?

Thanks so long...

Thomas
P.S: this list still rocks

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post


--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Thomas Hochstetter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 5:33 PM
Subject: [PHP] 2 questions


> Hi guys.
>
> I have two questions for you today:
>
> 1. Weired login problem
> I am developinig a site for a conference where i have a login page for
> members. This page is called index.php and includes different types of
modules,
> according to the type of user logged on. The problem is now following:
> i have a login function hidden in a class, this function registers a bunch
> of variables. After the user has submited the details, index.php (which
calls
> the session_start()) calls the login function. Then i check whether a
session
> variable is present ($_SESSION['name']). If yes, we include the members
> area, otherwise we include the login table again. Now: on my test server
> (XP/Apache/php4.3.2) all is well. However, on the real server
(Linux/Apache/php4.0.x)
> it just includes the login table anyway, even if the login was successful.
I
> then have to click on the menu link again to include the member script.
> Why is that?

Check your register_globals setting in both ur test server and real server
and let me know.

>
> 2. Save a large amount of text to a file
> On the same page i have some type of cms going. The admin users can change
> txt files which relate to text on some of the general pages. I have now
found
> that it is only transmits a certain amount of text via GET to the function
> that writs to the files. Is there a restriction on passing text via url?
If yes
> (which will be the case), how could i do this otherwise?

Use POST instead of GET method... POST method allows u to even extend the
size of data being posted.

Hope this helps...

>
> Thanks so long...
>
> Thomas
> P.S: this list still rocks
>
> --
> COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
> --------------------------------------------------
> 1. GMX TopMail - Platz 1 und Testsieger!
> 2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
> 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8.
e-Post
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
Hallo Tom,

am Samstag, 23. August 2003 um 05:14 hast Du Folgendes gekritzelt:


TR> This should do it:

TR> eval('${"content".$databasepagename}[$i]();');

I'm afraid to say it, but it does not :-(

Yesterday I was also trying to find some manual pages about eval()
which would explain me the syntax. The example in the PHP-Manual is
not meaning much to me.

How can I print out what eval would evaluate, so I can see how to
compose the string?

Thx for answering again ;-)

SvT


-- 
Who is the ennemy?

mailto:[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Hi,

Saturday, August 23, 2003, 10:01:54 PM, you wrote:
MW> Hallo Tom,

MW> am Samstag, 23. August 2003 um 05:14 hast Du Folgendes gekritzelt:

TR>> This should do it:

TR>> eval('${"content".$databasepagename}[$i]();');

MW> I'm afraid to say it, but it does not :-(

MW> Yesterday I was also trying to find some manual pages about eval()
MW> which would explain me the syntax. The example in the PHP-Manual is
MW> not meaning much to me.

MW> How can I print out what eval would evaluate, so I can see how to
MW> compose the string?

MW> Thx for answering again ;-)

MW> SvT

This works for me, what error message do you get? Make sure you use
single quotes in the eval otherwise the string will get substituted
before eval gets a look at it.

<?php
$contentarray = array(1=>'testpage');
function testpage(){
        echo 'Test succceeded <br>';
}
$i = 1;
$databasepagename = 'array';

eval('${"content".$databasepagename}[$i]();');
?>

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
Hallo Tom,

am Samstag, 23. August 2003 um 17:50 hast Du Folgendes gekritzelt:


TR> This works for me, what error message do you get? Make sure you use
TR> single quotes in the eval otherwise the string will get substituted
TR> before eval gets a look at it.

TR> <?php
TR> $contentarray = array(1=>'testpage');
TR> function testpage(){
TR>         echo 'Test succceeded <br>';
TR> }
TR> $i = 1;
TR> $databasepagename = 'array';

TR> eval('${"content".$databasepagename}[$i]();');
?>>

That's the error I find in the apache-log. On the screen, I get
nothing but a white page. By the way I have error_reporting(E_ALL);
but I never get errors reported...

PHP Fatal error:  Call to undefined function:  () in 
/usr/local/www/showFunctions.php(77)

Your script is working. But mine not... is it because I'm on a output
buffer? I use ob_start() just before, because the real output is
produced by the function I want to call with the eval method...

Here the part of my script:

$query = "SELECT pagename FROM pages";
$result = mysql_query($query);
$a = 0;
while($row = mysql_fetch_array($result, MYSQL_BOTH)){
  $page[$a] = $row["pagename"];
  $fct[$a] = $page[$a];
  $fct[$a] = substr($fct[$a],1);
  $fct[$a] = str_replace(".php", "", $fct[$a]);
  $fct[$a] = ucfirst($fct[$a]);
  $a++;
}
mysql_free_result($result);

ob_start();

for($b = 0; $b < sizeof($fct); $b++){
  if($_SERVER["PHP_SELF"] == $page[$b])
    eval('${"content".$fct}[$b]();');
}

...

The "pagename" in the database is stored like /about.php so I change
it to About in the while-loop.

The eval method is there to replace my actual code (which is static):
if($_SERVER["PHP_SELF"] == "/login.php")
  contentLogin();
if($_SERVER["PHP_SELF"] == "/logout.php")
  contentLogout();

...

Using the "if-cascade", it is working, for you to know that the
mistake is definitly in the eval()-method...

Thx for your time...

SvT


-- 
Who is the ennemy?

mailto:[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Hallo Tom,

am Samstag, 23. August 2003 um 17:50 hast Du Folgendes gekritzelt:

TR> Hi,

TR> Saturday, August 23, 2003, 10:01:54 PM, you wrote:
MW>> Hallo Tom,

MW>> am Samstag, 23. August 2003 um 05:14 hast Du Folgendes gekritzelt:

TR>>> This should do it:

TR>>> eval('${"content".$databasepagename}[$i]();');

MW>> I'm afraid to say it, but it does not :-(

MW>> Yesterday I was also trying to find some manual pages about eval()
MW>> which would explain me the syntax. The example in the PHP-Manual is
MW>> not meaning much to me.

MW>> How can I print out what eval would evaluate, so I can see how to
MW>> compose the string?

MW>> Thx for answering again ;-)

MW>> SvT

TR> This works for me, what error message do you get? Make sure you use
TR> single quotes in the eval otherwise the string will get substituted
TR> before eval gets a look at it.

TR> <?php
TR> $contentarray = array(1=>'testpage');
TR> function testpage(){
TR>         echo 'Test succceeded <br>';
TR> }
TR> $i = 1;
TR> $databasepagename = 'array';

TR> eval('${"content".$databasepagename}[$i]();');
?>>

Sorry, I got it to show errors...

here: (it's almost the same than in apache-log)

Notice: Undefined variable: contentArray in /usr/local/www/showFunctions.php(77) : 
eval()'d code on line 1

Fatal error: Call to undefined function: () in /usr/local/www/showFunctions.php(77) : 
eval()'d code on line 1

SvT

-- 
Who is the ennemy?

mailto:[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Hi,

Sunday, August 24, 2003, 2:32:01 AM, you wrote:

MW> That's the error I find in the apache-log. On the screen, I get
MW> nothing but a white page. By the way I have error_reporting(E_ALL);
MW> but I never get errors reported...

MW> PHP Fatal error:  Call to undefined function:  () in 
/usr/local/www/showFunctions.php(77)

MW> Your script is working. But mine not... is it because I'm on a output
MW> buffer? I use ob_start() just before, because the real output is
MW> produced by the function I want to call with the eval method...

MW> Here the part of my script:

MW> $query = "SELECT pagename FROM pages";
MW> $result = mysql_query($query);
MW> $a = 0;
MW> while($row = mysql_fetch_array($result, MYSQL_BOTH)){
MW>   $page[$a] = $row["pagename"];
MW>   $fct[$a] = $page[$a];
MW>   $fct[$a] = substr($fct[$a],1);
MW>   $fct[$a] = str_replace(".php", "", $fct[$a]);
MW>   $fct[$a] = ucfirst($fct[$a]);
MW>   $a++;
MW> }
MW> mysql_free_result($result);

MW> ob_start();

MW> for($b = 0; $b < sizeof($fct); $b++){
MW>   if($_SERVER["PHP_SELF"] == $page[$b])
MW>     eval('${"content".$fct}[$b]();');
MW> }

MW> ...

MW> The "pagename" in the database is stored like /about.php so I change
MW> it to About in the while-loop.

MW> The eval method is there to replace my actual code (which is static):
MW> if($_SERVER["PHP_SELF"] == "/login.php")
MW>   contentLogin();
MW> if($_SERVER["PHP_SELF"] == "/logout.php")
MW>   contentLogout();

MW> ...

MW> Using the "if-cascade", it is working, for you to know that the
MW> mistake is definitly in the eval()-method...

MW> Thx for your time...

MW> SvT


MW> -- 
MW> Who is the ennemy?

MW> mailto:[EMAIL PROTECTED]



Ok we have to do it in 2 steps like this:

eval('$fn="content".$fct[$b];$fn();');

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
Hi,

Can you help me with this one?? 

In my mysql db i have a colum called names;

In names their are:

Frank
Frank
Bob
Alice
Bob
Alice
Jim
Alice
Frank

I want to make a random selection (max 3 value's for example).. Only it may not 
produce two times the same name. For example;

This is the output:

Frank, Jim, alice

Wrong output

Frank, Frank, Jim

Please help!

Thanks,

Frank


--- End Message ---
--- Begin Message ---
On Sat, 23 Aug 2003 15:06:32 +0200 (CEST), you wrote:

>In my mysql db i have a colum called names;
>
>In names their are:
>
>Frank
>Frank
>Bob
>Alice
>Bob
>Alice
>Jim
>Alice
>Frank
>
>I want to make a random selection (max 3 value's for example).. Only it may not 
>produce two times the same name. For example;

First make sure the array values are distinct:

$array = array_unique ($array);

Then shuffle the array:

shuffle ($array);

Then slice the array down to size:

if (sizeof ($array) > 3)
{
    $array = array_slice ($array, 0, 3);
}

There are faster ways, but this is probably the shortest code snippet.

BTW, if a value appears multiple times in a database column then your
database may be a good candidate for normalisation.


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

You can use "select distinct names from table_name order by rand() limit 3".
Hope this helps and let me know.

cheers
Binay


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 6:36 PM
Subject: [PHP] Random selection


> Hi,
>
> Can you help me with this one??
>
> In my mysql db i have a colum called names;
>
> In names their are:
>
> Frank
> Frank
> Bob
> Alice
> Bob
> Alice
> Jim
> Alice
> Frank
>
> I want to make a random selection (max 3 value's for example).. Only it
may not produce two times the same name. For example;
>
> This is the output:
>
> Frank, Jim, alice
>
> Wrong output
>
> Frank, Frank, Jim
>
> Please help!
>
> Thanks,
>
> Frank
>
>
>


----------------------------------------------------------------------------
----


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



--- End Message ---
--- Begin Message ---
Hi,

Thanks for the answer.. I'm open for faster ways!!!

>BTW, if a value appears multiple times in a database column then your
>database may be a good candidate for normalisation.

Problem i'm selecting some holidays out of an database but I want to avoid that there 
are holiday's presented from the same place..

THanks,

Frank

Sorry but i'm trying to avoid 
>On Sat, 23 Aug 2003 15:06:32 +0200 (CEST), you wrote:
>
>>In my mysql db i have a colum called names;
>>
>>In names their are:
>>
>>Frank
>>Frank
>>Bob
>>Alice
>>Bob
>>Alice
>>Jim
>>Alice
>>Frank
>>
>>I want to make a random selection (max 3 value's for example).. Only it may not 
>>produce two times the same name. For example;
>
>First make sure the array values are distinct:
>
>$array = array_unique ($array);
>
>Then shuffle the array:
>
>shuffle ($array);
>
>Then slice the array down to size:
>
>if (sizeof ($array) > 3)
>{
>    $array = array_slice ($array, 0, 3);
>}
>
>There are faster ways, but this is probably the shortest code snippet.
>
>BTW, if a value appears multiple times in a database column then your
>database may be a good candidate for normalisation.
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Try this:

SELECT name FROM table GROUP BY name ORDER BY RAND() LIMIT 3

This will group together all the names and then choose from a list that has
only unique names and then return 3 at random.

Jim Lucas

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 6:06 AM
Subject: [PHP] Random selection


> Hi,
>
> Can you help me with this one??
>
> In my mysql db i have a colum called names;
>
> In names their are:
>
> Frank
> Frank
> Bob
> Alice
> Bob
> Alice
> Jim
> Alice
> Frank
>
> I want to make a random selection (max 3 value's for example).. Only it
may not produce two times the same name. For example;
>
> This is the output:
>
> Frank, Jim, alice
>
> Wrong output
>
> Frank, Frank, Jim
>
> Please help!
>
> Thanks,
>
> Frank
>
>
>


----------------------------------------------------------------------------
----


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


--- End Message ---
--- Begin Message ---
I've been working on a script for quite some time now, particulary a site
news script. Heres how it works

1. Information is passed from a form to the database
2. Table is selected to a page to be viewed by the general public.

The problem is, when I use the form, there are no errors in the script,
but nothing is entered into the database.

Here are my scripts
------------------------------------The
Query------------------------------------
CREATE TABLE SiteNews 
(
Alias varchar(50) NOT NULL default '0',
News BLOB NOT NULL,
NewsDate Date NOT NULL 
) TYPE=MyISAM
-------------------------------------------------------------------------
---------

------------------------------------form
action------------------------------------
<?php
include ('config.php');
$link = @mysql_pconnect($location, $username, $password)
      or die("Could not connect to the databaseserver. Please go back and
try again or try again later.");
@mysql_select_db($database, $link)
      or die ("Could not select database. Please go back and try again or
try again later.");
$sql_insert = "INSERT INTO SiteNews ('Alias','News','NewsDate')
VALUES ('". addslashes($_POST['newsperson']) . "','" .  $_POST['date']  .
"','" .  addslashes($_POST['thenews']) . "')";
       
$result = mysql_query($sql_insert, $link);
echo (mysql_affected_rows($link) . " News entry inserted");
?>
-------------------------------------------------------------------------
-------------

------------------------------------Viewing the news
script---------------------------
<?php
include ('config.php');
$link = @mysql_pconnect($location, $username, $password)
     or die("Could not connect to the databaseserver. Please go back and
try again or try again later.");
@mysql_select_db($database,$link)
     or die ("Could not select database. Please go back and try again or
try again later.");
$sql = "SELECT Alias, NewsDate, News FROM SiteNews ORDER BY NewsDate
DESC";
$news = mysql_query($sql,$link) or die(mysql_error().'<p>'.$sql.'</p>');

if ($news){
   if (mysql_num_rows($news)== 0){
     echo ("No newsitems found.");
   }
   else{
     while ($row = mysql_fetch_assoc($news)){
      echo("<p>");
      echo($row['Alias']. "<br />");
      echo($row['NewsDate']."<br />");
      echo($row['News']);
      echo("</p>");
      echo("<hr />");
    }
  }
}
else{
   echo("Queryproblem");
}

 ?>
-------------------------------------------------------------------------
-------------

Can anyone see what is wrong?? 

Thanks

--- End Message ---
--- Begin Message ---
what is the source for the page that you initially enter the data on the web
form look like?

Jim Lucas
----- Original Message ----- 
From: "Stevie D Peele" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 23, 2003 6:25 AM
Subject: [PHP] Help with a script


> I've been working on a script for quite some time now, particulary a site
> news script. Heres how it works
>
> 1. Information is passed from a form to the database
> 2. Table is selected to a page to be viewed by the general public.
>
> The problem is, when I use the form, there are no errors in the script,
> but nothing is entered into the database.
>
> Here are my scripts
> ------------------------------------The
> Query------------------------------------
> CREATE TABLE SiteNews
> (
> Alias varchar(50) NOT NULL default '0',
> News BLOB NOT NULL,
> NewsDate Date NOT NULL
> ) TYPE=MyISAM
> -------------------------------------------------------------------------
> ---------
>
> ------------------------------------form
> action------------------------------------
> <?php
> include ('config.php');
> $link = @mysql_pconnect($location, $username, $password)
>       or die("Could not connect to the databaseserver. Please go back and
> try again or try again later.");
> @mysql_select_db($database, $link)
>       or die ("Could not select database. Please go back and try again or
> try again later.");
> $sql_insert = "INSERT INTO SiteNews ('Alias','News','NewsDate')
> VALUES ('". addslashes($_POST['newsperson']) . "','" .  $_POST['date']  .
> "','" .  addslashes($_POST['thenews']) . "')";
>
> $result = mysql_query($sql_insert, $link);
> echo (mysql_affected_rows($link) . " News entry inserted");
> ?>
> -------------------------------------------------------------------------
> -------------
>
> ------------------------------------Viewing the news
> script---------------------------
> <?php
> include ('config.php');
> $link = @mysql_pconnect($location, $username, $password)
>      or die("Could not connect to the databaseserver. Please go back and
> try again or try again later.");
> @mysql_select_db($database,$link)
>      or die ("Could not select database. Please go back and try again or
> try again later.");
> $sql = "SELECT Alias, NewsDate, News FROM SiteNews ORDER BY NewsDate
> DESC";
> $news = mysql_query($sql,$link) or die(mysql_error().'<p>'.$sql.'</p>');
>
> if ($news){
>    if (mysql_num_rows($news)== 0){
>      echo ("No newsitems found.");
>    }
>    else{
>      while ($row = mysql_fetch_assoc($news)){
>       echo("<p>");
>       echo($row['Alias']. "<br />");
>       echo($row['NewsDate']."<br />");
>       echo($row['News']);
>       echo("</p>");
>       echo("<hr />");
>     }
>   }
> }
> else{
>    echo("Queryproblem");
> }
>
>  ?>
> -------------------------------------------------------------------------
> -------------
>
> Can anyone see what is wrong??
>
> Thanks


--- End Message ---
--- Begin Message ---
Heres the source of the page where I initially enter the data -

-------------------------------------------------------------------------
---------------------------------------------------------
<body>
<hr noshade color="black" size="2">
<font face="Verdana, sans-serif" size="1">
<h2><B>MyPHP Site News v1.0</b></h2>
<Table border="0" width="100%">
<tr>
<td width="20%" valign="Top">
<form action="sitenews.php" method="POST">
Your Alias:</td>
<td width="80%" valign="Top">
<input type="text" name="newsperson" style="border: 1px solid black;
font-family: Verdana, sans-serif;" 
onFocus="this.className='focus'" onBlur="this.className='blur'"></td>
</tr>
<tr>
<td width="20%">Date:</td>
<td width="80%"><input type="text" name="date" style="border: 1px solid
black; font-family: Verdana, sans-serif;"
onFocus="this.className='focus'" onBlur="this.className='blur'"> <font
size="2">Ex) 2003-08-19</font></td>
</tr>
<Tr>
</tr>
<td width="20%" valign="Top">Your News:<br><font size="2">Enter as much
text as you would like here</font></td>
<Td width="80%" valign="top"><textarea rows="5" cols="45" name="thenews"
style="border: 1px solid black; font-family: Verdana, sans-serif;"
onFocus="this.className='focus'"
onBlur="this.className='blur'"></textarea></td>
</tr>
<tr>
<td width="20%"></td>
<td width="80%">
<input type="submit" value="Submit Entry" class="mybutton"><input
type="reset" value="Clear Form" class="mybutton"></td>
</tr>
</table>
</form>
<hr noshade color="black" size="2">
<center><font face="Verdana, sans-serif" size="1">PHP Site News developed
by Stevie Peele</font></center>
</body>
-------------------------------------------------------------------------
---------------------------------------------------------
On Sat, 23 Aug 2003 08:18:19 -0700 "Jim Lucas" <[EMAIL PROTECTED]>
writes:
> what is the source for the page that you initially enter the data on 
> the web
> form look like?
> 
> Jim Lucas
> ----- Original Message ----- 
> From: "Stevie D Peele" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, August 23, 2003 6:25 AM
> Subject: [PHP] Help with a script
> 
> 
> > I've been working on a script for quite some time now, particulary 
> a site
> > news script. Heres how it works
> >
> > 1. Information is passed from a form to the database
> > 2. Table is selected to a page to be viewed by the general 
> public.
> >
> > The problem is, when I use the form, there are no errors in the 
> script,
> > but nothing is entered into the database.
> >
> > Here are my scripts
> > ------------------------------------The
> > Query------------------------------------
> > CREATE TABLE SiteNews
> > (
> > Alias varchar(50) NOT NULL default '0',
> > News BLOB NOT NULL,
> > NewsDate Date NOT NULL
> > ) TYPE=MyISAM
> > 
>
-------------------------------------------------------------------------
> > ---------
> >
> > ------------------------------------form
> > action------------------------------------
> > <?php
> > include ('config.php');
> > $link = @mysql_pconnect($location, $username, $password)
> >       or die("Could not connect to the databaseserver. Please go 
> back and
> > try again or try again later.");
> > @mysql_select_db($database, $link)
> >       or die ("Could not select database. Please go back and try 
> again or
> > try again later.");
> > $sql_insert = "INSERT INTO SiteNews ('Alias','News','NewsDate')
> > VALUES ('". addslashes($_POST['newsperson']) . "','" .  
> $_POST['date']  .
> > "','" .  addslashes($_POST['thenews']) . "')";
> >
> > $result = mysql_query($sql_insert, $link);
> > echo (mysql_affected_rows($link) . " News entry inserted");
> > ?>
> > 
>
-------------------------------------------------------------------------
> > -------------
> >
> > ------------------------------------Viewing the news
> > script---------------------------
> > <?php
> > include ('config.php');
> > $link = @mysql_pconnect($location, $username, $password)
> >      or die("Could not connect to the databaseserver. Please go 
> back and
> > try again or try again later.");
> > @mysql_select_db($database,$link)
> >      or die ("Could not select database. Please go back and try 
> again or
> > try again later.");
> > $sql = "SELECT Alias, NewsDate, News FROM SiteNews ORDER BY 
> NewsDate
> > DESC";
> > $news = mysql_query($sql,$link) or 
> die(mysql_error().'<p>'.$sql.'</p>');
> >
> > if ($news){
> >    if (mysql_num_rows($news)== 0){
> >      echo ("No newsitems found.");
> >    }
> >    else{
> >      while ($row = mysql_fetch_assoc($news)){
> >       echo("<p>");
> >       echo($row['Alias']. "<br />");
> >       echo($row['NewsDate']."<br />");
> >       echo($row['News']);
> >       echo("</p>");
> >       echo("<hr />");
> >     }
> >   }
> > }
> > else{
> >    echo("Queryproblem");
> > }
> >
> >  ?>
> > 
>
-------------------------------------------------------------------------
> > -------------
> >
> > Can anyone see what is wrong??
> >
> > Thanks
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

--- End Message ---
--- Begin Message ---
Hey bigdog, that's beautiful! I laughed, I cried, so elegant ;)

Thanks, that did the job nicely.

Salut,
verdon



On 8/23/03 2:02 AM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> From: Ray Hunter <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Fri, 22 Aug 2003 11:03:10 -0600
> To: 'PHP-General' <[EMAIL PROTECTED]>
> Subject: Re: [PHP] I wish I knew more about multi-dimensional arrays
> 
> mysql result as a multi-dimensional array:
> 
> while( $row = mysql_fetch_array($result) ) {
> $rows[] = $row;
> }
> 
> now you have a multi-dimensional array that contains each row in rows...
> 
> examples:
> row 1 col 1 - $rows[0][0]
> row 3 col 2 - $rows[3][2]
> 
> hth
> 
> --
> bigdog
> 
> 
> On Fri, 2003-08-22 at 10:37, Verdon vaillancourt wrote:
>> Hi, please don't chuckle (too loudly) at my attempts to learn ;)
>> 
>> I'm trying to create what I think would be a multi-dimensional array from a
>> mysql result set, to use in some example code I got off this list last week.
>> 


--- End Message ---
--- Begin Message ---
Hello,
I have a general Question about PHP.
Is it Possible to connect via shell from a Webserver
to another Server?
Do you have perhaps some exampels or help pages?
 
It would be very nice if you can help me :-)
 
Best regrads
Dennis D.

--- End Message ---
--- Begin Message --- On Thursday, August 21, 2003, at 07:34 PM, Burhan Khalid wrote:

On Friday, August 22, 2003, 2:16:06 AM, Joe wrote:

JH> Hello all. does anyone have any very easy XML tutorials . I have a
JH> simple weather feed I want to implement. but no XML experience

JH> thanks

<shameless plug>
I have one at my site, complete with an example and downloadble code.
I also wrote a class that parses an XML weather feed. Are  you trying
to use the intercept vector xml feeds?

Anyhow, the tutorial is at my site (check the signature). Click on PHP
under the sections on the left.
</shameless plug>

If you don't find mine too useful, there are plenty of other tutorial
sites around. My favorite one is at zend http://www.zend.com/zend/tut/


Thank you for listing this site. I've been lurking here for a while trying to pick up useful info and It looks like this site is what I've been looking for.



-Michael



--- End Message ---
--- Begin Message ---
well,
i have to php pages and i want to send one argument from one to another.  I
tried a few things but I couldn't do it.

is there a special way to do it?



--- End Message ---
--- Begin Message ---
Sessions, cookies or thru the get request

--
BigDog

On Sat, 2003-08-23 at 02:21, macromaniac wrote:
> well,
> i have to php pages and i want to send one argument from one to another.  I
> tried a few things but I couldn't do it.
> 
> is there a special way to do it?
> 
> 


--- End Message ---
--- Begin Message --- Hi List,

is there a way (mybe in php5?) to define/declare a global var as a superglobal, so that I can use this var like the known superglobals
($_GET, $_SESSION, etc.) ???


If not, is there a list for "feature requests"?


Regards, Matthias


--- End Message ---
--- Begin Message ---
you can define your own superglobals by defining the vars first then
accessing them thru the $GLOBALS var.

example:

<?php
// file1.php
$var1 = "test1\n";
$var2 = "test2\n";
?>

<?php
// file2.php
include( 'file1.php' );

function test() {
  echo $GLOBALS['var1'];
  echo $GLOBALS['var2'];
  echo "Test\n"
}

test();

?>

That should get you started with globals.

--
BigDog


On Sat, 2003-08-23 at 11:45, Matthias Nothhaft wrote:
> Hi List,
> 
> is there a way (mybe in php5?) to define/declare a global var as a 
> superglobal, so that I can use this var like the known superglobals
> ($_GET, $_SESSION, etc.) ???
> 
> If not, is there a list for "feature requests"?
> 
> 
> Regards,
> Matthias
> 


--- End Message ---

Reply via email to