php-general Digest 30 Jan 2006 03:52:03 -0000 Issue 3934

Topics (messages 229419 through 229438):

Re: XML and htmlentities conditionally?
        229419 by: Brian V Bonini
        229423 by: Adam Hubscher

How can I get ENUM values from column info?
        229420 by: afan.afan.net
        229431 by: Silvio Porcellana [tradeOver]
        229435 by: Afan Pasalic

Collecting info about columns in a table
        229421 by: Afan Pasalic
        229429 by: tedd
        229433 by: Gerry Danen
        229437 by: Gerry Danen

Re: query regard forms in PHP
        229422 by: James Benson
        229434 by: M. Sokolewicz

Integration between PHP and PostgreSQL
        229424 by: Mark

PHP charset problem
        229425 by: php . net mines

Support between MySQL and PHP
        229426 by: Philip R. Thompson
        229427 by: James Benson
        229428 by: Steve Edberg

PHP on domain...
        229430 by: Gustav Wiberg
        229432 by: Steve Edberg
        229436 by: Gustav Wiberg

Retrieve output from HTML or PHP file
        229438 by: Peter Lauri

Administrivia:

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

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

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Sun, 2006-01-29 at 02:01, Adam Hubscher wrote:
> I have a block of XML that looks as follows:
> 
> <name>&lt;*_~_*&gt; Røyken VGS &lt;*_~_*&gt;</name>

> My question is, can I in any way efficiently (i -stress- efficiently, if 
> anyone read my previous XML and special characters post its a rather 
> large XMl file (breaking 18mb now) and speed is of the essence) cause 
> html_entity_decode to not decode those tags?

What's the end results your looking for?

If you are trying to pass that data straight through the parser try
wrapping it in CDATA.

<name><![CDATA[&lt;*_~_*&gt; Røyken VGS &lt;*_~_*&gt;]]></name>

-- 

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


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

--- End Message ---
--- Begin Message ---
Brian V Bonini wrote:
On Sun, 2006-01-29 at 02:01, Adam Hubscher wrote:

I have a block of XML that looks as follows:

<name>&lt;*_~_*&gt; Røyken VGS &lt;*_~_*&gt;</name>


My question is, can I in any way efficiently (i -stress- efficiently, if anyone read my previous XML and special characters post its a rather large XMl file (breaking 18mb now) and speed is of the essence) cause html_entity_decode to not decode those tags?


What's the end results your looking for?

If you are trying to pass that data straight through the parser try
wrapping it in CDATA.

<name><![CDATA[&lt;*_~_*&gt; Røyken VGS &lt;*_~_*&gt;]]></name>


The information is used to keep a database up to date for a service that was created in order to provide more advanced functionality for the service that made it.

The XML file is not -mine-, and to search for all the html entities and wrap them in cdata before parsing would be kinda silly I think :O

So yea, thats what I was trying to avoid having to do :O

--- End Message ---
--- Begin Message ---
Hi to all,
I need to collect info about columns from a selected table.
I use this:

$result = mysql_query("SELECT * FROM ". $TableName);
$fields = mysql_num_fields($result);
for ($i=0; $i < $fields; $i++)
{
        $type  = mysql_field_type($result, $i);
        $name  = mysql_field_name($result, $i);
        $len  = mysql_field_len($result, $i);
        $flags = mysql_field_flags($result, $i);

   echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
}

If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
ONLY 'enum'.
How can I get all ENUM values?

Thanks for any help or direction.

-afan

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:

If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
ONLY 'enum'.
How can I get all ENUM values?

Thanks for any help or direction.

-afan


This doesn't really seem a PHP question... BUT... give a look here:
http://dev.mysql.com/doc/refman/5.0/en/enum.html

There is one user comment ('Posted by J. Santiago Scarfo on March 31 2005 7:16pm') that I think can help you.

Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

--- End Message ---
--- Begin Message --- I saw that one. Actually, I'm using right now the code below the one you mentiones (from Peter Rekdal). but was thinking that there is kind of pre-defines php function, smething like mysql_field_name(), or mysql_field_len(), or mysql_field_flags(). That's why I posted my question on this group. :)

Thanks Silvio.

-afan


On Sun, 29 Jan 2006 15:50:07 -0600, Silvio Porcellana [tradeOver] <[EMAIL PROTECTED]> wrote:

