php-general Digest 10 Jun 2002 03:28:04 -0000 Issue 1396

Topics (messages 101331 through 101354):

Re: Function needed
        101331 by: Chris Hewitt
        101332 by: Gaylen Fraley

Formatting XML Data
        101333 by: Sebastian A.
        101335 by: Dan Hardiker

Re: Date?
        101334 by: Bruce Karstedt
        101342 by: Gerard Samuel
        101344 by: Miguel Cruz
        101350 by: David Freeman
        101352 by: Gerard Samuel

Re: Excel Spreadsheet
        101336 by: Jeremy Bowen
        101338 by: John Holmes

Re: PHP function for listing number of columns in table
        101337 by: John Holmes

Re: restricting files
        101339 by: Jason Wong

Re: populating list menus with mysql and for statements
        101340 by: Jason Wong

Date functions & Unic Epoch
        101341 by: Juan Antonio Ruiz Zwollo
        101348 by: David Robley

Getting users monitor size
        101343 by: Tom Ray
        101345 by: Miguel Cruz
        101346 by: Rad0s-ław Gajewski
        101349 by: Miva Guy
        101353 by: Mark

phpDocumentor version 1.1.0rc1 RELEASE ANNOUNCEMENT
        101347 by: Greg Beaver

Another Flat File question.
        101351 by: Tom Ray

simplicity with 2 queries..
        101354 by: Jule Slootbeek

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 ---
$result=`ls -R | grep 'expression' ./`;

HTH
Chris

Jason Wong wrote:

>On Sunday 09 June 2002 17:17, Austin Marshall wrote:
>
>>Gaylen Fraley wrote:
>>
>>>I am in need of a function/script that will take a directory and search
>>>all filenames, recursively down, for a given file.  Can anyone point me
>>>to a source?  Thanks.
>>>
>>$result=`grep -r 'expression' ./`;
>>
>
>This searches for strings within a file.
>


--- End Message ---
--- Begin Message ---
This resricts to *nix and can be disallowed due to security constraints, but
thanks anyway.  I just wrote my own PHP routine.

--
Gaylen
PHP KISGB v4.0.5 Guest Book http://www.gaylenandmargie.com/phpwebsite/

"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> $result=`ls -R | grep 'expression' ./`;
>
> HTH
> Chris
>
> Jason Wong wrote:
>
> >On Sunday 09 June 2002 17:17, Austin Marshall wrote:
> >
> >>Gaylen Fraley wrote:
> >>
> >>>I am in need of a function/script that will take a directory and search
> >>>all filenames, recursively down, for a given file.  Can anyone point me
> >>>to a source?  Thanks.
> >>>
> >>$result=`grep -r 'expression' ./`;
> >>
> >
> >This searches for strings within a file.
> >
>
>


--- End Message ---
--- Begin Message ---
Hello,

I have been working with XML in the recent weeks and I have recently come
across the need to format some of the data in my XML. For example I might
have a large XML file and I would like some of the text to be bold, or maybe
I would like to insert a hyper-link. Unfortunately it does not seem I can do
this with ordinary HTML tags because they will be interpreted as XML tags. I
am sure, however that there is another way of doing this. Does anyone know
how?

Thanks


--- End Message ---
--- Begin Message ---
> I would like some of the text to be
> bold, or maybe I would like to insert a hyper-link. Unfortunately it
> does not seem I can do this with ordinary HTML tags because they will
> be interpreted as XML tags. I am sure, however that there is another
> way of doing this. Does anyone know how?

Have a look into XSLT... its all in the manual.


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd


--- End Message ---
--- Begin Message ---
<? echo date("l, F j, Y"); ?> works just fine for me.

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


-----Original Message-----
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 08, 2002 11:50 PM
To: [EMAIL PROTECTED]
Cc: Jeremy Bowen
Subject: [PHP] Re: Date?


<? echo date (l.", ".F." ".d.", ".Y); ?>
Sunday, June 09, 2002

But I would use:

<?php echo date (l.", ".F." ".d.", ".Y); ?>

Don't know why, but someone told me once it had something to do with
versions.

John

Jeremy Bowen wrote:

