[PHP-DB] how to explain such a regular syntax

2010-08-12 Thread win.a
Its was picked from drupal source code and i don't know how does it works.
This is the code :
preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $host);

After followed the regular syntax ,i try to cut it into pieces to make
it simpler to
understand ,
part a1: ^\[?
part a2:([a-z0-9-:\]_]+\.?)+$

Then go on cut part a2:
a2_1:  ?:
a2_2:  ([a-z0-9-:\]_]+\.?)+$
a2_3: a2_2 and   +$

a1 means:start with nothing or one "?"
a2_2 means character must be in a-z,0-9 ,"]","_" and the number must
be only one
a2_3 means there must be one and only matched a2_2 string .

And i dint't got a2_1 mean.
Anyone could explain the it works and the fault of my analysis are appreciated!


All you best

What we are struggling for ?
The life or the life ?

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



[PHP-DB] Re: pear template revoke problem

2010-06-29 Thread win.a
The problem resolved because the following line:
$tpl = new HTML_Template_IT("./template");

changed to :

$tpl = new HTML_Template_IT(".");

the .php works fine.

All you best

What we are struggling for ?
The life or the life ?




On Tue, Jun 29, 2010 at 2:55 PM, win.a  wrote:
> Hello,the phpers.i'm recently learn to use the pear HTML_Template_IT,
> The following is my test template test.tpl,the source code is :
> 
> 
> 
>  
>   
>    {DATA}
>   
> 
>  
>  
> 
>
> And my php revoke source code is :
>          require_once "HTML/Template/IT.php";
>
>        $data = array("Peter","Quagmire","Joe");
>
>        $tpl = new HTML_Template_IT("./template");
>
>        if (!$tpl) {
>                echo "object inital failed!";
>                echo "";
>        }
>        else
>                print "Object initial succeed!";
>
>        $tpl->loadTemplatefile("test.tpl", true, true)  ;
>
>        if (!$tpl) {
>                echo "template load failed!";
>                echo "";
>        }
>        else
>                print "template load succeed!";
>
>        foreach ($data as $sd  ){
>                //echo $sd;
>                //echo "";
>                $tpl->setCurrentBlock("CELL");
>                $tpl->setVariable("DATA", $sd);
>                $tpl->parseCurrentBlock("CELL");
>        }
>        $tpl->show();
> ?>
>
> When it runs it just result this :
>
> Object initial succeed!
> template load succeed!
>
> i don't why the array data are not displayed?Any comments are appreciated !
>
> All you best
> 
> What we are struggling for ?
> The life or the life ?
>

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



[PHP-DB] pear template revoke problem

2010-06-28 Thread win.a
Hello,the phpers.i'm recently learn to use the pear HTML_Template_IT,
The following is my test template test.tpl,the source code is :



 
   
{DATA}
   

  
 


And my php revoke source code is :
  ";
}
else
print "Object initial succeed!";

$tpl->loadTemplatefile("test.tpl", true, true)  ;

if (!$tpl) {
echo "template load failed!";
echo "";
}
else
print "template load succeed!";

foreach ($data as $sd  ){
//echo $sd;
//echo "";
$tpl->setCurrentBlock("CELL");
$tpl->setVariable("DATA", $sd);
$tpl->parseCurrentBlock("CELL");
}
$tpl->show();
?>

When it runs it just result this :

Object initial succeed!
template load succeed!

i don't why the array data are not displayed?Any comments are appreciated !

All you best

What we are struggling for ?
The life or the life ?

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



[PHP-DB] ie multi tab label share one cookie?

2010-06-09 Thread win.a
It's known  that the IE browser  share on session in the same APP
How about cookie ,the same ?or use its own?
Thanks in advacne!

All you best

What we are struggling for ?
The life or the life ?

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



[PHP-DB] Fatal error: Class 'Mail' not found in

2010-05-29 Thread win.a
Excuse me to trouble ,in my little application there's a mail function
which i revoked the pear package require 'mail.php'

when i test the app ,it show me "Fatal error: Class 'Mail' not found
",i checked the mail.php no Class Mail?
How can i solve the issue ,or where i can download the Mail.php
including Class Mail?

All you best

What we are struggling for ?
The life or the life ?

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



[PHP-DB] Call two class object failed

2010-05-23 Thread win.a
Hi my friend,i wrote two classed on is user,the other is db .The user
have a property which from the db class object .


When i writing my application have both class object invoked at the
same time ,just like
$user_a = new user($para);
$db_a = new db()

Then the problem occurs only one of the class object could work, or
$user_a or $db_a not both,What 's problem of my code

The following is my source code:

class db{
/**
 * Constructor
 */

var $result;
var $conn;

function  db(){
require_once BOC_BASE_DIR.'/config/db.config.inc';
$this->conn = mysql_connect($db_host,$db_user,$db_pass);
//$this->conn = @mysql_connect($db_host,$db_user,$db_pass);
if (!$this->conn) {
$this->db_print_error("DB connect failed");
}

if (!mysql_select_db($db_name,$this->conn)) {
$this->db_print_error("DB select failed");
}
}

class user{
private $u_sn;
private $u_id;
private $u_name;
private $u_sex;
private $u_image;

//more property

private $u_info;


/**
 * Constructor
 */
function __construct($name){
$sql = "select * from boc_user where u_name = '$name'";
$u_query = new db();
$this->u_info = array();
$u_query->db_query($sql);
$this->u_info =$u_query->db_fetch_row();

$this->u_sn = $this->u_info['u_sn'];
$this->u_id = $this->u_info['u_id'];
$this->u_name = $this->u_info['u_name'];
$this->u_sex = $this->u_info['u_sex'];

   //more are give the property value

}


The two class works well in the single application when only of them
are invoked ,i cost me much time to deal it
Any advice and suggestions are thankful !


All you best

What we are struggling for ?
The life or the life ?

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