[EMAIL PROTECTED] wrote:
If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
ONLY 'enum'.
How can I get all ENUM values?
 Thanks for any help or direction.
 -afan


This doesn't really seem a PHP question... BUT... give a look here:
http://dev.mysql.com/doc/refman/5.0/en/enum.html

There is one user comment ('Posted by J. Santiago Scarfo on March 31 2005 7:16pm') that I think can help you.

Silvio




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--- End Message ---
--- Begin Message ---
Hi to all,
I need to collect info about columns from a selected table.
I use this:

$result = mysql_query("SELECT * FROM ". $TableName);
$fields = mysql_num_fields($result);
for ($i=0; $i < $fields; $i++)
{
        $type  = mysql_field_type($result, $i);
        $name  = mysql_field_name($result, $i);
        $len  = mysql_field_len($result, $i);
        $flags = mysql_field_flags($result, $i);

   echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
}

If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show ONLY 'enum'.
How can I get all ENUM values?

Thanks for any help or direction.

-afan

--- End Message ---
--- Begin Message ---
Hi to all,
I need to collect info about columns from a selected table.
I use this:

$result = mysql_query("SELECT * FROM ". $TableName);
$fields = mysql_num_fields($result);
for ($i=0; $i < $fields; $i++)
{
        $type  = mysql_field_type($result, $i);
        $name  = mysql_field_name($result, $i);
        $len  = mysql_field_len($result, $i);
        $flags = mysql_field_flags($result, $i);

   echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
}

If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show ONLY 'enum'.
How can I get all ENUM values?

Thanks for any help or direction.

-afan

-afan:

        $type  = mysql_field_type($result, 'live');
        $name  = mysql_field_name($result, 'hidden');
        $len  = mysql_field_len($result, 'pending');

Provided that 'live', 'hidden', 'pending' are fields in your table.

tedd
--
--------------------------------------------------------------------------------
http://sperling.com/

--- End Message ---
--- Begin Message ---
I think Afan means they are values in an enum field. But I may be mistaken... :)

Gerry

On 1/29/06, tedd <[EMAIL PROTECTED]> wrote:
> >Hi to all,
> >I need to collect info about columns from a selected table.
> >I use this:
> >
> >$result = mysql_query("SELECT * FROM ". $TableName);
> >$fields = mysql_num_fields($result);
> >for ($i=0; $i < $fields; $i++)
> >{
> >       $type  = mysql_field_type($result, $i);
> >       $name  = mysql_field_name($result, $i);
> >       $len  = mysql_field_len($result, $i);
> >       $flags = mysql_field_flags($result, $i);
> >
> >    echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
> >}
> >
> >If I have columns type ENUM('live', 'hidden', 'pending'), $flags
> >will show ONLY 'enum'.
> >How can I get all ENUM values?
> >
> >Thanks for any help or direction.
> >
> >-afan
>
> -afan:
>
>         $type  = mysql_field_type($result, 'live');
>         $name  = mysql_field_name($result, 'hidden');
>         $len  = mysql_field_len($result, 'pending');
>
> Provided that 'live', 'hidden', 'pending' are fields in your table.

--
Gerry
http://portal.danen.org/

--- End Message ---
--- Begin Message ---
Afan,

Here's some code that will show enum values:


$q2 = "describe ". $tname . " ;";
$r2 = mysql_query($q2) or die(mysql_error());
while ( $a2 = mysql_fetch_array($r2) )
{
        $els = count($a2);
        echo "<br>";
        for ($i2 = 0; $i2 < $els; $i2++)
        {
                $f = $a2[$i2] ;
                if ($f == "") $f = "&nbsp;";
                echo $f . " | ";
        }
        echo "\n";
}

Perhaps combining it with your code will give you what you need.

Gerry

On 1/29/06, Afan Pasalic <[EMAIL PROTECTED]> wrote:
> Hi to all,
> I need to collect info about columns from a selected table.
> I use this:
>
> $result = mysql_query("SELECT * FROM ". $TableName);
> $fields = mysql_num_fields($result);
> for ($i=0; $i < $fields; $i++)
> {
>         $type  = mysql_field_type($result, $i);
>         $name  = mysql_field_name($result, $i);
>         $len  = mysql_field_len($result, $i);
>         $flags = mysql_field_flags($result, $i);
>
>     echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
> }
>
> If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
> ONLY 'enum'.
> How can I get all ENUM values?
>
> Thanks for any help or direction.
>
> -afan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Gerry
http://portal.danen.org/

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