> I am having nothing but trouble with the date function. I want it to print
> out a date like this: Saturday June 8, 2002 but as soon as I put spaces or
> comma's in the string I get parse errors. I can get it to print
> SaturdayJune082002 with  <? echo date (lFdY); ?> I have tried escaping
with
> \ but it seems to make no difference.
>


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

--- End Message ---
--- Begin Message ---
Speaking of which.  I was thinking about this this morning.
Is there a part of the Unix timestamp that tells php what timezone to 
report.
Reason why I ask, is I would like to offset the unix timestamp relative 
to where a server is to a particular user.
So lets say the user is in Europe, and the server is in USA and the 
script is set to display date as 'H:i T', and
I offset the unix timestamp to the user in Europe, would the timezone 
adjust to the European timezone...
Im going to try on a windows box where I can change the date easily and 
see what happens...

John Taylor-Johnston wrote:

>I added a comment to the FAQ:
>http://www.php.net/manual/en/function.date.php
>
>
>  
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



--- End Message ---
--- Begin Message ---
On Sun, 9 Jun 2002, John Taylor-Johnston wrote:
> <? echo date (l.", ".F." ".d.", ".Y); ?>
> Sunday, June 09, 2002
> 
> But I would use:
> 
> <?php echo date (l.", ".F." ".d.", ".Y); ?>
> 
> Don't know why, but someone told me once it had something to do with versions.

date() just wants a plain ordinary string for the first argument (as the
manual clearly says). I don't know what all that concatenation is for (I
guess with permissive parsing it will provide the same thing), but as the
examples in the manual also clearly show, you can just use:

   date ('l, F d, Y');

miguel

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

 > Speaking of which.  I was thinking about this this morning.
 > Is there a part of the Unix timestamp that tells php what 
 > timezone to 
 > report.

You could use the gmt-based date manipulation to do this.

 > Reason why I ask, is I would like to offset the unix 
 > timestamp relative 
 > to where a server is to a particular user.
 > So lets say the user is in Europe, and the server is in USA and the 
 > script is set to display date as 'H:i T', and

Your main problem will be in identifying where the user is.  Probably
the only truly reliable way is to ask them to tell you what their time
zone is.  Pretty much every other method will result in a percentage of
inaccurate reporting - the degree of error will be dependant on the
method chosen.

CYA, Dave


--- End Message ---
--- Begin Message ---
Ill look into gmdate.  I was going to get the timezone from the user to 
store in the database..

David Freeman wrote:

> > Speaking of which.  I was thinking about this this morning.
> > Is there a part of the Unix timestamp that tells php what 
> > timezone to 
> > report.
>
>You could use the gmt-based date manipulation to do this.
>
> > Reason why I ask, is I would like to offset the unix 
> > timestamp relative 
> > to where a server is to a particular user.
> > So lets say the user is in Europe, and the server is in USA and the 
> > script is set to display date as 'H:i T', and
>
>Your main problem will be in identifying where the user is.  Probably
>the only truly reliable way is to ask them to tell you what their time
>zone is.  Pretty much every other method will result in a percentage of
>inaccurate reporting - the degree of error will be dependant on the
>method chosen.
>
>CYA, Dave
>
>
>
>
>  
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



--- End Message ---
--- Begin Message ---
Hello All,

I was working on a little php today and I remembered that I had another
project that I wanted to do. I have a fairly complicated excel spreadsheet
that helps me price a service I provide and I would like to be able to have
fields on my website that can be filled in and the data passed throught the
spreadsheet (through whatever manner) and the pricing info delivered back to
the client.

I have no idea how to do this and I thought that maybe some of you have done
projects like this and would have an idea of where I should start.

 Thanks,

Jeremy
>

--- End Message ---
--- Begin Message ---
It would be better to just have PHP do the calculating for you, instead
of trying to figure out how to pass data back and forth between a
spreadsheet. You can maybe use COM for passing the data, if you still
need to do it that way.

---John Holmes...

