php-general Digest 10 Jun 2002 16:02:47 -0000 Issue 1397

Topics (messages 101355 through 101394):

Re: simplicity with 2 queries..
        101355 by: John Holmes
        101356 by: Bogdan Stancescu
        101368 by: Tim Ward

Re: Date?
        101357 by: Bogdan Stancescu

fputs/fgets working irregularly
        101358 by: Kris
        101359 by: Tom Rogers

logic question
        101360 by: Justin French

PHP/MySQL
        101361 by: Jason Soza
        101363 by: Miguel Cruz

Re: Another Flat File question.
        101362 by: Miguel Cruz

Re: phpDocumentor version 1.1.0rc1 RELEASE ANNOUNCEMENT
        101364 by: Miguel Cruz
        101382 by: Timothy J. Luoma

Running PHP script within stylesheet?
        101365 by: William S.
        101366 by: William S.

Re: PHP function for listing number of columns in table
        101367 by: Tim Ward
        101369 by: Mark
        101372 by: hugh danaher

help me please! :)
        101370 by: Veronica Ghezzi
        101373 by: Kevin Porter
        101375 by: PHPCoder
        101376 by: Marek Kilimajer
        101377 by: Josep R. Raurell

mysql dump --> via php
        101371 by: Wilbert Enserink
        101378 by: Jason Wong

Free Hosting /w PHP/MySQL  {!?}
        101374 by: Liam MacKenzie

Re: Setting Cookies
        101379 by: Craig Donnelly

Slow to warn...
        101380 by: Dan Bolser

Can a php script be placed within a stylesheet?
        101381 by: William S.
        101385 by: Andrew Brampton

Re: Javascript & PHP cookies
        101383 by: Erik Price

LDAP, SSL and Active Directory (W2K)
        101384 by: Andres Petralli

HTML or PHP problem? Please check this ...
        101386 by: ignacio.estrada.cfe.gob.mx
        101387 by: John Holmes

[debugger] ??
        101388 by: Dan Bolser

Re: [PEAR-DEV] [debugger] ??
        101389 by: Lukas Smith

php cgi problem on RH linux
        101390 by: Kevin Lowe

mail() function hangs
        101391 by: Phil Schwarzmann
        101392 by: Manuel Lemos
        101393 by: Peterhead Info

Re: phpDocumentor website issues
        101394 by: Greg Beaver

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 ---
Read the JOIN chapter of the MySQL manual and it'll tell you how to do
it. It's not a PHP issue.

(watch for line wrapping)
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#JOIN

---John Holmes...

> -----Original Message-----
> From: Jule Slootbeek [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 09, 2002 11:35 PM
> To: php-general
> Subject: [PHP] simplicity with 2 queries..
> 
> 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
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
SELECT
  quiz_id
FROM
  $table_quiz AS q,
  $table_user AS u
WHERE
  q.user_id=u.user_id AND
  u.username='$valid_user' AND
  u.password='$valid_password'";

Bogdan

Jule Slootbeek wrote:

> 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;   
> }