suresh kumar wrote:
>  hai,
>         i am having 3 files,namely page1,page2  and page3,when i enter 
> username and password in my first page i want 2  display  my username and 
> password  in my third page through  second page.
>   
>                                                                  A.suresh
>   
> 
>                               
> ---------------------------------
>  Jiyo cricket on Yahoo! India cricket




You want to be using sessions


http://php.net/session




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

Master CIW Designer          http://www.ciwcertified.com
Zend Certified Engineer      http://www.zend.com


http://www.jamesbenson.co.uk

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

--- End Message ---
--- Begin Message ---
look Suresh Kumar,

you came to this list about 2 weeks ago stating "i am working as a web designer in PHP & Mysql.i know the basics of PHP & Mysql". Since that post, you've posted the following questions: 1. i dont know how 2 store images in gif/jpeg format in Mysql Database.i also want 2 know PHP Code 2 store images in Mysql Database. reply me soon its very urgent . 2. i dont know exact PHP code for how 2 open file browser window to uplad file or an image plz help me.its very urgent.
3. a JS question ending in "plz help me itz very urgent."
4. for eg while(list(t1,t2,...)=mysql_fetch_row($result)): endwhile; while i use $t1 ouside while loop ,its corresponding value is not displaying,how can i display the value of $t1. 5. am having 3 files Login.php,home.php and home1.php when i entered username and passwd in my first login page i want want i entered as username and passwd in my third page ie home1.php.

Now, from these 5 posts you've made, I would like to advise you this: you do NOT know the basics of PHP/MySQL. PLEASE, learn at LEAST the basics of PHP and MySQL, get a book, attend a class, read a couple of tutorials, etc. But most of all, please, get a basic understanding of how PHP works (serverside vs. clientside, sessions/posting/getting data, etc).

By posting all these questions, you're getting either annoyed responses, or just 1 word (or URL) ones. Why? Because it's clear that giving you responses which explain everything simply won't work for you, because you don't have the basis to understand (and repeat) them.

hope you'll continue using PHP and actually delve a bit into it before continuing along the path as you're doing now,
- tul

P.S. this was not meant as a (personal) rant. If it appeares as such, then sorry, it is not meant to be.

suresh kumar wrote:
 hai,
        i am having 3 files,namely page1,page2  and page3,when i enter username 
and password in my first page i want 2  display  my username and password  in 
my third page through  second page.
A.suresh
                                
---------------------------------
 Jiyo cricket on Yahoo! India cricket

--- End Message ---
--- Begin Message ---
I have a couple extensions that maybe useful for PHP users who use
PostgreSQL.

I have a serializer for PHP that serializes session data to a documented XML
format. That extension is called XMLDBX. I also have a PostgreSQL extension
that will read this XML data and allow you to query it.

select xmldbx('data.myclass.userid', mytable.session)

$myclass['userid'] or $myclass->userid will be returned if it was
serialized.

more info at:

http://www.mohawksoft.org

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

I'm using PHP 4.x and MySQL 3.x. I'm saving in my DB various fields with greek text. What I need to do is pass that data to flash in UTF format, but the MySQL doesn't support UTF.

Is there a way to take the greek text and convert it to UTFchars so Flash can read it?

Many Thanks

Mario
--- End Message ---
--- Begin Message ---
Hi all.

I figured this question was suitable for both the MySQL list and the 
PHP-General list. Here's what I'm running into.

I just installed MySQL5 and currently have PHP 4.3.11 installed. I 
am wanting to connect to the mysql database on localhost, but I 
get the following results:

----------
<?  $link = mysql_connect('localhost', 'user', 'password');  ?>
"Client does not support authentication protocol requested by 
server; consider upgrading MySQL client"
----------