> -----Original Message-----
> From: Jeremy Bowen [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 09, 2002 1:09 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Fw: Excel Spreadsheet
> 
> Hello All,
> 
> I was working on a little php today and I remembered that I had
another
> project that I wanted to do. I have a fairly complicated excel
spreadsheet
> that helps me price a service I provide and I would like to be able to
> have
> fields on my website that can be filled in and the data passed
throught
> the
> spreadsheet (through whatever manner) and the pricing info delivered
back
> to
> the client.
> 
> I have no idea how to do this and I thought that maybe some of you
have
> done
> projects like this and would have an idea of where I should start.
> 
>  Thanks,
> 
> Jeremy
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
No. There is, however, a function that'll tell you how many columns are
in a result set. So, if you select all columns, then you can use that
function to find out how many columns are in the table.

www.php.net/mysql_num_fields

---John Holmes...

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 09, 2002 12:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP function for listing number of columns in table
> 
> Pardon the probably stupid question but,
> 
> Is there a PHP function for listing number of columns in a mySQL
table?
> 
> Thanks in advance
> 
> JJ Harrison
> [EMAIL PROTECTED]
> www.tececo.com


--- End Message ---
--- Begin Message ---
On Sunday 09 June 2002 23:08, Justin French wrote:
> Have you got a link for somewhere to look for a base set of functions for
> me to build on?

Search the archives, I'm sure I've posted some download code on the list 
before, as have others. 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"The vast majority of successful major crimes against property are
perpetrated by individuals abusing positions of trust."
-- Lawrence Dalzell
*/

--- End Message ---
--- Begin Message ---
On Sunday 09 June 2002 17:27, electroteque wrote:
> hi i am populating a list menu with mysql , i would like to find a way to
> populate a form with more than one of the same list menus in a for loop
>
>  <select name="type[]">
>        <?
>        while ($sample = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
>        $typeID=$sample["typeID"];
>        $description=$sample["description"];
>     $sample_type[$sample['typeID']] = $sample["description"];
>     echo "\n<option value=\"$typeID\" $selected>$description</option>";
>     }
>     ?>
>     </select>
>
> i have this within a for loop but the list only shows up once and the
> second one is empty because the select from the database is finished ,
>
> is there a way to put the information from mysql into arrays so i can use
> it more than once and then i could do multiple populated list boxes ? let
> me know

use mysql_data_seek() to reset the row pointer.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
QOTD:
        "She's about as smart as bait."
*/

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

Say, has anybody re-written the date funtions so they work with any date and
not be crippled by the unix timestamp range limit?

I am looking for a function which will do the equivalent of
   date("w",mktime(0,0,0,8,30,1934))
but that will actually *work*.

Does anybody know a way to return which day of the week (0-7) it is for
dates outside the unix timestamp range?

I wish this stuff would be build into PHP.

Saludos,


Juan Antonio Ruiz Zwollo





--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> Hi!
> 
> Say, has anybody re-written the date funtions so they work with any date and
> not be crippled by the unix timestamp range limit?
> 
> I am looking for a function which will do the equivalent of
>    date("w",mktime(0,0,0,8,30,1934))
> but that will actually *work*.
> 
> Does anybody know a way to return which day of the week (0-7) it is for
> dates outside the unix timestamp range?
> 
> I wish this stuff would be build into PHP.

You might look at the Calendar functions for this - you may need to 
recompile your php to include them.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
Is there a way to do this with PHP? I couldn't find it in the online 
docs and the archive search is offline :(

thanks!

--- End Message ---
--- Begin Message ---
On Sun, 9 Jun 2002, Tom Ray wrote:
> Is there a way to do this with PHP? I couldn't find it in the online 
> docs and the archive search is offline :(

Use JavaScript to detect it, and then you can set a cookie or add it to a 
request posted to the server. In either case your PHP program can then 
pick up the info.

miguel

--- End Message ---
--- Begin Message ---
On Sun, 9 Jun 2002, Tom Ray wrote:
++>Is there a way to do this with PHP? I couldn't find it in the online
++>docs and the archive search is offline :(
        oh..You couldn't?
echo '<form action=index.php>
        <p>What's your monitor size? <input type=text name=size>
        <p>
        <input type=submit>
        </form>';
Users monitor size is in $HTTP_GET_VARS["size"];
And this is funny but true answer to your question.
-- 
--
                                     pozdr
                                        Rad0s

        Radek Gajewski [EMAIL PROTECTED] GG:694459 ICQ:110153822
        --------------------------------------------------------

--- End Message ---
--- Begin Message ---
Currently, I'm developing a site that makes full use of a 1024 x 768 display
since 90% of my users have that config.

In the off chance they have a smaller display, I have this in the header of
my HTML template:

<SCRIPT LANGUAGE="JavaScript">
var smallver = {SCREEN_SIZE};
if(!smallver && screen.width < 1000)
self.location.replace("{RESIZED_SMALL}");
else if(smallver && screen.width > 1000)
self.location.replace("{RESIZED_LARGE}");
</SCRIPT>

Where:
'SCREEN_SIZE' => $sessiondata['session_small'] ? 1 : 0,
'RESIZED_SMALL' => $PHP_SELF."?resize=1&".$QUERY_STRING,
'RESIZED_LARGE' => $PHP_SELF."?resize=0&".$QUERY_STRING

What all this means is that I store a Boolean variable in a sessions table
for 'session_small'. In the php header of each page, I simply look at that
variable to decide how to draw the page.

The JavaScript is necessary since only client-side scripting can pick up
that value for you automatically. If it sees that the screen size is set to
normal (large) and the display won't allow it, it runs the page again with
'resize=1' in the query string to allow the change of the variable in the
sessions table. Alternatively, if the 'session_small' variable true and the
display will allow more, the page is reloaded with the correct value in the
table.

Hope this helps,
Mark

-----Original Message-----
From: Tom Ray [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 09, 2002 2:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Getting users monitor size


Is there a way to do this with PHP? I couldn't find it in the online
docs and the archive search is offline :(

thanks!


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

--- End Message ---
--- Begin Message ---
He asked about detecting monitor size, not screen resolution. I don't
think any javascript will ever be able to do this.

On Sun, 09 Jun 2002 20:42:58 -0400, Miva Guy wrote:
>Currently, I'm developing a site that makes full use of a 1024 x 768
>display
>since 90% of my users have that config.
>
>In the off chance they have a smaller display, I have this in the
>header of
>my HTML template:
>
><SCRIPT LANGUAGE="JavaScript">
>var smallver = {SCREEN_SIZE};
>if(!smallver && screen.width < 1000)
>self.location.replace("{RESIZED_SMALL}");
>else if(smallver && screen.width > 1000)
>self.location.replace("{RESIZED_LARGE}");
></SCRIPT>
>
>Where:
>'SCREEN_SIZE' => $sessiondata['session_small'] ? 1 : 0,
>'RESIZED_SMALL' => $PHP_SELF."?resize=1&".$QUERY_STRING,
>'RESIZED_LARGE' => $PHP_SELF."?resize=0&".$QUERY_STRING
>
>What all this means is that I store a Boolean variable in a sessions
>table
>for 'session_small'. In the php header of each page, I simply look
>at that
>variable to decide how to draw the page.
>
>The JavaScript is necessary since only client-side scripting can
>pick up
>that value for you automatically. If it sees that the screen size is
>set to
>normal (large) and the display won't allow it, it runs the page
>again with
>'resize=1' in the query string to allow the change of the variable
>in the
>sessions table. Alternatively, if the 'session_small' variable true
>and the
>display will allow more, the page is reloaded with the correct value
>in the
>table.
>
>Hope this helps,
>Mark
>
>-----Original Message-----
>From: Tom Ray [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, June 09, 2002 2:39 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP] Getting users monitor size
>
>
>Is there a way to do this with PHP? I couldn't find it in the online
>docs and the archive search is offline :(
>
>thanks!
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
June 9, 2002
RELEASE ANNOUNCEMENT
phpDocumentor version 1.1.0rc1
http://www.phpdoc.org
Download: http://phpdocu.sourceforge.net/downloads.php

The phpDocumentor Development team would like to announce the release of
phpDocumentor version 1.1.0rc1.  This is a release candidate for 1.1.0 to
ensure
that all bugs have been fixed before release

phpDocumentor is the most advanced auto-documentation system available for
PHP.  Similar to the auto-documentor included with PEAR, phpDocumentor
parses documentation comments in the PHP source to create hyperlinked API
references for projects.  Unlike the PEAR auto-documentor, phpDocumentor is
extremely fast, has excellent documentation included, and the ability to
parse any legal PHP syntax.

phpDocumentor is the only auto-documentor written specifically for PHP that
supports output to formats other than HTML.  With 1.1.0rc1 comes a pre-
alpha PDF Converter to demonstrate the facility.  Through the use of
"Converters"
similar to JavaDoc's doclets, phpDocumentor can interface parsing output to
any template with minimal coding.  In addition, 6 HTML templates come
standard with phpDocumentor.

Other features include:
  --fully 25% faster than version 1.0.0
  --able to directly parse a CVS repository
  --parses any php file, with multiple classes and functions in the same
file
  --fully compliant with even the most esoteric php syntax
   ($string = <<< EOF, for example)
  --greatly improved ease of Converter programming
  --parsing of global and static variables
  --documentation of name conflicts between packages
  --auto-linking to elements in any package
  --error/warnings by line number and file to allow for debugging of
 documentation tags
  --extensive documentation of the package, including a detailed
specification
 for tags and templates
  --open source, GPL

phpDocumentor is fast becoming the standard auto-documentor, and is
used by several PHP projects including PostNuke
Content Management (http://www.postnuke.com), phpRPC
(http://phprpc.sourceforge.net/), and XMap
(http://opensource.under.com.br/xmap/docs/)

To Download, go to http://phpdocu.sourceforge.net/downloads.php

The phpDocumentor development team
Joshua Eichorn
Gregory Beaver



--- End Message ---
--- Begin Message ---
I know I've asked this before but I don't believe I asked the question 
correctly.

I have a flat file database that is delimited with colons. This file 
will have new records added to it on a regular basis. What I want to do 
is be able to search that file based on a keyword that is inputted by a 
user, then it will search that database comparing each record for that 
value, if that value returns true, I want it to display the results of 
that record.

How would I do this when I don't know the number of records that will be 
searched (since it will rise and fall almost daily)? Also, how would I 
create a dynamic array?

I hope this makes sense to someone, I've been pulling my hair out on this.


Thanks!

--- End Message ---
--- Begin Message ---
Hey guys and gals,

I have the following function which accesses the following tables, now i want to 
know if there is a way to get the quiz_id from table quiz without runnning both 
these queries...
thanks,

Jule

--tables--

mysql> describe user;
+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| user_id    | int(10) unsigned |      | PRI | NULL    | auto_increment |
| first_name | varchar(10)      |      |     |         |                |
| last_name  | varchar(20)      |      |     |         |                |
| email      | varchar(100)     |      |     |         |                |
| username   | varchar(16)      |      |     |         |                |
| password   | varchar(32)      |      |     |         |                |
+------------+------------------+------+-----+---------+----------------+

mysql> describe quiz;
+---------+------------------+------+-----+---------+----------------+
| Field   | Type             | Null | Key | Default | Extra          |
+---------+------------------+------+-----+---------+----------------+
| quiz_id | int(10) unsigned |      | PRI | NULL    | auto_increment |
| user_id | int(10) unsigned |      |     | 0       |                |
| title   | varchar(255)     |      |     |         |                |
| noa     | tinyint(2)       |      |     | 0       |                |
+---------+------------------+------+-----+---------+----------------+

--function--

function addquiz_get_quiz_id() {

        global $valid_user, $valid_password;

        mysql_select_db($db_glob, $link_glob);
        
        $table_user = "user";
        $table_quiz = "quiz";
        $query = "SELECT * FROM $table_user WHERE username='$valid_user' AND 
password='$valid_password'";
        $result = mysql_query($query);
        $user_info = mysql_fetch_array($result);
        $user_id = $user_info[user_id];
        
        $query = "SELECT * FROM $table_quiz WHERE user_id='$user_id'";
        $result = mysql_query($query);
        $user_info = mysql_fetch_array($result);
        $quiz_id = $user_info[quiz_id];
        
        mysql_close($link_glob);
        return $quiz_id;        
}
-- 
Jule Slootbeek  
[EMAIL PROTECTED] 

http://blindtheory.cjb.net 
        

--- End Message ---

Reply via email to