--- End Message ---
--- Begin Message ---
        If ($result = mysql_query("SELECT * FROM $table_user, $table_quiz 
                                WHERE
$table_quiz.user_id=$table_user.user_id 
                                AND username='$valid_user' 
                                AND password='$valid_password'"))
        {       if ($array = mysql_fetch_array($result))
                {       $quiz_id = $array["quiz_id"];
                } else
                {       // log in failed
                }
        }

        I think you need to spend a bit of time on basic sql and structure 
        your code a bit if you want the desired result.

        Tim Ward
        www.chessish.com <http://www.chessish.com> 
        [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

        ----------
        From:  Jule Slootbeek [SMTP:[EMAIL PROTECTED]]
        Sent:  10 June 2002 04:35
        To:  php-general
        Subject:  simplicity with 2 queries..

        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 ---
--- Begin Message ---
JavaScript's getTimezoneOffset seems to be working just right, as shown 
here: http://www.tyzo.com/tools/timezone.html

I think assuming that the user's computer has the correct time zone set 
shouldn't be too far-fetched - and you can always provide the user with 
a way to override that default.

Just my 2c.

Bogdan

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




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

I'm having some trouble getting my basic news script to work. Here is the
code:

 $fp = fopen("data/prev.txt","r");
 while (!feof ($fp)) {
     $pr = fgets($fp, 4096);
 }
 fclose($fp);

 $fp = fopen("data/news.txt","r");
 while (!feof ($fp)) {
     $ag = fgets($fp, 4096);
 }
 fclose($fp);

 $fp = fopen("data/news.txt","w");
 $np = fputs($fp,$pr);
 fclose($fp);

 $fp = fopen("data/news.txt","a");
 $ng = fputs($fp,$ag);
 fclose($fp);

The news.txt does not append what is stored in $pr for some reason. I can't
put my finger on what the problem is, the file is chmod correctly as well.
Can anyone help?

Thanks,
Kris


--- End Message ---
--- Begin Message ---
Hi
Why not just do it in one call?

$fp = fopen("data/news.txt","w");
  $np = fputs($fp,$pr.$ag);
  fclose($fp);


Tom


At 04:17 AM 10/06/2002, Kris wrote:
>Hi all,
>
>I'm having some trouble getting my basic news script to work. Here is the
>code:
>
>  $fp = fopen("data/prev.txt","r");
>  while (!feof ($fp)) {
>      $pr = fgets($fp, 4096);
>  }
>  fclose($fp);
>
>  $fp = fopen("data/news.txt","r");
>  while (!feof ($fp)) {
>      $ag = fgets($fp, 4096);
>  }
>  fclose($fp);
>
>  $fp = fopen("data/news.txt","w");
>  $np = fputs($fp,$pr);
>  fclose($fp);
>
>  $fp = fopen("data/news.txt","a");
>  $ng = fputs($fp,$ag);
>  fclose($fp);
>
>The news.txt does not append what is stored in $pr for some reason. I can't
>put my finger on what the problem is, the file is chmod correctly as well.
>Can anyone help?
>
>Thanks,
>Kris
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

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

I'm working on a message board.  Everything is working fine, except some of
the beta testers have requested the desire to have a "6 new replies" type
system, so that they can easily recognise threads with new posts.

The board is open to both guests (email) and users (userid), and the plan
would be to know when the user last logged in, and highlight new posts /
replies since that last login (and do nothing like this for guests).

I did this by keeping the date of the current login, and the login before
it, and shuffling them back upon a new login.  This gave me a "previous
login" timestamp to compare with post times.

All works well, except that once the user has read the posts, or an entire
thread, they're no longer NEW posts, they're just posts, which shouldn't be
highlighted.


So, what's another approach I can use?

Log the each thread the user has read (and the date they read it), and if
the thread has changed since that date, highlight it?


Thanks in advance,

Justin French

--- End Message ---
--- Begin Message ---
I'm wondering how PHP handles result sets and other info gathered from
MySQL.

The reason I ask is I've been messing with mysql_connect() functions all
day, finally found a solution (or so I thought), then a couple hours later I
returned to my site and got an "Unable to connect" error.

When I make a change to the mysql_connect() function in my PHP script, then
save and reload that page, it doesn't seem to have any effect at the time.
For example, I don't allow any anonymous access to my MySQL server, but I
can take out host, user, and password information from mysql_connect(), save
and reload and it still loads as if the function worked.

I've already tried deleting all cached info through my browser (IE) and I've
made other PHP changes that do take effect, it's just the mysql_connect()
that doesn't seem to want to work.

The site is www.miatapix.net - I have it showing as working fine on my side,
someone else want to take a look at it and see what they get? And any help
for this? It's hard to troubleshoot things when results aren't immediately
available.

Thanks in advance,

Jason Soza

--- End Message ---
--- Begin Message ---
On Sun, 9 Jun 2002, Jason Soza wrote:
> When I make a change to the mysql_connect() function in my PHP script,
> then save and reload that page, it doesn't seem to have any effect at
> the time. For example, I don't allow any anonymous access to my MySQL
> server, but I can take out host, user, and password information from
> mysql_connect(), save and reload and it still loads as if the function
> worked.

Apache spawns a bunch of processes, and with each http request you are 
(sort of) randomly assigned one. If you get one that you've had before, it 
may have some bits of state hanging around from previous requests.

One way to avoid this during debugging is to run Apache in the slower -x 
single process mode.

miguel

--- End Message ---
--- Begin Message ---
On Sun, 9 Jun 2002, Tom Ray wrote:
> 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.

  http://php.net/file
  http://php.net/preg_grep

miguel

--- End Message ---
--- Begin Message ---
On Sun, 9 Jun 2002, Greg Beaver wrote:
> June 9, 2002
> RELEASE ANNOUNCEMENT
> phpDocumentor version 1.1.0rc1
> http://www.phpdoc.org

Best of all, with OSX IE 5.14, the page comes up completely blank.

miguel

--- End Message ---
--- Begin Message ---
On Mon, 10 Jun 2002, Miguel Cruz wrote:

> On Sun, 9 Jun 2002, Greg Beaver wrote:
> > June 9, 2002
> > RELEASE ANNOUNCEMENT
> > phpDocumentor version 1.1.0rc1
> > http://www.phpdoc.org
>
> Best of all, with OSX IE 5.14, the page comes up completely blank.

Well in Opera6/Win it's just a big mess, probably because Opera doesn't
support 'overflow' properly.


Greg:

        I'm assuming you're the web designer or at least know who the
webdesigner is....

        I appreciate the obvious effort to make your pages validate XHTML
and CSS.  There are a couple small errors that I thought I'd point out,
not to say "ha ha your code doesn't validate" (because it's better than
99% of the web, and probably much better than several pages I've worked
on) but just to try and be helpful

There are a bunch of CSS errors listed at
http://jigsaw.w3.org/css-validator/validator?uri=http://phpdocu.sourceforge.net/phpdocumentor.css

... It looks like there is some kind of expression there that the
validator isn't aware of (and I've never seen):

height:expression((document.body.clientHeight-105)*.30);


As for the XHTML, line 229 needs a space before the 'width="105"
height="31"'

<img
src="http://sourceforge.net/sflogo.php?group_id=11194&amp;type=5"width="105";
height="31" alt="SourceForge Logo" />

The _target="blank" isn't valid for the doctype defined & no character set
is defined


The page looks great in Mozilla-1.0/win, and even in IE6/win, (heck even
Netscape4.79 doesn't look bad ;-) but not in Opera6

TjL



--- End Message ---
--- Begin Message ---
I am very new to PHP, Sablotron, XSLT, and MySql.
Right now I have created a web page that is the
result of a transformation (through php) of an
xsl and xml file.

What I would like to do is run a PHP script so
that the result is displayed within a table on my
web page. How do I do this? Here is an example:

        $myvar = "Hello World";
        echo $myvar;

In which file do I put this script?
Here is a link to my page.

http://213.84.71.105/

This is just the first step in my learning process.
Ultimately, I would like to be able to query
a mysql database through a web interface.

Thank you,
-- 
Bill
Amsterdam, NL
--- End Message ---
--- Begin Message ---
Sorry, perhaps I should have been a bit more specific.
Here is my *.php file. I want the "hello world"
script to output to the "Right Menu" table on
my web page: http://213.84.71.105/ .

<?php
$xml = "./test.xml";
$xsl = "./test.xsl";

$_parser = xslt_create();
  
if( !$result = @xslt_process(  $_parser,    // resource xh
                               $xml,        // string xml
                               $xsl,        // string xsl
                               NULL,        // string result
                               array(),     // array arguments
                               array()      // array parameters
                             ) ) {
    printf( "Sablotron Error (%s): <br /><strong>%s</strong>",
            xslt_errno($_parser), xslt_error($_parser) );
}
xslt_free($_parser); 
echo $result;
?>
 
On Mon, Jun 10, 2002 at 02:23:21PM +0800, James wrote:
> It's quite easy to display a result within a table, here are two
> examples...
>
> <?php
>       $myvar = "Hello World";
> ?>
> <html>
>       <body>
>               <table>
>                       <tr>
>                               <td><?= $myvar ?></td>
>                       </tr>
>               </table>
>       </body>
> </html>
>
> <?= $var ?> is the equivalent to <?php echo $var ?>
<snip>

-- 
Bill
Amsterdam, NL
--- End Message ---
--- Begin Message ---
Just off the top of my head wouldn't describe then mysql_num_rows() be a lot
more efficient.

Tim Ward
www.chessish.com <http://www.chessish.com> 
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

        ----------
        From:  John Holmes [SMTP:[EMAIL PROTECTED]]
        Sent:  09 June 2002 18:29
        To:  [EMAIL PROTECTED]; [EMAIL PROTECTED]
        Subject:  RE: [PHP] PHP function for listing number of columns in
table

        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 ---
yes, I think getting the result set for 'describe $table' or 'show
fields from $table' and then doing mysql_num_rows() on that is best
because it will return right away and will work for empty tables as
well.

On Mon, 10 Jun 2002 09:00:41 +0100, Tim Ward wrote:
>Just off the top of my head wouldn't describe then mysql_num_rows()
>be a lot
>more efficient.
>
>Tim Ward
>www.chessish.com <http://www.chessish.com>
>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>    ----------
>    From:  John Holmes [SMTP:[EMAIL PROTECTED]]
>    Sent:  09 June 2002 18:29
>    To:  [EMAIL PROTECTED]; [EMAIL PROTECTED]
>    Subject:  RE: [PHP] PHP function for listing number of columns
in
>table
>
>    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 ---
what's the matter with using mssql_num_fields() and get the answer directly.

 $fields = mysql_list_fields("$db", "$table", $link);
 $columns = mysql_num_fields($fields);

Hugh
----- Original Message -----
From: "Mark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; "John Holmes" <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 1:18 AM
Subject: RE: [PHP] PHP function for listing number of columns in table


yes, I think getting the result set for 'describe $table' or 'show
fields from $table' and then doing mysql_num_rows() on that is best
because it will return right away and will work for empty tables as
well.

On Mon, 10 Jun 2002 09:00:41 +0100, Tim Ward wrote:
>Just off the top of my head wouldn't describe then mysql_num_rows()
>be a lot
>more efficient.
>
>Tim Ward
>www.chessish.com <http://www.chessish.com>
>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>    ----------
>    From:  John Holmes [SMTP:[EMAIL PROTECTED]]
>    Sent:  09 June 2002 18:29
>    To:  [EMAIL PROTECTED]; [EMAIL PROTECTED]
>    Subject:  RE: [PHP] PHP function for listing number of columns
in
>table
>
>    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
>
>
>




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


--- End Message ---
--- Begin Message ---
Hi,
   i must get the information saved in a several select list named
        liv_1             <select name="liv_1">
        liv_2           <select name="liv_2">
        liv_3           <select name="liv_3">
        ....
        liv_n           <select name="liv_n">

To get the value i work in this way...

        $n = 50;
        for ($i=1; $i<=$n;i++){
                ...
                echo "$liv_$i";      //// in asp i do:   response.write 
(request("liv_" +
i))
                ...
        }
But i get only
        1
        2
        3
        ...
        50

What can i do to get "$liv_1" ... "$liv_2"...  ???
Thank you a lot!

Veronica Ghezzi

--- End Message ---
--- Begin Message ---
You need to escape the dollar sign with a backslash to prevent PHP trying to
interpolate the variable $liv (which presumably doesn't exist).

echo "\$liv_$i";

HTH,

- Kev

> -----Original Message-----
> From: Veronica Ghezzi [SMTP:[EMAIL PROTECTED]]
> Sent: 10 June 2002 09:24
> To:   Php-General
> Subject:      [PHP] help me please! :)
> 
> Hi,
>    i must get the information saved in a several select list named
>       liv_1             <select name="liv_1">
>       liv_2           <select name="liv_2">
>       liv_3           <select name="liv_3">
>       ....
>       liv_n           <select name="liv_n">
> 
> To get the value i work in this way...
> 
>       $n = 50;
>       for ($i=1; $i<=$n;i++){
>               ...
>               echo "$liv_$i";      //// in asp i do:   response.write
> (request("liv_" +
> i))
>               ...
>       }
> But i get only
>       1
>       2
>       3
>       ...
>       50
> 
> What can i do to get "$liv_1" ... "$liv_2"...  ???
> Thank you a lot!
> 
> Veronica Ghezzi
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************
--- End Message ---
--- Begin Message ---
<?php
$i = 1;
$liv_1 = "one";
$liv_2 = "two";
$liv_3 = "three";
$liv_4 = "four";
$liv_5 = "five";
while ($i <= 5 ) {
$do = "echo \$liv_{$i};";
eval($do);
echo "<br>";
 $i ++;
}
?>

Simply echoing the \$liv_$i will not work, need to evaluate the string 
after parsed as in example above...


Kevin Porter wrote:

>You need to escape the dollar sign with a backslash to prevent PHP trying to
>interpolate the variable $liv (which presumably doesn't exist).
>
>echo "\$liv_$i";
>
>HTH,
>
>- Kev
>
>>-----Original Message-----
>>From: Veronica Ghezzi [SMTP:[EMAIL PROTECTED]]
>>Sent: 10 June 2002 09:24
>>To:   Php-General
>>Subject:      [PHP] help me please! :)
>>
>>Hi,
>>   i must get the information saved in a several select list named
>>      liv_1             <select name="liv_1">
>>      liv_2           <select name="liv_2">
>>      liv_3           <select name="liv_3">
>>      ....
>>      liv_n           <select name="liv_n">
>>
>>To get the value i work in this way...
>>
>>      $n = 50;
>>      for ($i=1; $i<=$n;i++){
>>              ...
>>              echo "$liv_$i";      //// in asp i do:   response.write
>>(request("liv_" +
>>i))
>>              ...
>>      }
>>But i get only
>>      1
>>      2
>>      3
>>      ...
>>      50
>>
>>What can i do to get "$liv_1" ... "$liv_2"...  ???
>>Thank you a lot!
>>
>>Veronica Ghezzi
>>
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>**********************************************************************
>This email and any files transmitted with it are confidential and
>intended solely for the use of the individual or entity to whom they
>are addressed. If you have received this email in error please notify
>the system manager.
>
>This footnote also confirms that this email message has been swept by
>MIMEsweeper for the presence of computer viruses.
>**********************************************************************
>


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

for ($i=1; $i<=$n;i++){
                ...
                $tmp="liv_$i";
                echo "{$$tmp}";
                ...
        }


Veronica Ghezzi wrote:

>Hi,
>   i must get the information saved in a several select list named
>       liv_1             <select name="liv_1">
>       liv_2           <select name="liv_2">
>       liv_3           <select name="liv_3">
>       ....
>       liv_n           <select name="liv_n">
>
>To get the value i work in this way...
>
>       $n = 50;
>       for ($i=1; $i<=$n;i++){
>               ...
>               echo "$liv_$i";      //// in asp i do:   response.write 
>(request("liv_" +
>i))
>               ...
>       }
>But i get only
>       1
>       2
>       3
>       ...
>       50
>
>What can i do to get "$liv_1" ... "$liv_2"...  ???
>Thank you a lot!
>
>Veronica Ghezzi
>
>
>  
>


--- End Message ---
--- Begin Message ---
This work for me:

    liv_1        <select name="liv[1]">
    liv_2        <select name="liv[2]">
    liv_3        <select name="liv[3]">
    ....
    liv_n        <select name="liv[n]">

To get the value i work in this way...

$liv= $_REQUEST['liv'];

    $n = 50;
    for ($i=1; $i<=$n;i++){
        ...
        echo $liv[$i];    


Josep R. Raurell


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


I have a .txt file containing a mysql dump. Normally when I would restore this dump I 
would go to the mysql 'prompt' and type something like: mysql < dimpfile.txt. I would 
use SSH or telnet for this.


Now I have this new problem: I cannot reach the sql pompt via SSH/telnet. Is there any 
other way to create all the tables and records from the dumpfile.txt into the database 
on the database server??

Maybe it is possible to copy paste the sql statements into a php file which can do 
this?
I can then upload this php file to the webserver and perform the job.
Maybe anybody can advise me on the php code part of this solution.

Regards,


thx Wilbert Enserink

-------------------------
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-------------------------
--- End Message ---
--- Begin Message ---
On Monday 10 June 2002 16:34, Wilbert Enserink wrote:
> Hi all,
>
>
> I have a .txt file containing a mysql dump. Normally when I would restore
> this dump I would go to the mysql 'prompt' and type something like: mysql <
> dimpfile.txt. I would use SSH or telnet for this.
>
>
> Now I have this new problem: I cannot reach the sql pompt via SSH/telnet.
> Is there any other way to create all the tables and records from the
> dumpfile.txt into the database on the database server??
>
> Maybe it is possible to copy paste the sql statements into a php file which
> can do this? I can then upload this php file to the webserver and perform
> the job. Maybe anybody can advise me on the php code part of this solution.

The easiest solution is to install phpMyAdmin.

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

/*
Doing gets it done.
*/

--- End Message ---
--- Begin Message ---
Free hosting for PHP Developers!

As many MySQL Databases as you need (Also accessible remotely if needed)
PHP with all the bits http://scripts.operationenigma.net/phpinfo.php
FTP Access
Subdomain or Your own Domain
Tech Support over MSN if needed
98% Uptime
2 Megabit Connection based in Brisbane, Australia


Only catch is that I can't have downloads on my servers.  
I have a 5 Gig Monthty transfer limit, so no MP3s or 
thereabouts please.

Contact me if you're interested.


--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.cooki
es

Use Superglobals...you will see what I mean.

Also, Apache 2.0 is not recommended as of yet for PHP commercial development
http://www.apacheweek.com/issues/02-06-07

Regards,

Craig

"Scott 'Intense!' Reismanis" <[EMAIL PROTECTED]> wrote in message
000001c20e9f$c8720620$850d2dcb@intense">news:000001c20e9f$c8720620$850d2dcb@intense...
> Hey all,
>
> I am having some troubles setting cookies at the moment wondering if
> anyone knows the solution.
>
> Anyhow basically what is happening, is that cookies are been set fine,
> however say I try to set two cookies in the one script
>
> i.e.
> setcookie("username", $HTTP_POST_VARS['username'], time()+31536000);
> setcookie("password", $HTTP_POST_VARS['password'], time()+31536000);
>
> only the cookie that was called last, i.e. 'password' will be set. I
> only started noticing this problem since I installed php4.2 and
> apache2.0, is that the cause? Has anyone shared a similar experience,
> and if so is there a fix? Thanks for your time as always.
>
>             Regards,
>
>
>                    Scott
>


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


Hi, I recently upgraded my server and
now, when developing php, the
server takes ages to respond 
to any php bug. 

I.e. When I am trying to debug my
scripts, it takes ages to see what
warning messages I get. 

Is there some check in the php.ini
I used to have set which allows
fast error reporting?

What php developement package
do you recommend for linux?

Cheers, Dan.

--- End Message ---
--- Begin Message ---
Can a "php script" be put within a stylesheet and
work properly? If so, how?

For instance, this script put inside an XSL
stylesheet file:

              <?php
              $myvar = "Hello World";
              echo $myvar;
              ?>

Then it is transformed into html via Sablotron.

-- 
Bill
Amsterdam, NL
--- End Message ---
--- Begin Message ---
Yes you can place one in a style sheet you just need to tell apache (or
whatever) that .css should be parsed by PHP, this can be done via a
.htaccess or something similar... Here is a example in a .htaccess file:

AddType application/x-httpd-php .css

andrew
----- Original Message -----
From: "William S." <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 1:33 PM
Subject: [PHP] Can a php script be placed within a stylesheet?


> Can a "php script" be put within a stylesheet and
> work properly? If so, how?
>
> For instance, this script put inside an XSL
> stylesheet file:
>
>               <?php
>               $myvar = "Hello World";
>               echo $myvar;
>               ?>
>
> Then it is transformed into html via Sablotron.
>
> --
> Bill
> Amsterdam, NL
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

On Sunday, June 9, 2002, at 12:56  AM, John Taylor-Johnston wrote:

> Absolutely. I've done it. Cookies are cookies.
>
> What I don't like is that the cookie is not saved unitl after a submit.
>
> In Javascript, I have JS code that will assign a value and save it to a
> cookie and then recall the cookie value and document.write(myvalue),
> over and
> over if I want, without EVER submitting. It works as the page loads.
>
> Need JS code?

Yes, because it's a client side operation.  Remember, it's the submit 
that is telling the web server to send a cookie.  JavaScript code, being 
client side, can set the cookie without a page submit, just like a 
mathematical calculation can be done without a page submit in JavaScript 
but not with PHP.

To further this clarification, the reason why you can't read the cookie 
that you're setting in the same page is because that cookie was never 
sent to the web server for PHP to recognize.  In other words, you may 
think that because you set a cookie at some point during a given script 
(that is sent to the user agent), that cookie is now available later in 
the same script.  It's not.  The cookie needs to be sent to the web 
server with a page request in order for the web server/PHP to know it's 
there.  This hasn't happened yet.

To beat a dead horse, this is exactly what happens in this order, and 
the steps are separate:

1. User makes a GET/page request of the web server

2. The resource requested on the web server is a PHP script, and one of 
its effects is to say "when this resource is sent to the browser, give 
this cookie along with it"

3. Only AFTER the script executes and is transmitted (thus only AFTER 
the script is actually done doing its work) does the cookie appear on 
the client side.  So the script is unable to "read" the cookie it is 
setting.

4. If the user makes another request to that domain, THEN the cookie is 
available, because the cookie is sent along with that request.

In JavaScript, all of this is done on the client side, so the cookie can 
be read immediately once it is set without the need for requests and 
page submits or what have you.

If you think in terms of HTTP it all makes total sense.



Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi NG Users,

I'm implementing some php 4.2.x code to manipulate Microsofts AD. I have already 
set-up the domain controller to handle LDAP over SSL (Port 636) and it looks like it 
is working, at least I can download a certificate when I browse the server with HTTPS.

The problem now is to get the certificate into php. Does anyone have some clues how to 
manage this? Basically, what I'm trying to do is to build a web-frontend to change 
passwords for AD accounts. I wouldn't like to re-invent the wheel, so I'd really 
appreciate if someone could post some code samples. 

Also, if somebody already knows about some working ASP (VB) code, that would also be 
very much appreciated. Anyway, it would be important to at least be able to 
authenticate users agains AD with php, what probably means that I still have to set-up 
a PHP/LDAP over a SSL connection to AD. If anyone knows how to get a certificate into 
PHP, so that it is possible to connect with something like this 

$ds = ldap_connect("ldaps://servername:636");

that would be really great.

I've been browsing a lot on the web now and I really have tried almost any search 
combinations with google and other search engines, but I couldn't find any usefull 
docs on this topic. There are many people looking into this issue, but finally most of 
them seem to fail when it comes to connect to AD over SSL. If someone here has 
experience in this field, I think he could do a favour to lots of developers, since it 
looks like this is a major problem when it comes to interoperability between Win2k and 
common Unix systems. Should I be successful in my research, I really would be willing 
to write a decent documentation about this, so that others wont have to waste so much 
time again, like others did on this topic.

Kind regards to everyone,


Andres


-- 
Andres Petralli, Arpanet AG
Steinengraben 18, 4002 Basel, Switzerland
Tel: +41 (0)61 276 96 60, Fax: +41 (0)61 276 96 66
http://www.arpanet.ch/
PGP: CDD7 E772 D14B 407A 4343  6901 74A5 A74D AE98 6BE4  
--- End Message ---
--- Begin Message ---
I have a capture form using text fields.   This form receives data from the
user and then through a php module the data will be stored on an Oracle
database via ODBC.   All the data is converted to caps  using the
strtoupper() function.  However when the user writes characters like ñ the
strtoupper()  function changes the character (to another character but not
to Ñ, or the corresponding upper character), so the ODBC manager reports an
error message becouse he does not accept the converted character.

Does somebody knows how can I get the correct character converted ?

I will apprecciate so much your help !

Atte. Ignacio Estrada F.
Centro Nacional de Control de Energia
Area de Control Occidental
025+6463, 025+6464, 025+6469

--- End Message ---
--- Begin Message ---
Can you do the strtoupper() in your query, using the appropriate Oracle
function?

Maybe it'll handle the different character sets better.

---John Holmes...

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 07, 2002 3:07 PM
Subject: [PHP] HTML or PHP problem? Please check this ...


I have a capture form using text fields.   This form receives data from the
user and then through a php module the data will be stored on an Oracle
database via ODBC.   All the data is converted to caps  using the
strtoupper() function.  However when the user writes characters like ñ the
strtoupper()  function changes the character (to another character but not
to Ñ, or the corresponding upper character), so the ODBC manager reports an
error message becouse he does not accept the converted character.

Does somebody knows how can I get the correct character converted ?

I will apprecciate so much your help !

Atte. Ignacio Estrada F.
Centro Nacional de Control de Energia
Area de Control Occidental
025+6463, 025+6464, 025+6469


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


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

I want to use this package, 


with DBG v2.10pl1, (C) 2000,2001, by Dmitri Dmitrienko, [EMAIL PROTECTED],
http://dd.cron.ru

but I dont want to spend any money.

Any one know of a nusphere hack?

What is the story behind that?

Cheers, Dan.

--- End Message ---
--- Begin Message ---
#1 Don't cross post like this ... asking about a free Editor that
integrates with DBG would fit php-general but definitely not php-dev or
pdphoc
#2 Don't come to any of this lists for "hacks" for software
#3 DBG is freeware and there are several Editors that integrate DBG

SE IDE was bundeled with DBG version 2.10, but was dropped afterwards
(dunno if the old version is still up on the site)

PHPEdit is Opensource www.phpedit.com

Maguma Light is freeware www.maguma.com

Best regards,
Lukas Smith
[EMAIL PROTECTED]
_______________________________
 DybNet Internet Solutions GbR
 Reuchlinstr. 10-11
 Gebäude 4 1.OG Raum 6 (4.1.6)
 10553 Berlin
 Germany
 Tel. : +49 30 83 22 50 00
 Fax  : +49 30 83 22 50 07
 www.dybnet.de [EMAIL PROTECTED]

> -----Original Message-----
> From: Dan Bolser [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 10, 2002 4:20 PM
> Cc: [EMAIL PROTECTED]; PHP Mailing List; [EMAIL PROTECTED]
> Subject: [PEAR-DEV] [debugger] ??
> 
> 
> I want to use this package,
> 
> 
> with DBG v2.10pl1, (C) 2000,2001, by Dmitri Dmitrienko, [EMAIL PROTECTED],
> http://dd.cron.ru
> 
> but I dont want to spend any money.
> 
> Any one know of a nusphere hack?
> 
> What is the story behind that?
> 
> Cheers, Dan.
> 
> 
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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

Hi,

I have a RH 7.2 server with php 4.1.2 installed as a CGI.

I'm trying to run this script

#!/usr/local/phpcgi/bin/php -q
<?
print "hello";
?>

I get this as output:

[root@dev bin]# ./test.php
Error in argument 1, char 3: option not found
Error in argument 1, char 3: option not found
Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] |  {<file> [args...]} etc


if I remove the -q (ie first line #!/usr/local/phpcgi/bin/php) I get:

[root@dev bin]# ./test.php
bash: ./test.php: No such file or directory


PHP seems to be OK :

[root@dev bin]# /usr/local/phpcgi/bin/php -m
Running PHP 4.1.2
Zend Engine v1.1.1, Copyright (c) 1998-2001 Zend Technologies

[PHP Modules]
xml
standard
session
posix
pcre
mysql
imap

[Zend Modules]
Not Implemented


The same script works fine on another server (with a different path to php)
so, not being  a Linux guru I'm stuck at this point. The script's
permissions are set to 755. Any help would be
great!

Many thanks
Kevin








--- End Message ---
--- Begin Message ---
Whenever a user runs the mail function, an e-mail messsage is sent
properly but the page just hangs.
 
Has anyone else had this problem?
--- End Message ---
--- Begin Message ---
Hello,

On 06/10/2002 12:07 PM, Phil Schwarzmann wrote:
> Whenever a user runs the mail function, an e-mail messsage is sent
> properly but the page just hangs.
>  
> Has anyone else had this problem?

I heard it happens on Windows but I am not sure why. It looks like it is 
missing \r\n somewhere.

Can you please tell if this PHP class works for you so we can realize 
that it is really a PHP bug?

http://www.phpclasses.org/smtpclass

-- 

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
I have read that the mail function doesn't come back if it fails ... but
from what you are saying, the function didn't fail ...

----- Original Message -----
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 4:07 PM
Subject: [PHP] mail() function hangs


> Whenever a user runs the mail function, an e-mail messsage is sent
> properly but the page just hangs.
>
> Has anyone else had this problem?
>

--- End Message ---
--- Begin Message ---
Miguel and others

Sorry about the OSX problem and Opera 6 issue, I am not responsible for the
web design, but will pass this on to the web designer.  You can also
directly view the sourceforge project at
http://www.sourceforge.net/projects/phpdocu which will probably work in OSX
IE 5.  However, I am not a web designer for sourceforge either and can take
no responsibility for any errors in display.  Certainly, none of the issues
you experience are intentional on the part of the web designer for
phpdoc.org, as you can probably imagine.

In defense of the web designer, he spent an entire day's work making the
page work with all browsers he had access to, including IE 5 for PC, IE 6
for PC, Mozilla 1, Netscape 6.2, and Netscape 4.7.  As I said, I've notified
him of the issues involved, and he plans to take care of them in his free
time.

Thank you,
Greg Beaver
phpDocumentor team
http://www.phpdoc.org <-- works with most browsers
http://www.sourceforge.net/projects/phpdocu <-- probably works with all
browsers

----- Original Message -----
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: "Greg Beaver" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 12:29 AM
Subject: Re: [PHP] phpDocumentor version 1.1.0rc1 RELEASE ANNOUNCEMENT


> On Sun, 9 Jun 2002, Greg Beaver wrote:
> > June 9, 2002
> > RELEASE ANNOUNCEMENT
> > phpDocumentor version 1.1.0rc1
> > http://www.phpdoc.org
>
> Best of all, with OSX IE 5.14, the page comes up completely blank.
>
> miguel
>
>
>

--- End Message ---

Reply via email to