Well, I have the lastest stable version of MySQL, so I did some more 
research on what the problem might be. When I checked my 
information for PHP using phpinfo(), it gave me the "Client API 
version" for MySQL was 3.23.49. So, I'm thinking my version of PHP 
cannot connect to my version of MySQL. I then considered if I 
installed the MySQLi extension for PHP (supports versions of MySQL 
> 4.1), would that help me? Or, if I just upgraded PHP to version 5, 
would that help me?

Does anyone have any suggestions on the direction I should go?

Thanks in advance,
~Philip

--- End Message ---
--- Begin Message ---
Downgrading to MySQL 4.1 should fix the problem.




Philip R. Thompson wrote:
> Hi all.
> 
> I figured this question was suitable for both the MySQL list and the 
> PHP-General list. Here's what I'm running into.
> 
> I just installed MySQL5 and currently have PHP 4.3.11 installed. I 
> am wanting to connect to the mysql database on localhost, but I 
> get the following results:
> 
> ----------
> <?  $link = mysql_connect('localhost', 'user', 'password');  ?>
> "Client does not support authentication protocol requested by 
> server; consider upgrading MySQL client"
> ----------
> 
> Well, I have the lastest stable version of MySQL, so I did some more 
> research on what the problem might be. When I checked my 
> information for PHP using phpinfo(), it gave me the "Client API 
> version" for MySQL was 3.23.49. So, I'm thinking my version of PHP 
> cannot connect to my version of MySQL. I then considered if I 
> installed the MySQLi extension for PHP (supports versions of MySQL 
>> 4.1), would that help me? Or, if I just upgraded PHP to version 5, 
> would that help me?
> 
> Does anyone have any suggestions on the direction I should go?
> 
> Thanks in advance,
> ~Philip

-- 



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

Master CIW Designer          http://www.ciwcertified.com
Zend Certified Engineer      http://www.zend.com


http://www.jamesbenson.co.uk

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

--- End Message ---
--- Begin Message ---
At 1:18 PM -0600 1/29/06, Philip R. Thompson wrote:
Hi all.

I figured this question was suitable for both the MySQL list and the
PHP-General list. Here's what I'm running into.

I just installed MySQL5 and currently have PHP 4.3.11 installed. I
am wanting to connect to the mysql database on localhost, but I
get the following results:

----------
<?  $link = mysql_connect('localhost', 'user', 'password');  ?>
"Client does not support authentication protocol requested by
server; consider upgrading MySQL client"
----------

Well, I have the lastest stable version of MySQL, so I did some more
research on what the problem might be. When I checked my
information for PHP using phpinfo(), it gave me the "Client API
version" for MySQL was 3.23.49. So, I'm thinking my version of PHP
cannot connect to my version of MySQL. I then considered if I
installed the MySQLi extension for PHP (supports versions of MySQL
 4.1), would that help me? Or, if I just upgraded PHP to version 5,
would that help me?

Does anyone have any suggestions on the direction I should go?


Yes, the authentication protocol for MySQL changed at (I think) version 4.1. While you *could* downgrade MySQL, you could also upgrade your MySQL client libraries, which is what I would recommend. If PHP was compiled statically, you'll have to recompile it; otherwise you can just upgrade MySQL client libraries.

One other question: have you restarted your webserver since the MySQL upgrade? If not, it's possible the libraries were upgraded when MySQL was but your web server isn't using them. You could check by running php -i | grep -i mysql on the commandline, or just restart the webserver and recheck phpinfo().

The MySQLi is officially supported by PHP5 only, although apparently a number of people are using it with PHP4.

For more info, see:

http://dev.mysql.com/doc/refman/4.1/en/php.html

http://dev.mysql.com/doc/refman/4.1/en/application-password-use.html

http://www.php.net/mysql

http://www.php.net/mysqli

        steve

--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg                                http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center                            [EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin             (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+

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

How can you check if a domain (that you don't own), can run PHP-code?

Is it possible?
/G
@varupiraten.se

--- End Message ---
--- Begin Message ---
At 10:08 PM +0100 1/29/06, Gustav Wiberg wrote:
Hi guys!

How can you check if a domain (that you don't own), can run PHP-code?

Is it possible?
/G
@varupiraten.se


Answer 1:

Call them, fax them, email them, IM them, or check their website. This is the only way to know for sure.

Answer 2:

Check http://netcraft.com/

I don't know all the tools they use to record server information, but I presume that it includes methods like Answer 3 below.

Answer 3:

If you want to do this via a program, the answer is - in general, no. However, many servers will return an HTTP header containing this info. Also, (at least on Apache) server signatures may be set to reveal this info on error displays. You could open a socket connection to port 80 of the desired domain, and issue a HEAD request. You'll have to parse the results for Server and/or X-Powered-By and possibly other headers. Here's some examples via telnet:

telnet <domain deleted> 80
Trying <ip address deleted>...
Connected to <domain deleted>.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 200 OK
Date: Sun, 29 Jan 2006 21:23:03 GMT
Server: Apache
Content-Type: text/html
Connection: close



telnet <domain deleted> 80
Trying <ip address deleted>...
Connected to <domain deleted>.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 403 Access Forbidden
Server: Microsoft-IIS/5.0
Date: Sun, 29 Jan 2006 21:32:26 GMT
Content-Length: 4126
Content-Type: text/html



telnet <domain deleted> 80
Trying <ip address deleted>...
Connected to <domain deleted>.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 302 Moved Temporarily
Date: Sun, 29 Jan 2006 21:36:52 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
X-Powered-By: PHP/4.3.10
Location: index_html.html
Content-Type: text/html
Connection: close



However, many servers are set to not reveal this info for security purposes; it could also be spoofed for the same reason. For example, the second site above (the IIS one) actually *does* support PHP according to their website. See

        http://www.php.net/manual/en/ref.sockets.php

for info on opening & reading from sockets; there is an example on this page in the user comments about sending HTTP HEAD requests.

        steve

--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg                                http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center                            [EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin             (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+

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

----- Original Message ----- From: "Steve Edberg" <[EMAIL PROTECTED]> To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" <php-general@lists.php.net>
Sent: Sunday, January 29, 2006 10:51 PM
Subject: Re: [PHP] PHP on domain...


At 10:08 PM +0100 1/29/06, Gustav Wiberg wrote:
Hi guys!

How can you check if a domain (that you don't own), can run PHP-code?

Is it possible?
/G
@varupiraten.se


Answer 1:

Call them, fax them, email them, IM them, or check their website. This is the only way to know for sure.

Answer 2:

Check http://netcraft.com/

I don't know all the tools they use to record server information, but I presume that it includes methods like Answer 3 below.

Answer 3:

If you want to do this via a program, the answer is - in general, no. However, many servers will return an HTTP header containing this info. Also, (at least on Apache) server signatures may be set to reveal this info on error displays. You could open a socket connection to port 80 of the desired domain, and issue a HEAD request. You'll have to parse the results for Server and/or X-Powered-By and possibly other headers. Here's some examples via telnet:

telnet <domain deleted> 80
Trying <ip address deleted>...
Connected to <domain deleted>.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 200 OK
Date: Sun, 29 Jan 2006 21:23:03 GMT
Server: Apache
Content-Type: text/html
Connection: close



telnet <domain deleted> 80
Trying <ip address deleted>...
Connected to <domain deleted>.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 403 Access Forbidden
Server: Microsoft-IIS/5.0
Date: Sun, 29 Jan 2006 21:32:26 GMT
Content-Length: 4126
Content-Type: text/html



telnet <domain deleted> 80
Trying <ip address deleted>...
Connected to <domain deleted>.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 302 Moved Temporarily
Date: Sun, 29 Jan 2006 21:36:52 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
X-Powered-By: PHP/4.3.10
Location: index_html.html
Content-Type: text/html
Connection: close



However, many servers are set to not reveal this info for security purposes; it could also be spoofed for the same reason. For example, the second site above (the IIS one) actually *does* support PHP according to their website. See

http://www.php.net/manual/en/ref.sockets.php

for info on opening & reading from sockets; there is an example on this page in the user comments about sending HTTP HEAD requests.

steve

--
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg                                http://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center                            [EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin             (530)754-9127 |
+---------------- said t e lawrence, picking up his fork ----------------+

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

Hi there!

Thanx for info!

/G

--- End Message ---
--- Begin Message ---
Best group member,

 

I have a php script running and need to save the output from an HTML-file or
PHP-file. What I want to do:

 

$the_output = thenicefunction('file.html');

 

Any suggestions?

 

/Peter

 

 

 

 

 


--- End Message ---

Reply via email to