[PHP] Re: Newbie form question

2013-06-21 Thread Jim Giner

On 6/21/2013 10:09 AM, Karl-Arne Gjersøyen wrote:

Hello.

I have an application that generete HTML5 form in PHP.
The form is written in a while loop and therefore the form field has exact
same name for every row in the loop.
And that is the problem. Because when my PHP document shall handle
submitted data it only take the very last row in the while loop and show
the result of it.

if(isset($_POST['update_explosive'])){
 $item_serial_number = $_POST['item_serial_number'];
 $update_item_in_store = $_POST['update_item_in_store'];

 if($item_serial_number === ETX1.22X1000){
 echo h1$update_item_in_store/h1;
 }
 if($item_serial_number === ETX1.17X460){
 echo h1$update_item_in_store/h1;
 }
 }

I think the solution will be to create different and unike fieldname
dymamic. For example I tried to write input type=text name=?php echo
$item_serial_number; ? value=?php echo $item_serial_number; ? in
the HTML5/PHP form.

But the problem is that periode . not is allowed as $variable_name.
I then try to write it this way:

if(isset($_POST['update_explosive'])){
 $item_serial_number = $_POST['ETX1.22X1000'];
 $update_item_in_store = $_POST['update_item_in_store'];

 if($item_serial_number === ETX1.22X1000){
 echo h1$update_item_in_store/h1;
 }
 if($item_serial_number === ETX1.17X460){
 echo h1$update_item_in_store/h1;
 }
 }

But this last part did not make any sense to me. I recive no output when
tried that one.

One problem is that I have between 2 and 25 items with different serial
number. Sometimes only 5 of this shall be updated and other times all 25
items. I like to do this through one simple form and not for one time for
every single item. (I know how to do when select one by one and update
them, but that is a long and hard way for people using my application. A
better solution is to just use one form and view all items there. Then just
write the amount of item in input type=number
name=update_item_in_store size=6 field.)

If you have time to help me *understand* this newbie question by explain or
give me an example or post a link to a tutorial that can help me though, I
am very thankful.

Karl


Make your names on your input tags like this:
if you currently have
input type='text' name='field1'
then change it to this:
input type='text' name='field1[]'

This will give you an array of in your POST/GET array.



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



[PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-15 Thread dealTek

Thanks for all the help folks,


PHP-light-PDO-Class

ok well I found this...

https://github.com/poplax/PHP-light-PDO-Class

But it does not seem to recognize the port - I put the port as 8889 but keeps 
saying can't connect port 3306

Warning: PDO::__construct() [pdo.--construct]: [2002] Connection refused 
(trying to connect via tcp://127.0.0.1:3306) in 
/Users/revdave/Sites/php-fool/pdo3/PHP-light-PDO-Class-master/class.lpdo.php on 
line 33
Connection failed: SQLSTATE[HY000] [2002] Connection refused

BTW: I tried to add the port a few places but it didn't work..


How do we fix this?



-- config.php

?php
$config = array();
$config['Database'] = array();
$config['Database']['dbtype'] = 'mysql';
$config['Database']['dbname'] = 'tester';
$config['Database']['host'] = '127.0.0.1';
$config['Database']['port'] = 8889;
$config['Database']['username'] = 'root';
$config['Database']['password'] = 'root';
$config['Database']['charset'] = 'utf8';
?

===  class.lpdo.php


?php
/**
 * 
 * @Author : Poplax [Email:linjiang9...@gmail.com]; 
 * @Date : Fri Jun 03 10:17:17 2011;
 * @Filename class.lpdo.php;
 */

/**
 * class lpdo PDO
 * one table support only
 */
class lpdo extends PDO
{
public $sql = '';
public $tail = '';
private $charset = 'UTF8';
private $options;

/**
 * 
 * @Function : __construct;
 * @Param  $ : $options Array DB config ;
 * @Return Void ;
 */
public function __construct($options)
{
$this-options = $options;
$dsn = $this-createdsn($options);
$attrs = empty($options['charset']) ? 
array(PDO::MYSQL_ATTR_INIT_COMMAND = SET NAMES  . $this-charset) : 
array(PDO::MYSQL_ATTR_INIT_COMMAND = SET NAMES  . $options['charset']);
try
{
parent::__construct($dsn, $options['username'], 
$options['password'], $attrs);
}
catch (PDOException $e)
{
echo 'Connection failed: ' . $e-getMessage();
}
}

/**
 * 
 * @Function : createdsn;
 * @Param  $ : $options Array;
 * @Return String ;
 */
private function createdsn($options)
{
return $options['dbtype'] . ':host=' . $options['host'] . 
';dbname=' . $options['dbname'];
}

/**
 * 
 * @Function : get_fields;
 * @Param  $ : $data Array;
 * @Return String ;
 */
private function get_fields($data)
{
$fields = array();
if (is_int(key($data)))
{
$fields = implode(',', $data);
}
else if (!empty($data))
{
$fields = implode(',', array_keys($data));
}
else
{
$fields = '*';
}
return $fields;
}

/**
 * 
 * @Function : get_condition;
 * @Param  $ : $condition Array, $oper String, $logc String;
 * @Return String ;
 */
private function get_condition($condition, $oper = '=', $logc = 'AND')
{
$cdts = '';
if (empty($condition))
{
return $cdts = '';
}
else if (is_array($condition))
{
$_cdta = array();
foreach($condition as $k = $v)
{
if (!is_array($v))
{
if (strtolower($oper) == 'like')
{
$v = '\'%' . $v . '%\'';
}
else if (is_string($v))
{
$v = '\'' . $v . '\'';
}
$_cdta[] = ' ' . $k . ' ' . $oper . ' ' 
. $v . ' ' ;
}
else if (is_array($v))
{
$_cdta[] = $this-split_condition($k, 
$v);
}
}
$cdts .= implode($logc, $_cdta);
}
return $cdts;
}

/**
 * 
 * @Function : split_condition;
 * @Param  $ : $field String, $cdt Array;
 * @Return String ;
 */
private function split_condition($field, $cdt)
{
$cdts = array();
$oper = empty($cdt[1]) ? '=' : $cdt[1];
 

[PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-15 Thread David Robley
dealTek wrote:

 
 Thanks for all the help folks,
 
 
 PHP-light-PDO-Class
 
 ok well I found this...
 
 https://github.com/poplax/PHP-light-PDO-Class
 
 But it does not seem to recognize the port - I put the port as 8889 but
 keeps saying can't connect port 3306
 
 Warning: PDO::__construct() [pdo.--construct]: [2002] Connection refused
 (trying to connect via tcp://127.0.0.1:3306) in
 /Users/revdave/Sites/php-fool/pdo3/PHP-light-PDO-Class-
master/class.lpdo.php
 on line 33 Connection failed: SQLSTATE[HY000] [2002] Connection refused
 
 BTW: I tried to add the port a few places but it didn't work..
 
 
 How do we fix this?
 
 
 
 -- config.php
 
 ?php
 $config = array();
 $config['Database'] = array();
 $config['Database']['dbtype'] = 'mysql';
 $config['Database']['dbname'] = 'tester';
 $config['Database']['host'] = '127.0.0.1';
 $config['Database']['port'] = 8889;
 $config['Database']['username'] = 'root';
 $config['Database']['password'] = 'root';
 $config['Database']['charset'] = 'utf8';
 ?

Change host to localhost - your mysql may be configured not to accept 
requests via tcp.

 
 ===  class.lpdo.php
SNIP
 
 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]

-- 
Cheers
David Robley

My karma ran over my dogma


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



[PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread dealTek


On Feb 14, 2013, at 9:49 AM, dealTek deal...@gmail.com wrote:

 Hi everybody,
 
 Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
 (using CRUD)
 
 Simple story: creating this class database by myself is way over my head. So 
 it be best for me to find something on the Internet that has already been 
 created and working to pro specs (using CRUD with good security etc).
 
 In my studying, it seems that there is a difference between MySQL and MySQLi 
 - MySQLi  being the preferred choice if I understand correctly.
 
 There are lots of examples on the Internet however I don't know enough about 
 it to know a good starting example from a bad starting example, so I would 
 much appreciate any assistance pointing me towards a good starting point
 
 This seems a good start to me untrained eye, but it seems to be for mysql - 
 not mysqli...
 
 http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/
 
 http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/
 
 http://snipplr.com/view/8417/
 
 http://snipplr.com/view/12535/
 
 any assistance is appreciated!



An Here Jeffry Way discusses the PDO API

http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/






 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]
 


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]


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



Re: [PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-14 Thread Haluk Karamete
Also worth checking http://justinvincent.com/ezsql
Which is the class behind the WordPress' wpdb class.

This is a great read too -
http://www.devarticles.com/c/a/MySQL/PHP-and-Databases-for-the-Lazy-Sod/

On Thu, Feb 14, 2013 at 10:30 AM, dealTek deal...@gmail.com wrote:


 On Feb 14, 2013, at 9:49 AM, dealTek deal...@gmail.com wrote:

 Hi everybody,

 Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class 
 (using CRUD)

 Simple story: creating this class database by myself is way over my head. So 
 it be best for me to find something on the Internet that has already been 
 created and working to pro specs (using CRUD with good security etc).

 In my studying, it seems that there is a difference between MySQL and MySQLi 
 - MySQLi  being the preferred choice if I understand correctly.

 There are lots of examples on the Internet however I don't know enough about 
 it to know a good starting example from a bad starting example, so I would 
 much appreciate any assistance pointing me towards a good starting point

 This seems a good start to me untrained eye, but it seems to be for mysql - 
 not mysqli...

 http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/

 http://www.dreamincode.net/forums/topic/223360-connect-to-your-database-using-oop-php5-with-mysql-and-mysqli/

 http://snipplr.com/view/8417/

 http://snipplr.com/view/12535/

 any assistance is appreciated!



 An Here Jeffry Way discusses the PDO API

 http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/







 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]



 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]


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


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



[PHP] Re: newbie date time question

2011-06-22 Thread Shawn McKenzie
On 06/22/2011 09:05 AM, David Nicholls wrote:
 I'm trying to convert a date and time string using strtotime()
 
 The date and time strings are the first entry in each line in a csv file
 in the form:
 
 22/06/2011 9:47:20 PM, data1, data2,...
 
 I've been trying to use the following approach, without success:
 
 function read_data($filename)
 {
 $f = fopen($filename, 'r');
 while ($d = fgetcsv($f)) {
 
 $format = 'd/m/Y h:i:s';
 $dt = DateTime::createFromFormat($format, $d[0]);
 
 $data[] = array(strtotime($dt), $d[1]); //convert date/time
 }
 fclose($f);
 return $data;
 }
 
 Obviously I'm not getting the $format line right, as the resulting $dt
 values are empty.  (I have previously used this reading process
 successfully with better behaved date and time strings).
 
 Advice appreciated.
 
 DN

I'm late to the party, but strtotime works great, though you need to
give it what it expects:

$ts = strtotime(str_replace('/', '-', $date));

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: newbie date time question

2011-06-22 Thread David Nicholls

On 23/06/11 1:35 AM, Shawn McKenzie wrote:

On 06/22/2011 09:05 AM, David Nicholls wrote:

I'm trying to convert a date and time string using strtotime()

The date and time strings are the first entry in each line in a csv file
in the form:

22/06/2011 9:47:20 PM, data1, data2,...

I've been trying to use the following approach, without success:

function read_data($filename)
{
 $f = fopen($filename, 'r');
 while ($d = fgetcsv($f)) {

 $format = 'd/m/Y h:i:s';
 $dt = DateTime::createFromFormat($format, $d[0]);

 $data[] = array(strtotime($dt), $d[1]); //convert date/time
 }
 fclose($f);
 return $data;
}

Obviously I'm not getting the $format line right, as the resulting $dt
values are empty.  (I have previously used this reading process
successfully with better behaved date and time strings).

Advice appreciated.

DN


I'm late to the party, but strtotime works great, though you need to
give it what it expects:

$ts = strtotime(str_replace('/', '-', $date));



Thanks, Shawn, that's a bit more elegant!  I'll give it a go. I didn't 
know how to do the str_relace bit.  Thanks


DN

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



[PHP] Re: newbie date time question

2011-06-22 Thread Shawn McKenzie
On 06/22/2011 06:54 PM, David Nicholls wrote:
 I'm late to the party, but strtotime works great, though you need to
 give it what it expects:

 $ts = strtotime(str_replace('/', '-', $date));

 
 Thanks, Shawn, that's a bit more elegant!  I'll give it a go. I didn't
 know how to do the str_relace bit.  Thanks

The deal is that if you use the / then strtotime interprets it as m/d/y
and if you use - it interprets it as d-m-y.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: newbie date time question

2011-06-22 Thread David Nicholls

On 23/06/11 10:04 AM, Shawn McKenzie wrote:

On 06/22/2011 06:54 PM, David Nicholls wrote:

I'm late to the party, but strtotime works great, though you need to
give it what it expects:

$ts = strtotime(str_replace('/', '-', $date));



Thanks, Shawn, that's a bit more elegant!  I'll give it a go. I didn't
know how to do the str_relace bit.  Thanks


The deal is that if you use the / then strtotime interprets it as m/d/y
and if you use - it interprets it as d-m-y.




Yes, I knew the '-' format would work, I just didn't know quite how to 
convert the '/' to '-'.  A very simple and clean solution.


The final form is:

function read_data($filename)
{
$f = fopen($filename, 'r');
while ($d = fgetcsv($f)) {
$ts = strtotime(str_replace('/','-',$d[0]));
$data[] = array($ts, $d[1]);
}
fclose($f);
return $data;
}

DN

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



[PHP] Re: Newbie Question about Conditionals

2010-03-31 Thread Shawn McKenzie
Matty Sarro wrote:
 Hey all!
 This is probably my second post on the list, so please be gentle. Right now
 I am running through the Heads First PHP and MySQL book from O'Reilly.
 It's been quite enjoyable so far, but I have some questions about some of
 the code they're using in one of the chapters.
 
 Basically the code is retreiving rows from a DB, and I'm just not getting
 the explanation of how it works.
 
 Here's the code:
 
 $result=mysqli_query($dbc,$query)
 
 while($row=mysqli_fetch_array($result)){
 echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] . 'br
 /';
 }
 
 Now, I know what it does, but I don't understand how the conditional
 statement in the while loop works. Isn't an assignment operation always
 going to result in a true condition? Even if mysqli_fetch_array($result)
 returned empty values (or null) wouldn't the actual assignment to $row still
 be considered a true statement? I would have sworn that assignment
 operations ALWAYS equated to true if used in conditional operations.
 Please help explain! :)
 
 Thanks so much!
 -Matty
 

Others have explained in detail, but I will tell you why you and many
beginners may have been confused by this.  On this list as well as in
other help sites for PHP, beginners post code that contains something
like this, and wonder why it always echoes TRUE:

$value = 'bob';

if($value = 'test') {
echo 'TRUE';
} else {
echo 'FALSE';
}

They normally get an answer such as:  You need to use == for
comparison, = is an assignment operator and the assignment will always
evaluate to true.  Well, this is true for this assignment because the
non-empty string 'test' evaluates to true.  But without explanation it
may sound as though ANY assignment will evaluate to true just because
the actual assignment itself was successful. This is obviously not the
case. This echoes FALSE:

$value = 'bob';

if($value = '') {
echo 'TRUE';
} else {
echo 'FALSE';
}


-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] RE: Newbie: can't access a return value.

2009-08-01 Thread MEM
Solved. Forget to assigning the return value of the method to anything. :S
Sorry.

Márcio

 -Original Message-
 From: MEM [mailto:tal...@gmail.com]
 Sent: sábado, 1 de Agosto de 2009 17:13
 To: 'php-general@lists.php.net'
 Subject: Newbie: can't access a return value.
 
 Hi all,
 
 When I do this:
 $associacao_dao-listar($limit, $offset);
 
 I can var_dump the correct $limit.
 I can var_dump the correct $offset.
 
 I CAN'T access the object that I was hoping to get, called $records.
 
 After this, I was hoping to do var_dump($records); and see the stdClass
 object.
 
 
 
 
 Here is the listar method:
 
 public function listar($limit=null, $offset=null)
 {
   $query_str=SELECT * FROM associacao;
 
   $stmt = $this-_dbh-prepare($query_str . ' LIMIT ?, ?');
   $stmt-bindParam(1, $limit, PDO::PARAM_INT);
   $stmt-bindParam(2, $offset, PDO::PARAM_INT);
 
   $stmt-execute();
 
   $records = $stmt-fetchAll(PDO::FETCH_OBJ);
 
   return $records;
 }
 
 
 
 Any help will be greatly appreciated.
 
 
 Thanks a lot in advance,
 Márcio


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



[PHP] Re: newbie question - php parsing

2009-07-23 Thread Peter Ford
João Cândido de Souza Neto wrote:
 You made a mistake in your code:
 
 ?php the_title(); ?
 
 must be:
 
 ?php echo the_title(); ?
 

Not necessarily: what if you have

function the_title()
{
echo Title;
}

for example...


In response to Sebastiano:

There would be not much point in using something like PHP if it ignored the if
statements in the code!
What effectively happens in a PHP source file is that all the bits outside of
the ?php ? tags are treated like an echo statement (except that it handles
quotes and stuff nicely)

Your original code:

?php if (the_title('','',FALSE) != 'Home') { ?
h2 class=entry-header?php the_title(); ?/h2
?php } ?

can be read like:

?php
if (the_title('','',FALSE) != 'Home') {
echo 'h2 class=entry-header';
the_title();
echo '/h2';
}
?

You might even find a small (but probably really, really, really small)
performance improvement if you wrote it that way, especially if it was in some
kind of loop.
Note that I prefer to keep HTML separate from PHP as much as possible because it
helps me to read it and helps my editor check my syntax and HTML structure 
better...


-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] Re: newbie question - php parsing

2009-07-23 Thread Sebastiano Pomata
Thanks, it's now much more clear. I thought that html parts outside
php tags were just dumped to output, no matter of if-else statements
and other conditions. I was *definitely* wrong

2009/7/23 Peter Ford p...@justcroft.com:

 In response to Sebastiano:

 There would be not much point in using something like PHP if it ignored the 
 if
 statements in the code!
 What effectively happens in a PHP source file is that all the bits outside of
 the ?php ? tags are treated like an echo statement (except that it handles
 quotes and stuff nicely)

 Your original code:

 ?php if (the_title('','',FALSE) != 'Home') { ?
 h2 class=entry-header?php the_title(); ?/h2
 ?php } ?

 can be read like:

 ?php
 if (the_title('','',FALSE) != 'Home') {
    echo 'h2 class=entry-header';
    the_title();
    echo '/h2';
 }
 ?

 You might even find a small (but probably really, really, really small)
 performance improvement if you wrote it that way, especially if it was in some
 kind of loop.
 Note that I prefer to keep HTML separate from PHP as much as possible because 
 it
 helps me to read it and helps my editor check my syntax and HTML structure 
 better...


 --
 Peter Ford                              phone: 01580 89
 Developer                               fax:   01580 893399
 Justcroft International Ltd., Staplehurst, Kent

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



RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-22 Thread MEM
   As for (1) even in my pre-OO days I was used to using a single
   generic DAO for all database access. The only time that more
   than one DAO existed was for a different DBMS engine. This
   is why I have one DAO class for MySQL, one for PostgreSQL
   and another for Oracle. If you are incapable of writing  a
   single generic DAO then it just shows that you still have a lot to
   learn. For an idea on how this works take a look at
   http://www.tonymarston.net/php-mysql/databaseobjects.html


Before I dig in on this DAO, I'm wondering, where should I, and how could I,
properly place a JOIN on this kind of pattern? Is it easy done or, on a JOIN
scenario (and I will have a lot of them) I choose probably choose another
pattern?


Regards,
Márcio



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



Re: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-22 Thread Tony Marston

MEM tal...@gmail.com wrote in message 
news:000201ca0a9f$ca3fb110$5ebf13...@com...
   As for (1) even in my pre-OO days I was used to using a single
   generic DAO for all database access. The only time that more
   than one DAO existed was for a different DBMS engine. This
   is why I have one DAO class for MySQL, one for PostgreSQL
   and another for Oracle. If you are incapable of writing  a
   single generic DAO then it just shows that you still have a lot to
   learn. For an idea on how this works take a look at
   http://www.tonymarston.net/php-mysql/databaseobjects.html


 Before I dig in on this DAO, I'm wondering, where should I, and how could 
 I,
 properly place a JOIN on this kind of pattern? Is it easy done or, on a 
 JOIN
 scenario (and I will have a lot of them) I choose probably choose another
 pattern?

 Regards,
 Márcio

Adding a JOIN to the SQL statement which is generated by the framework is 
very easy, as shown in my FAQ at 
http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq08. You have 
two choices where you can place the code:
(1) In the component script.
(2) In the table class, as shown in 
http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq84

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org



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



RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-22 Thread MEM
Thanks a lot Tony. Unfortunately for me, I'm seeing myself in no conditions
for properly learning a framework. I want to learn PHP and a framework bring
so many concepts at once, that I found extremely complex and time consuming
do dig in, at once, right now. Since I have no more than a few months on
PHP, I really need to keep it, as simple as possible, even if not perfectly
structured, but, the understanding of all the steps involved should be
included.

Thanks a lot for your help, and sorry for, in some way, having wasting your
time on this. 

Regards,
Márcio 
 
 Adding a JOIN to the SQL statement which is generated by the framework
 is
 very easy, as shown in my FAQ at
 http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq08. You
 have
 two choices where you can place the code:
 (1) In the component script.
 (2) In the table class, as shown in
 http://www.tonymarston.net/php-mysql/infrastructure-faq.html#faq84
 
 --
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


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



[PHP] Re: newbie question - php parsing

2009-07-22 Thread Jo�o C�ndido de Souza Neto
You made a mistake in your code:

?php the_title(); ?

must be:

?php echo the_title(); ?

-- 
João Cândido de Souza Neto
SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
Fone: (0XX41) 3033-3636 - JS
www.siens.com.br

Sebastiano Pomata lafayett...@gmail.com escreveu na mensagem 
news:70fe20d60907221355m3fa49a75ua053d2f1b9aca...@mail.gmail.com...
 Hi all,

 A little doubt caught me while I was writing this snippet of code for
 a wordpress template:

 ?php if (the_title('','',FALSE) != 'Home') { ?
 h2 class=entry-header?php the_title(); ?/h2
 ?php } ?

 I always thought that php was called only between the ?php ? tags,
 and I'm pretty sure that's right, while HTML code was simply wrote in
 document as is, without further logic.
 Now, I can't figure out how this snippet works: I mean, shouldn't HTML
 code be simply put on document, as it is outside php invoke?
 Effectively if the title of page is 'Home', the HTML part is totally
 skipped.

 Is the if construct that does all the magic inside? 



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



Re: [PHP] Re: newbie question - php parsing

2009-07-22 Thread Shane Hill
2009/7/22 João Cândido de Souza Neto j...@consultorweb.cnt.br

 You made a mistake in your code:

 ?php the_title(); ?

 must be:

 ?php echo the_title(); ?


?= the_title(); ?

also works.

-Shane





 --
 João Cândido de Souza Neto
 SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
 Fone: (0XX41) 3033-3636 - JS
 www.siens.com.br

 Sebastiano Pomata lafayett...@gmail.com escreveu na mensagem
 news:70fe20d60907221355m3fa49a75ua053d2f1b9aca...@mail.gmail.com...
  Hi all,
 
  A little doubt caught me while I was writing this snippet of code for
  a wordpress template:
 
  ?php if (the_title('','',FALSE) != 'Home') { ?
  h2 class=entry-header?php the_title(); ?/h2
  ?php } ?
 
  I always thought that php was called only between the ?php ? tags,
  and I'm pretty sure that's right, while HTML code was simply wrote in
  document as is, without further logic.
  Now, I can't figure out how this snippet works: I mean, shouldn't HTML
  code be simply put on document, as it is outside php invoke?
  Effectively if the title of page is 'Home', the HTML part is totally
  skipped.
 
  Is the if construct that does all the magic inside?



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




Re: [PHP] Re: newbie question - php parsing

2009-07-22 Thread Lenin
Ted Turner http://www.brainyquote.com/quotes/authors/t/ted_turner.html  -
Sports is like a war without the killing.

2009/7/23 Shane Hill shanehil...@gmail.com

 2009/7/22 João Cândido de Souza Neto j...@consultorweb.cnt.br

  You made a mistake in your code:
 
  ?php the_title(); ?
 
  must be:
 
  ?php echo the_title(); ?


 ?= the_title(); ?


Short tag and not recommended as its deprecated now, would be void at PHP
6.0


Re: [PHP] Re: newbie question - php parsing

2009-07-22 Thread Martin Scotta
This is how I'd write this snippet

?php
if ( 'Home' !== ( $title = the_title('','',FALSE)))
{
echo 'h2 class=entry-header',
$title,
'/h2';
}
?

On Wed, Jul 22, 2009 at 6:31 PM, Lenin le...@phpxperts.net wrote:

 Ted Turner http://www.brainyquote.com/quotes/authors/t/ted_turner.html
  -
 Sports is like a war without the killing.

 2009/7/23 Shane Hill shanehil...@gmail.com

  2009/7/22 João Cândido de Souza Neto j...@consultorweb.cnt.br
 
   You made a mistake in your code:
  
   ?php the_title(); ?
  
   must be:
  
   ?php echo the_title(); ?
 
 
  ?= the_title(); ?


 Short tag and not recommended as its deprecated now, would be void at PHP
 6.0




-- 
Martin Scotta


[PHP] Re: newbie question - php parsing

2009-07-22 Thread Shawn McKenzie
João Cândido de Souza Neto wrote:
 You made a mistake in your code:
 
 ?php the_title(); ?
 
 must be:
 
 ?php echo the_title(); ?
 

I haven't used worpress in a long time, but the the_title() function
might echo the title unless you pass the FALSE parameter, in which case
it just returns it.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
 As for (1) even in my pre-OO days I was used to using a single generic
 DAO
 for all database access. The only time that more than one DAO existed
 was
 for a different DBMS engine. This is why I have one DAO class for MySQL,
 one
 for PostgreSQL and another for Oracle. If you are incapable of writing
 a
 single generic DAO then it just shows that you still have a lot to
 learn.
 For an idea on how this works take a look at
 http://www.tonymarston.net/php-mysql/databaseobjects.html

I'm absolutly sure that I have a lot to learn. Really a lot. :-)
I have post some days ago, a way for using a generic CRUD class and DAO, but
I get no replys so I wrongly suppose that my question was a nonsense
question, and that CRUD and DAO would be a nonsense.


 As for (2) it should be obvious that pagination is not an entity in its
 own
 right that has its own properties and methods, it is merely a function
 which
 can be performed on any entity within the system.

Ok...

 It should also be
 obvious
 that the requirements of pagination cannot be satisfied in a single
 class as
 some of the processing has to be handled in the presentation (UI) layer
 while the remainder is handled in the data access layer. 

That's why I was thinking on using a Decorator Object on the Pagination
Class (that will retrieve DAO values to operate).


 The
 presentation
 layer needs a means to submit a request for a particular page number as
 well
 as the page size (rows per page). These two values are sent to the DAO
 which
 then translates them into values for LIMIT and OFFSET. After the DAO
 has
 issued the sql SELECT statement it needs to return two values - the
 current
 page number and the last available page number. The presentation layer
 then
 needs a mechanism to display these two values. This is explained in
 http://www.tonymarston.net/php-mysql/pagination.html

Thanks for explain the workflow! I will read.

 
 If you still don't see how this works then you can run my sample
 application
 at http://www.tonymarston.net/php-mysql/sample-application.html You can
 even
 download the code so that you can step through it with your debugger.

I haven't learn how to use a debugger yet. And I'm sure it would help me a
lot on understanding some data workflow...


Thanks,
Márcio 


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



RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
  As for (1) even in my pre-OO days I was used to using a single
 generic
  DAO
  for all database access. The only time that more than one DAO existed
  was
  for a different DBMS engine. This is why I have one DAO class for
 MySQL,
  one
  for PostgreSQL and another for Oracle. If you are incapable of
 writing
  a
  single generic DAO then it just shows that you still have a lot to
  learn.
  For an idea on how this works take a look at
  http://www.tonymarston.net/php-mysql/databaseobjects.html
 
 I'm absolutly sure that I have a lot to learn. Really a lot. :-)
 I have post some days ago, a way for using a generic CRUD class and DAO,
 but I get no replys so I wrongly suppose that my question was a
 nonsense question, and that CRUD and DAO would be a nonsense.
 

I'm trying to use PDO with prepare statements and BindParam, so I'm afraid
that my newbility doesn't allow me to pass directly from your example to
one that uses PDO.
Also, I also intend to use fetchObject method instead of fetchAssoc quite
often, with also puts your tutorial far away from my capacities. Because of
this, I'm trying to follow what I can get on the web, using PDO and general
CRUD operations:

BUT:

Here: 
1) http://oopgarden.richardknop.com/index/view/1

or Here:
2) http://phpro.org/tutorials/Easy-Access-With-PDO-CRUD.html

when we have to create complex querys by using limits, order, etc... either
they are inexistent possibilities (like on the link 2), or, like on link 1
they are so close to the equivalent sql sintax that I'm questioning the
advantage of having a general DAO CRUD class at all (supposing that the only
advantage is that we write less words on the code).

Please advice, besides the fact that we never have to code any of the SQL
SELECT, INSERT, UPDATE or DELETE statements for any table as they will be
generated at runtime., is there any other advantage on using a general DAO
class instead of one DAO class for each table?


:(

Regards,
Márcio


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



Re: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Tony Marston

MEM tal...@gmail.com wrote in message 
news:002001ca0898$5d183840$1748a8...@com...
  As for (1) even in my pre-OO days I was used to using a single
  generic DAO for all database access. The only time that more
  than one DAO existed was for a different DBMS engine. This
  is why I have one DAO class for MySQL, one for PostgreSQL
  and another for Oracle. If you are incapable of writing  a
  single generic DAO then it just shows that you still have a lot to
  learn. For an idea on how this works take a look at
  http://www.tonymarston.net/php-mysql/databaseobjects.html

 I'm absolutly sure that I have a lot to learn. Really a lot. :-)
 I have post some days ago, a way for using a generic CRUD class and DAO,
 but I get no replys so I wrongly suppose that my question was a
 nonsense question, and that CRUD and DAO would be a nonsense.

 I'm trying to use PDO with prepare statements and BindParam, so I'm afraid
 that my newbility doesn't allow me to pass directly from your example to
 one that uses PDO.

Why not? Why can't you replace a call to a mysqli function with a call to a 
PDO function?

 Also, I also intend to use fetchObject method instead of fetchAssoc quite
 often,

Why? What's the  benefit? The fetchAssoc method gives you an array of 
values, while the fetchObject method gives you a container for an array of 
values. You still still have to work with an array of values.

 with also puts your tutorial far away from my capacities. Because of
 this, I'm trying to follow what I can get on the web, using PDO and 
 general
 CRUD operations:

Why don't you learn how to use the mysqli functions before you handle the 
switch to PDO? What do you have to lose?

 BUT:

 Here:
 1) http://oopgarden.richardknop.com/index/view/1

 or Here:
 2) http://phpro.org/tutorials/Easy-Access-With-PDO-CRUD.html

 when we have to create complex querys by using limits, order, etc... 
 either
 they are inexistent possibilities (like on the link 2),

If you read my tutorial you should see that building a SELECT statement is 
nothing more than combining several small strings into a larger single 
string. String manipulation is simple in PHP. Using this technique I can 
create very complex SQL statements, so don't tell me that it can't be done.

 or, like on link 1
 they are so close to the equivalent sql sintax that I'm questioning the
 advantage of having a general DAO CRUD class at all (supposing that the 
 only
 advantage is that we write less words on the code).

Having less code to maintain is *precisely* the advantage of having a single 
DAO. If you design it correctly then you can switch from one DAO class to 
another in order to switch from one DBMS engine to aother.

 Please advice, besides the fact that we never have to code any of the SQL
 SELECT, INSERT, UPDATE or DELETE statements for any table as they will be
 generated at runtime., is there any other advantage on using a general 
 DAO
 class instead of one DAO class for each table?

Because you have less code to maintain. If you look carefully you should see 
that the only difference between the DAO for TableA and the DAO for TableB 
is the table name and the table structure. If you could pass these as 
arguments into a generic DAO then you would not need a separate DAO for each 
table.

OOP is about creating reusable code to reduce the maintenance burden, so if 
you insist that a separate DAO for each individual table is the way to go 
then you don't understand how to apply the principles of OOP correctly.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org



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



RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
 Why not? Why can't you replace a call to a mysqli function with a call
 to a
 PDO function?

It's not just a simple replacement - I need to add bindparam, prepare,
execute, placeholders and fetchObject. But I will give it a try...
 
  Also, I also intend to use fetchObject method instead of fetchAssoc
 quite
  often,
 
 Why? What's the  benefit? The fetchAssoc method gives you an array of
 values, while the fetchObject method gives you a container for an array
 of
 values. You still still have to work with an array of values.

FetchObject maps the field names from the database as object properties with
the values stored in the database. Seems quite nice.

Then, to access a specific column data I just needed to:
$myhandler-my_database_column_name (it seems quite nice to me) :) 

 
 Why don't you learn how to use the mysqli functions before you handle
 the
 switch to PDO? What do you have to lose?

I already work with PDO so, no need to switch. :-)


 If you read my tutorial you should see that building a SELECT statement
 is
 nothing more than combining several small strings into a larger single
 string. String manipulation is simple in PHP. Using this technique I
 can
 create very complex SQL statements, so don't tell me that it can't be
 done.

I was not talking about your tutorial. I was talking about those two links,
mainly the first one where, unfortunately, the difference between the code
and the sql sintax is that we don't have the word SELECT and WHERE. :s
However, as a positive point, this class uses BindParam and ? placeholders.
But I get your point, we can cut it into smaller strings.


 Because you have less code to maintain. If you look carefully you
 should see
 that the only difference between the DAO for TableA and the DAO for
 TableB
 is the table name and the table structure. If you could pass these as
 arguments into a generic DAO then you would not need a separate DAO for
 each
 table.

Yes. But you still need, for each table, to fill one or several (depending
on what mysql connection method we use) arrays with values.
So that less code maybe isn't that much in a way where you *significantly*
reduce your maintenance burden, if you take into consideration that we take
the queries for each table, but a) we add arrays and b) use a less intuitive
way to add/remove/delete values to the database. As an example I have give
link 1, where the difference was more or less two or three words - and the
way to use the arrays where far more complicated to understand then a simple
Select Sintax - hence, not that relevant.

 
 OOP is about creating reusable code to reduce the maintenance burden,
 so if
 you insist that a separate DAO for each individual table is the way to
 go
 then you don't understand how to apply the principles of OOP correctly.

I will never insist just because some silly reason comes to my mind. I will
however not follow a method without knowing the reasons and be convinced of
them.


I'm not 100% convinced of the reducing benefits for the reasons a) and b)
stated above, still, maybe I get more benefits the more I add methods to the
DAOs.


In the next few days I will try to, based on your code, create a general DAO
class that deals with PDO. And post back my frustrations back here. :D


Please have patience. :D


Regards,
Márcio





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



Re: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Paul M Foster
On Sun, Jul 19, 2009 at 03:56:43PM +0100, Tony Marston wrote:

 Two things strike me as wrong with your thinking:
 
 (1) The idea that you have a separate DAO for each entity instead of a
 single generic DAO which can act for any entity in the system.
 (2) The idea that pagination requires its own class, and therefore needs
 this is-a and has-a nonsense.
 
 As for (1) even in my pre-OO days I was used to using a single generic DAO
 for all database access. The only time that more than one DAO existed was
 for a different DBMS engine. This is why I have one DAO class for MySQL, one
 for PostgreSQL and another for Oracle. If you are incapable of writing a
 single generic DAO then it just shows that you still have a lot to learn.
 For an idea on how this works take a look at
 http://www.tonymarston.net/php-mysql/databaseobjects.html

This brings up a question. Most of the tutorials I've read on your site
deal with classes tailored to specific tables. However, in much of my
software, I have to deal with queries which access multiple tables. For
example, my invoice table contains the customer number, but not their
name. For that, I have to go to the customer table. Thus, my queries
often access multiple tables with where clauses which ensure I get the
proper data from secondary tables. I've never used views in SQL, but
it appears that this is what would be called a view.

So in your constellation of software, would you create a subclass of
genericTable which essentially is a view? Otherwise, how would you
handle this?

Paul

-- 
Paul M. Foster

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



Re: [PHP] Re: Newbie: Composition by Association - PaginationClass general question.

2009-07-19 Thread Tony Marston

Paul M Foster pa...@quillandmouse.com wrote in message 
news:20090719220923.gv14...@quillandmouse.com...
 On Sun, Jul 19, 2009 at 03:56:43PM +0100, Tony Marston wrote:

 Two things strike me as wrong with your thinking:

 (1) The idea that you have a separate DAO for each entity instead of a
 single generic DAO which can act for any entity in the system.
 (2) The idea that pagination requires its own class, and therefore needs
 this is-a and has-a nonsense.

 As for (1) even in my pre-OO days I was used to using a single generic 
 DAO
 for all database access. The only time that more than one DAO existed was
 for a different DBMS engine. This is why I have one DAO class for MySQL, 
 one
 for PostgreSQL and another for Oracle. If you are incapable of writing a
 single generic DAO then it just shows that you still have a lot to learn.
 For an idea on how this works take a look at
 http://www.tonymarston.net/php-mysql/databaseobjects.html

 This brings up a question. Most of the tutorials I've read on your site
 deal with classes tailored to specific tables. However, in much of my
 software, I have to deal with queries which access multiple tables. For
 example, my invoice table contains the customer number, but not their
 name. For that, I have to go to the customer table. Thus, my queries
 often access multiple tables with where clauses which ensure I get the
 proper data from secondary tables. I've never used views in SQL, but
 it appears that this is what would be called a view.

 So in your constellation of software, would you create a subclass of
 genericTable which essentially is a view? Otherwise, how would you
 handle this?

 Paul

Such things can be handled automatically by my generic DAO. Amongst the 
details which are exported from my data dictionary into each table structure 
file (which is accessed by the database table class) is a list of all the 
parent/foreign tables, the foreign key field(s), and which fields to 
retrieve from the parent table. So when the sql SELECT statement is being 
constructed it can use this information to add a JOIN to the parent table in 
order to retrieve the specified field(s). This is documented in 
http://www.tonymarston.net/php-mysql/data-dictionary.html#sql.joins

Any number of parent relations can be defined for a table, and any number of 
fields can be retrieved from those tables and added to the SELECT list. All 
the developer has to do is define the relationship in the data dictionary 
and the framework will handle the boring stuff of generating the necessary 
SQL.

So, using your example, I would define my customer table as a parent to my 
invoice table, identify which foreign key field relates to which primary key 
field in the parent table, define customer_name as the field to be retrieved 
from the customer table, then sit back and watch the framework do its stuff. 
Each time I read from the invoice table the result would automatically 
include the customer name.

Easy peasy lemon squeezy. It's not rocket science, but it is neat.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 



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



[PHP] Re: Newbie - Setting Up Some Basic Sendmail Scripts

2009-05-05 Thread Maarten Schalekamp

i think you will need to make use of a pear package to be able to do this.
pear package: http://pear.php.net/package/Mail
examples: http://blog.thekimsfamily.com/archives/3
docs: http://pear.php.net/manual/en/package.mail.mail.factory.php
   http://pear.php.net/manual/en/package.mail.mail.send.php

i dont think the built in php mail function can do authentication.
you can only change the settings avaliable in the php.ini


[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = y...@yourdomain

; For Unix only.  You may supply arguments as well (default: 
sendmail -t -i).

;sendmail_path =

; Force the addition of the specified parameters to be passed as extra 
parameters

; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =


working for the first time with pear packages can sometimes be tricky to get 
going, but once all is set you wont have any probs.


i think this will push you in the right direction

revDAVE c...@hosting4days.com wrote in message 
news:c625c359.397af%c...@hosting4days.com...

[Newbie]

Hi folks,

I'm trying to set up some basic php send mail scripts - and I'm curious of
the best way to go...


I checked these basics out:

http://us.php.net/manual/en/function.mail.php

And got this code below going, but I'll bet I need a bit more - like adding
authentication - smtp - port - sending user / pass etc.

Any hints how to get this to the next level?

Thanks in advance - dave



?php
$to = 'nob...@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmas...@example.com' . \r\n .
'Reply-To: webmas...@example.com' . \r\n;

mail($to, $subject, $message, $headers);
?




--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




__ Information from ESET Smart Security, version of virus signature 
database 4054 (20090505) __


The message was checked by ESET Smart Security.

http://www.eset.com




__ Information from ESET Smart Security, version of virus signature 
database 4054 (20090505) __

The message was checked by ESET Smart Security.

http://www.eset.com




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



[PHP] Re: Newbie - Setting Up Some Basic Sendmail Scripts

2009-05-05 Thread Manuel Lemos
Hello,

on 05/05/2009 02:20 PM revDAVE said the following:
 I'm trying to set up some basic php send mail scripts - and I'm curious of
 the best way to go...
 
 
 I checked these basics out:
 
 http://us.php.net/manual/en/function.mail.php
 
 And got this code below going, but I'll bet I need a bit more - like adding
 authentication - smtp - port - sending user / pass etc.
 
 Any hints how to get this to the next level?

It seems the SMTP server is only requiring authentication because it is
in a different machine of what you run PHP. In that case, you may want
to read this article:

http://www.phpclasses.org/blog/package/9/post/1-Sending-email-using-SMTP-servers-of-Gmail-Hotmail-or-Yahoo-with-PHP.html

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: newbie - how to receive/iterate posted arrays

2008-09-01 Thread David Robley
Govinda wrote:

 Hello early birds,
 
 I am going round and round the docs and list posts I saved on this
 topic... but I am still stumped.
 Kindly show me what I am missing.  I want to simply send an array of
 vars via a post form to my receiving script.
 
 I've got simple inputs like this:
 
 input name=tmbsToiterate[muir_beach_tmb] type=hidden
 value=muir_beach_tmb /
 input name=tmbsToiterate[ruby_mountain_tmb] type=hidden
 value=ruby_mountain_tmb /
 
 they post to the script with this: (and this is the line giving the
 error)-
 
 foreach($_POST['$tmbsToiterate'] as $value) {
 
 The error is Warning: Invalid argument supplied for foreach()
 
 Seems so simple, but I can't get it... What am I doing wrong?
 -Govinda

foreach($_POST['tmbsToiterate'] as $value) {

Remove the $

Cheers
-- 
David Robley

Our field is arthritis research, Tom and his room mate said jointly.
Today is Prickle-Prickle, the 25th day of Bureaucracy in the YOLD 3174. 


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



[PHP] Re: newbie - how to receive/iterate posted arrays

2008-09-01 Thread Carlos Medina

Govinda schrieb:

Hello early birds,

I am going round and round the docs and list posts I saved on this 
topic... but I am still stumped.
Kindly show me what I am missing.  I want to simply send an array of 
vars via a post form to my receiving script.


I've got simple inputs like this:

input name=tmbsToiterate[muir_beach_tmb] type=hidden 
value=muir_beach_tmb /
input name=tmbsToiterate[ruby_mountain_tmb] type=hidden 
value=ruby_mountain_tmb /


they post to the script with this: (and this is the line giving the error)-

foreach($_POST['$tmbsToiterate'] as $value) {

The error is Warning: Invalid argument supplied for foreach()

Seems so simple, but I can't get it... What am I doing wrong?
-Govinda


Hi Govinda,
delte the $ from the foreach '$tmbsToiterate'!

Regards

Carlos


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



[PHP] Re: newbie Q: How to say, if the fileNAME is equal to..., or better yet, if the fileNAME ends with '.jpg'?

2008-08-25 Thread Colin Guthrie

Govinda wrote:

if (true == ($file=.jpg)) {


Watch out for this!

You're doing a test that is an assignment..

You are assigning the value .jpg to the variable $file. You are 
then comparing this to the value true and (due to the loose variable 
types) this succeeds.


Although some people consider it ugly, it is a *very* good practice to 
put the constants on the left hand side of the comparison like so:

   if (true == (.jpg=$file)) {

I've kept your error above, but if you try and run this code, you will 
get a syntax error.


The correct comparison is to do:
   if (true == (.jpg==$file)) {

Note the double ='s signs.


As you have VB experiences, this is different, but follows the 
conventions of a lot of languages (C, C++, C# etc.). VB inferred whether 
you wanted assignment or comparison depending on the context, but this 
came at the expense of not being able to nest complex statements.



Of course your example above could probably have been achieved by doing

 if (file_exists(.jpg)) {

but that's beside the point :)

Col



--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



[PHP] Re: Newbie - is there a function similar to the sql 'like' comparison operator?

2008-05-09 Thread Colin Guthrie

revDAVE wrote:

Newbie - is there a function similar to the sql 'like' comparison operator?

I would like to be able to compare 2 strings:

If $this ---*like or similar to*--- $that

That type of thing...


I strongly suggest you read up on regular expressions:
http://uk.php.net/manual/en/book.regex.php

Knowing how to use regular expressions is a a very handy skill. I do a 
lot of mass changing of files via the command line with tools such as 
grep, sed and awk and a mastery regular expressions can save hours of 
laborious typing and find/replacing ;)


Reminds me of one of my favourite xkcd cartoons:
http://xkcd.com/208/

Col


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



[PHP] Re: Newbie - is there a function similar to the sql 'like' comparisonoperator?

2008-05-08 Thread Shawn McKenzie

revDAVE wrote:

Newbie - is there a function similar to the sql 'like' comparison operator?

I would like to be able to compare 2 strings:

If $this ---*like or similar to*--- $that

That type of thing...


I know of this page:

http://us3.php.net/manual/sl/language.operators.comparison.php


But I don't see something 'like' or 'similar' to something else


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]



Probably the most similar that allows some wildcards (pattern matching) 
is ereg().  You have more power in that you can control what must match 
and how much.


In MySQL  'a' = ' a ' is true but 'a' LIKE ' a ' is false.  So you need 
to use the wildcard % to match anything  ' xxaxx ' LIKE '%a%' is true or 
_ to match one character ' a ' LIKE '_a_' is true.


The problem with similar_text() is that it gives you a percentage of 
similarity which may be misleading unless you also figure in the return 
of how many chars match.  For example similar_text('CAT', 'CA', $p) $p 
would be 66.6%, is that like or not?


-Shawn

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



[PHP] Re: newbie with another HTML/navigation question

2008-04-29 Thread Peter Ford

Rod Clay wrote:

I have a php script that is invoked on 2 different occasions:

1) the first to create a page with a form the user will use to input 
information for a new table row - this form has method=POST


2) the script is run a second time to accept the input from the 
completed form, add the new row to the table on the database, then 
create a simple form with an OK button the user will click on to go to 
another page to view the result of the database maintenance - this form 
has method=GET


Everything is working great EXCEPT THAT the url parameter I attempt to 
pass on the second form to the php script that displays the database 
maintenance never gets there!  It's on the second form (form 
method=get action=bloglist.php?thread=yet%20another%20new%20thread) 
but the bloglist.php script doesn't receive it.  The query string is 
empty when bloglist.php starts.


Also, another very curious, and perhaps revealing, thing - when I 
attempt to view the page source of the second form I mention above, the 
one with method=GET, I get the odd, and absolutely nonsensical, message 
The page you are trying to view contains POSTDATA that has expired from 
the cache.  But this makes no sense, since this second page (with 
method=GET) has (or should have) no POSTDATA!?!


Can anyone make any sense of any of this for me?  I'm making pretty good 
progress in general, but, once again, I seem to have hit a snag here I'm 
don't seem to be able to get past.


Thanks for any help you can give me.

Rod
[EMAIL PROTECTED]


Firstly, if you have a form and you are sending it using GET, then why don't you 
use a input type='hidden' name='thread' value='yet another new thread' / 
element to send the parameter - that's what input tags are for. I have a feeling 
that the ?foo=bar bit is stripped off a GET request URL if there are other 
form elements, although it's not always stripped off a POST... maybe it's 
browser-dependent.


Secondly, when you refresh the second form, you are making a POST request - 
that's what generated the form in the first place, so you would expect the 
message about POSTDATA - and (in Firefox at least), to view the source the 
browser repeats the page request, effectively the same as refreshing the page. 
If you want to see the source without repeating the POST request, you need to 
use something like the WebDeveloper tool bar - it has a View Generated Source 
function which extracts the source from the DOM model the browser used to render 
the page.


--
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



[PHP] Re: Newbie ' If Statement' Question

2008-03-19 Thread Dan
heredoc is probably the best way to go.  There's no way you can mess up your 
quotes, and you don't have to worry about escaping.  Altough I wonder what 
would happen if you put ? in a heredoc, would it stop processing the php, 
thinking that it was the end of the php file, or would it just treat it as a 
string still?


- Dan

Al [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Here's how I'd do it.

?php
$row= $emp_row-getRecordId();//Or, you can put this inside the heredoc 
with {}


//heredoc
$str= txt
form name=edit method=post action=emp_edit_result2.php
input type=hidden name=Status value=Active /
input type=hidden name=The_Date value= /
input type=hidden name=-recid value=$row /
input type=submit name=edit_submit value=Activate /
/form
txt;

if (!empty($emp_row-getField('testfield')) print $str;
else print Non Print;
?


[EMAIL PROTECTED] wrote:

Hello Folks,

I would like to be able to wrap a 'form' inside a php 'if statement' - 
so

that the form will appear if the 'if condition' is met.

-  most likely I cannot have a ?php tag inside another one - and am sure
I'm doing other things wrong also...
- now I get the error - Parse error: syntax error, unexpected T_STRING 
in...


Q:  What is the best way to accomplish this goal?


---

?php if ($emp_row-getField('testfield') !=) {
print form name=edit method=post action=emp_edit_result2.php
input type=hidden name=Status value=Active/
input type=hidden name=The_Date value=/
input type=hidden name=-recid value=?php echo
$emp_row-getRecordId(); ?
input type=submit name=edit_submit value=Activate
/form
;}else {print Non Print;} ?
--
Thanks - RevDave
Cool7 @ hosting4days . com
[db-lists]




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



[PHP] Re: Newbie ' If Statement' Question

2008-03-16 Thread Al

Here's how I'd do it.

?php
$row= $emp_row-getRecordId();//Or, you can put this inside the heredoc with {}

//heredoc
$str= txt
form name=edit method=post action=emp_edit_result2.php
input type=hidden name=Status value=Active /
input type=hidden name=The_Date value= /
input type=hidden name=-recid value=$row /
input type=submit name=edit_submit value=Activate /
/form
txt;

if (!empty($emp_row-getField('testfield')) print $str;
else print Non Print;
?


[EMAIL PROTECTED] wrote:

Hello Folks,

I would like to be able to wrap a 'form' inside a php 'if statement' -  so
that the form will appear if the 'if condition' is met.

-  most likely I cannot have a ?php tag inside another one - and am sure
I'm doing other things wrong also...
- now I get the error - Parse error: syntax error, unexpected T_STRING in...

Q:  What is the best way to accomplish this goal?


---

?php if ($emp_row-getField('testfield') !=) {
print form name=edit method=post action=emp_edit_result2.php
input type=hidden name=Status value=Active/
input type=hidden name=The_Date value=/
input type=hidden name=-recid value=?php echo
$emp_row-getRecordId(); ?
input type=submit name=edit_submit value=Activate
/form

;}else {print Non Print;} ?




--
Thanks - RevDave
Cool7 @ hosting4days . com
[db-lists]





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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread tedd

At 12:56 AM +0100 11/28/07, Jochem Maas wrote:

Colin Guthrie wrote:

 tedd wrote:


...

 
  Sorry Tedd, but I'm not sure where the browser sniffing stuff came in.

 IE and FF both offer a UI to input the user's preferred language, it's
 an HTTP standard thing and nothign to do with user agents string
 parsing. It uses the Accept-Language header sent with http requests to
 detect the language. It's quite standard but problems usually crop up in
 e.g. Australia and the UK where a lot of people leave the default en-US
 language when en-GB or en-AU would be better. Again it's not infallible
 but it's a fairly good starting point.


ditto.


So, sniffing the browser to determine language isn't the same as 
browser sniffing -- OK.


Sorry, my bad.

Cheers,

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

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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Jochem Maas
tedd wrote:
 At 12:56 AM +0100 11/28/07, Jochem Maas wrote:
 Colin Guthrie wrote:
  tedd wrote:

 ...

  
   Sorry Tedd, but I'm not sure where the browser sniffing stuff came in.
  IE and FF both offer a UI to input the user's preferred language, it's
  an HTTP standard thing and nothign to do with user agents string
  parsing. It uses the Accept-Language header sent with http requests to
  detect the language. It's quite standard but problems usually crop
 up in
  e.g. Australia and the UK where a lot of people leave the default en-US
  language when en-GB or en-AU would be better. Again it's not infallible
  but it's a fairly good starting point.

 ditto.
 
 So, sniffing the browser to determine language isn't the same as browser
 sniffing -- OK.

there is no sniffing of the browser - merely a case of parsing the contents of
the Accept-Language header if the browser sent it along with the request 
regardless
of what browser is being used.

there is no reason to assume that anyone would want to spoof the 
Accept-Language header
to contain something that doesn't correspond with what the user wants ... why 
set japanese
as a preferred language if you don't speak it? and if they do do that and end 
up getting a
site in japanese then really that is the users problem not the site developers.

it not the same as ouput different content/layout/etc based on the UserAgent 
string -
which is known to be spoofed in order to combat idiot developers attempts to 
force
people to use certain browser (for whatever reason)

I mean, we don't assume that the requested URL is not what the user really 
wanted?
e.g. user requests example.com/foo.php but we know that it's likely to be 
spoofed so
we'll help out and server them example.com/bar.php ???

besides which I did state that using Accept-Language header to determine a 
[probable]
suitable language should be done in addition to offering the user an explicit 
language
selection mechanism.

lastly I think using GEO-IP services to determine location and thereby an 
implied
language is worthless in general - I can be sitting anywhere on the planet and 
still want
to view content in Dutch, not to mention things like global corporate gateways, 
anonymous
proxies, etc, etc. The exception to this could be when the website in question 
is specifically
offering localised data (e.g. find me a restaurant/garage/whatever in Rotterdam)

 
 Sorry, my bad.

no need for the sarcasm Tedd, seems we have differing opinions on this - 
although my gut
feeling is that your hung up on something that's not strictly relevant in this 
situation.

:-)

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



[PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Jeff Benetti
Wow! I love this group, ask and you shall receive.  Thanks everyone for the
comments and suggestions. 

 

The following snippet from Andrés Robinet would actually suit my current
project..

 

define('DEFAULT_LANG_ID', 'en');

 

function getLanguageId() {

  // Allow for language id override in $_GET, $_POST and $_COOKIE

  $req_lang_id = $_REQUEST['lang_id'];

  // Retrieve the one stored in the session if any

  $sess_lang_id = $_SESSION['lang_id'];

  // $lang_id will contain the lang id retrieved from request (overrides
session),

  // or from session or a default one

  $lang_id = isset($req_lang_id) ? $req_lang_id : (isset($sess_lang_id) ?

$sess_lang_id : DEFAULT_LANG_ID);

  // Save it for next time

  $_SESSION['lang_id'] = $lang_id;

  return $lang_id;

}

 

but the idea of getting a preferred language from the browser is also a
great strategy ( I didn’t know you could do that, I’m such a noob) so I
think that I will investgate that further. 

 

The problem with IP address is that usually it is not tied to one particular
user so I will scrap that idea.  

 

Am I correct that if two people are logged on using two different languages
that the session var will keep track of the different users (by IP I assume)
and the server won’t mess up?

 

Anyway thanks everyone for all the great help, I’m on a nearly vertical
learning curve here and it’s great to have this community to draw on.  I’m
pretty much working in a vacuum otherwise.

 

Jeff



[PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Colin Guthrie
tedd wrote:
 At 12:56 AM +0100 11/28/07, Jochem Maas wrote:
 Colin Guthrie wrote:
  tedd wrote:

 ...

  
   Sorry Tedd, but I'm not sure where the browser sniffing stuff came in.
  IE and FF both offer a UI to input the user's preferred language, it's
  an HTTP standard thing and nothign to do with user agents string
  parsing. It uses the Accept-Language header sent with http requests to
  detect the language. It's quite standard but problems usually crop
 up in
  e.g. Australia and the UK where a lot of people leave the default en-US
  language when en-GB or en-AU would be better. Again it's not infallible
  but it's a fairly good starting point.

 ditto.
 
 So, sniffing the browser to determine language isn't the same as browser
 sniffing -- OK.
 
 Sorry, my bad.

lol. If you define this as sniffing tedd, then I by that token you'd
have to define the GET / HTTP/1.1 \n Host: www.mysite.com bit as
sniffing too ;)

Col

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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Jochem Maas
Jeff Benetti wrote:

...

 Am I correct that if two people are logged on using two different languages
 that the session var will keep track of the different users (by IP I assume)
 and the server won’t mess up?

yes, the contents of $_SESSION are stored per user. this is tracked by way of a
session cookie (which is just another cookie really) that PHP (under normal 
circumstances)
automatically sends and parses (when you call session_start()).

 Anyway thanks everyone for all the great help, I’m on a nearly vertical
 learning curve here and it’s great to have this community to draw on.  I’m
 pretty much working in a vacuum otherwise.
 

any room for that wizard named Brad in your vacuum?

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



[PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Colin Guthrie
Jeff Benetti wrote:
 Am I correct that if two people are logged on using two different languages
 that the session var will keep track of the different users (by IP I assume)
 and the server won’t mess up?

Sessions are per-user and are not global (you'd need to use something
like memcache or similar for global persistence). PHP is different from
e.g. ASP/JSP which implement a Share everything system, vs PHP's
Share nothing (these are real terms believe it or not!).

Sessions usually work via a cookie that PHP set's automatically the is
stored for the duration of their visit on your site (till they restart
their webbrowser). By default the cookie is called PHPSESSID. If a user
has cookies disabled PHP can rewrite your HTML URLs on the fly to
include the argument on the GET vars (sess_use_trans_id) but this is far
from reliable.

HTHs

Col

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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread tedd

At 3:01 PM +0100 11/28/07, Jochem Maas wrote:

tedd wrote:
  So, sniffing the browser to determine language isn't the same as browser

 sniffing -- OK.


there is no sniffing of the browser - merely a case of parsing the contents of
the Accept-Language header if the browser sent it along with the 
request regardless

of what browser is being used.

there is no reason to assume that anyone would want to spoof the 
Accept-Language header
to contain something that doesn't correspond with what the user 
wants ... why set japanese
as a preferred language if you don't speak it? and if they do do 
that and end up getting a
site in japanese then really that is the users problem not the site 
developers.


it not the same as ouput different content/layout/etc based on the 
UserAgent string -
which is known to be spoofed in order to combat idiot developers 
attempts to force

people to use certain browser (for whatever reason)

I mean, we don't assume that the requested URL is not what the user 
really wanted?
e.g. user requests example.com/foo.php but we know that it's likely 
to be spoofed so

we'll help out and server them example.com/bar.php ???

besides which I did state that using Accept-Language header to 
determine a [probable]
suitable language should be done in addition to offering the user an 
explicit language

selection mechanism.

lastly I think using GEO-IP services to determine location and 
thereby an implied
language is worthless in general - I can be sitting anywhere on the 
planet and still want
to view content in Dutch, not to mention things like global 
corporate gateways, anonymous
proxies, etc, etc. The exception to this could be when the website 
in question is specifically
offering localised data (e.g. find me a restaurant/garage/whatever 
in Rotterdam)


Thanks for the explanation -- I didn't realize most of that.


  Sorry, my bad.

no need for the sarcasm Tedd, seems we have differing opinions on 
this - although my gut
feeling is that your hung up on something that's not strictly 
relevant in this situation.


:-)


Jochem:

This just hasn't been my week -- everyone (long story) thinks I'm 
being sarcastic when I'm not.


The Sorry, my bad means I apologize, my mistake. How can that be 
taken as sarcasm?


As for being hung-up -- again, I'm clueless. I mistakenly thought 
that anything obtained from the browser was subject to suspicion as 
is any outside data. But apparently you can trust (I realize within 
certain limits) some things provided by the browser -- that's news to 
me.


Boy, I got to work on my communication skills because everyone can't 
be wrong, right?


Again, thanks for your explanation -- and that's not being sarcastic. 
I'm just trying to communicate without offending/annoying anyone. 
Maybe I should end every line with a smiley?  :-)


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Jean-Michel Philippon-Nadeau

Dear Tedd, Dear List,

tedd wrote:
As for being hung-up -- again, I'm clueless. I mistakenly thought that 
anything obtained from the browser was subject to suspicion as is any 
outside data. But apparently you can trust (I realize within certain 
limits) some things provided by the browser -- that's news to me.


You are right. Being suspicious with data coming from the browser is a 
pretty good reflex. But, as long as you use the accept-language header 
only for detecting the user's native language, you do not risk a lot. In 
the worst case, your will set your site's language to something that is 
not the user's native language. In that case, you only need to allow him 
to change this setting manually.


You can base yourself on information provided by the browser, but as you 
say, I believe that we should not rely completely on it. This is why 
allowing the user to change his language, in your case, becomes important.


It's always a balance between risk and usability.

Hope this helps,


Jean-Michel

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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Jochem Maas
tedd wrote:
 At 3:01 PM +0100 11/28/07, Jochem Maas wrote:

...

 Jochem:
 
 This just hasn't been my week -- everyone (long story) thinks I'm being
 sarcastic when I'm not.

ouch!

 
 The Sorry, my bad means I apologize, my mistake. How can that be
 taken as sarcasm?

guess it's down to my input filters ;-) not to worry, no feelings were hurt in
the process.

 
 As for being hung-up -- again, I'm clueless. I mistakenly thought that
 anything obtained from the browser was subject to suspicion as is any
 outside data. But apparently you can trust (I realize within certain
 limits) some things provided by the browser -- that's news to me.

your right about the trust issue but I don't think trust is the point in this 
case.
looking at what the browser offered as accepted languages is merely a way of 
trying to
be helpful - you still have to parse the relevant header in a safe way.

 
 Boy, I got to work on my communication skills because everyone can't be
 wrong, right?

let's be positive, next week it will be better!

 
 Again, thanks for your explanation -- and that's not being sarcastic.
 I'm just trying to communicate without offending/annoying anyone. Maybe
 I should end every line with a smiley?  :-)

dunno about that smiley, it might become annoying ;-)

 
 Cheers,
 
 tedd
 

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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Jochem Maas
Jean-Michel Philippon-Nadeau wrote:
 Dear Tedd, Dear List,
 
 tedd wrote:
 As for being hung-up -- again, I'm clueless. I mistakenly thought
 that anything obtained from the browser was subject to suspicion as is
 any outside data. But apparently you can trust (I realize within
 certain limits) some things provided by the browser -- that's news to me.
 
 You are right. Being suspicious with data coming from the browser is a
 pretty good reflex. But, as long as you use the accept-language header
 only for detecting the user's native language, you do not risk a lot. In
 the worst case, your will set your site's language to something that is
 not the user's native language. In that case, you only need to allow him
 to change this setting manually.
 
 You can base yourself on information provided by the browser, but as you
 say, I believe that we should not rely completely on it. This is why
 allowing the user to change his language, in your case, becomes important.

yes! that's what I was trying to say :-)

 
 It's always a balance between risk and usability.
 
 Hope this helps,
 
 
 Jean-Michel
 

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



[PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-27 Thread Colin Guthrie
Jeff Benetti wrote:
 I'm a noob so keep the comments to a noob's level please.
 
 I am doing a website and my client wants the bulk of the text to be
 bilingual (French and English).  The last site I did used php and mysql so I
 am getting comfortable with that technology.  Typically I am using a single
 php file and my menu constantly points to the same file with different id
 options example index.php?id=30 and I want to use the same idea to choose
 a language example index.php?lang=frid=30.  Pretty straight forward for
 many of you folks but before I start reinventing the wheel I wondered if
 anyone could offer any suggestions.  I have a couple of approaches in mind.
 
 1: Session vars, I have never used this but it seems straight forward.
 Drawbacks?
 2: Cookies again not too big a deal, never used cookies either but it
 doesn't seem to be mystifying however the fact that the user can turn
 cookies off makes me not want to go this route.
 3: Use the mysql database and log each ip address and record the preference
 and maybe the last time on the site.  I am leaning in this direction because
 I think it is the most robust but will it be slow?  First I have to get the
 ip then I have to check to see if it is in my data base and then get the
 language preference.  It would be great to have a standardized function that
 I could use on all of my sites.  I live in a bilingual country (Canada) so
 this could be a real selling point for my services.
 
 Any any and all comments are welcome, it will be a learning curve no matter
 which route I take so a little advice on the best direction pros cons would
 be great.
 
 And of course knowing that I will have many many thousands of people on my
 site (hee hee) which option will perform best once I start accumulating
 vistors.  That's one problem I see with the mysql solution, I think it may
 start to be slow unless I start purging vistors who have not shown up in a
 while or limit the number of entries.


First of all you can use the browser supplied language preferences (if
available) to try and guess the users preferred language. It should be
obvious from phpinfo() and a half decent browser what vars you need to
inspect ($_SERVER['HTTP_LANG'] or something like that - can't remember
of hand!).

You could do soemthing like:
1. Check session for lang preference and use it.
2. Regardless of the result of 1, check GET for a preference and store
in session if present and use it.
3. If neither 1 nor 2 has any preference, use the browser supplied
preference.
4. If nothing else, use a hard coded default.



OK, that selection taken care of :)


For hard coded strings in your PHP code use Gettext and bind to standard
your catalog files and use the language choice from the above algorithm.
xgettext can extract strings from PHP files easily enough. You just have
to make sure you write in your default language and do not use variable
substition as you normally would in PHP.

e.g.
BAD:
echo gettext(Hello $user, welcome to my site);

GOOD:
printf(gettext(Hello %s, welcome to my site), $user);

printf and sprintf are your friend!!


If you use modules, be sure to write all your strings with a gettext
domain. It's a pain to go back and do this later!!!


I'd recommend looking at the gallery2 codebase for a nice example of
well internationalised and modular string handling.



As for the database contained strings there are multiple approaches here.

You could have a general linking structure that uses tables to store the
different strings. This is simple conceptually but also a pain to
implement in terms of SQL code.

I've actually created a set of custom functions for MySQL (in C) which
pack and extract multilingual content into text fields. It's a bit of a
pain in terms of standards complient SQL but it makes coding much simpler.

I would do e.g. INSERT INTO table (mystring) VALUES(LANG_PACK('en',
'Hello', 'fr', 'Bonjour'));

Then
SELECT LANG_EXTRACT(mystring) FROM table;
(Hello - defaults to first string)
of
SELECT LANG_EXTRACT(mystring, 'de', 'fr') FROM table;
('Bonjour' - can't find de but finds fr).

I've wrapped up the calls to LANG_EXTRACT in the SQL to use the user's
language preference automatically which works quite well.

There are lots of solutions here and if I were to think about it again
I'd maybe reconsider what I've done. It's convenient in some ways but
not so in others!

Hope this gives food for thought.

Col

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



RE: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-27 Thread Bastien Koert

My approach to multi lang abilities uses the following db structure
 
base_name is the input field name and the basic raw label for the field
lang_1
lang_2
...
lang_12
prompt_1
prompt_2
...
prompt_12
 
since i currently need to support 12 languages in the initial concept
 
when the user signs on, i equate the language to an offset on the table to be 
able to pull the correct language out of the tables. I have the prompts in 
there to provide prompts for input fields as required. These values are then 
input thru a translation interface. Using the interface, i build up 
translatable values for the controls as well, where items like radio buttons 
and selects are done in the following manner
 
base_name   
 lang_1  lang_2   ...  lang_n

 salutation 
  Salutation Salut   something
base_name.db_value_1 = first option  mr 
Mister  Monsiour   
base_name.db_value_2 = second option  mrs   
 Mrs Madam
...
base_name.db_value_n = n option
 
Then for each option value i have a function that pulls the the correct values 
and builds the options list for each control type
 
 
Our final step to improve perfomance (note that this is, sadly, ASP / vbscript 
) was to take the translation table into an XML application level object to 
cache the data since its relatively immutable. 
 
Now when I write this same app in php, I am more likely to skip the caching 
portion of this in favor of templating the forms for each language. I would use 
a folder for each language.
 
hth
 
bastien
 
 To: php-general@lists.php.net From: [EMAIL PROTECTED] Date: Tue, 27 Nov 
 2007 15:18:45 + Subject: [PHP] Re: Newbie asks about multi-lingual 
 website strategies  Jeff Benetti wrote:  I'm a noob so keep the comments 
 to a noob's level please.I am doing a website and my client wants the 
 bulk of the text to be  bilingual (French and English). The last site I did 
 used php and mysql so I  am getting comfortable with that technology. 
 Typically I am using a single  php file and my menu constantly points to 
 the same file with different id  options example index.php?id=30 and I 
 want to use the same idea to choose  a language example 
 index.php?lang=frid=30. Pretty straight forward for  many of you folks 
 but before I start reinventing the wheel I wondered if  anyone could offer 
 any suggestions. I have a couple of approaches in mind.1: Session 
 vars, I have never used this but it seems straight forward.  Drawbacks?  
 2: Cookies again not too big a deal, never used cookies either but it  
 doesn't seem to be mystifying however the fact that the user can turn  
 cookies off makes me not want to go this route.  3: Use the mysql database 
 and log each ip address and record the preference  and maybe the last time 
 on the site. I am leaning in this direction because  I think it is the most 
 robust but will it be slow? First I have to get the  ip then I have to 
 check to see if it is in my data base and then get the  language 
 preference. It would be great to have a standardized function that  I could 
 use on all of my sites. I live in a bilingual country (Canada) so  this 
 could be a real selling point for my services.Any any and all 
 comments are welcome, it will be a learning curve no matter  which route I 
 take so a little advice on the best direction pros cons would  be great.  
   And of course knowing that I will have many many thousands of people on 
 my  site (hee hee) which option will perform best once I start 
 accumulating  vistors. That's one problem I see with the mysql solution, I 
 think it may  start to be slow unless I start purging vistors who have not 
 shown up in a  while or limit the number of entries.   First of all you 
 can use the browser supplied language preferences (if available) to try and 
 guess the users preferred language. It should be obvious from phpinfo() and 
 a half decent browser what vars you need to inspect ($_SERVER['HTTP_LANG'] 
 or something like that - can't remember of hand!).  You could do soemthing 
 like: 1. Check session for lang preference and use it. 2. Regardless of the 
 result of 1, check GET for a preference and store in session if present and 
 use it. 3. If neither 1 nor 2 has any preference, use the browser supplied 
 preference. 4. If nothing else, use a hard coded default.OK, that 
 selection taken care of :)   For hard coded strings in your PHP code use 
 Gettext and bind to standard your catalog files and use the language choice 
 from the above algorithm. xgettext can extract strings from PHP files easily 
 enough. You just have to make sure you write

[PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-27 Thread Colin Guthrie
Jochem Maas wrote:
 tedd wrote:
 At 9:37 AM -0400 11/27/07, Jeff Benetti wrote:
 Any any and all comments are welcome, it will be a learning curve no
 matter
 which route I take so a little advice on the best direction pros cons
 would
 be great.


 Thanks,
 Jeff
 Jeff:

 If it were me, I wouldn't use any problematic browser detects schemes
 (they don't work) or any of that high-thought stuff -- it's beyond me.
 
 whether it's beyond you or not only you can judge, but I disagree that it's
 problematic. I should note that I recommend using browser language preference
 detection (as per my previous post) as a means to initially select a 
 [hopefully]
 suitable language BUT that this should be done in addition to offer the user
 an explicit mechanism for language selection.

+1 on that strategy. May as well at least *try* to take an initial
educated guess!!

Col

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



[PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-27 Thread Colin Guthrie
tedd wrote:
 At 11:05 PM +0100 11/27/07, Jochem Maas wrote:
 tedd wrote:

   If it were me, I wouldn't use any problematic browser detects schemes
  (they don't work) or any of that high-thought stuff -- it's beyond me.

 whether it's beyond you or not only you can judge, but I disagree that
 it's
 problematic. I should note that I recommend using browser language
 preference
 detection (as per my previous post) as a means to initially select a
 [hopefully]
 suitable language BUT that this should be done in addition to offer
 the user
 an explicit mechanism for language selection.
 
 My beyond me statement was meant in jest, but browser sniffing is
 notorious for being inaccurate and the practice is highly controversial.
 
 http://en.wikipedia.org/wiki/Browser_sniffing

Sorry Tedd, but I'm not sure where the browser sniffing stuff came in.
IE and FF both offer a UI to input the user's preferred language, it's
an HTTP standard thing and nothign to do with user agents string
parsing. It uses the Accept-Language header sent with http requests to
detect the language. It's quite standard but problems usually crop up in
e.g. Australia and the UK where a lot of people leave the default en-US
language when en-GB or en-AU would be better. Again it's not infallible
but it's a fairly good starting point.

Another approach would be to use a geoip database and try and look up
the users IP address but, if anything, I'd say that is even less
accurate than the above.

Col

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



Re: [PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-27 Thread Jochem Maas
Colin Guthrie wrote:
 tedd wrote:

...

 
 Sorry Tedd, but I'm not sure where the browser sniffing stuff came in.
 IE and FF both offer a UI to input the user's preferred language, it's
 an HTTP standard thing and nothign to do with user agents string
 parsing. It uses the Accept-Language header sent with http requests to
 detect the language. It's quite standard but problems usually crop up in
 e.g. Australia and the UK where a lot of people leave the default en-US
 language when en-GB or en-AU would be better. Again it's not infallible
 but it's a fairly good starting point.

ditto.

with regard to 'en-GB' and the like - that's easy enough to match.
(the snippet I offered gave one one to do this)

secondly I don't consider it my problem if the user has there preferred
language set to swahili when they don't even speak that language
(besides which my site probably won't be offering swahili anyway).

 
 Another approach would be to use a geoip database and try and look up
 the users IP address but, if anything, I'd say that is even less
 accurate than the above.
 
 Col
 

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



[PHP] Re: newbie questions

2007-10-21 Thread M. Sokolewicz

Ravi wrote:


Guys, I am fairly new to PHP. Here are a few questions, if anybody can 
answer it will help me get started. Thanks


I am trying to build a website and I would like to do the following in 
my scripts


1. I want to return response to the browser and AFTERWARDS make a log 
entry in to a database. I need this so user can experience a fast response.
There is no before and after. Everything you do happens during (part 
of) the response. But you can just output your data, whatever it may be, 
flush() it and then log it via the same script. Your user won't notice a 
thing (Hell, even without the flush your user won't notice it probably).


2. If the database update fails, I want to ignore it (since it is just 
log entry). Something like try-catch construct in Java. This is more 
important if item1 mentioned above is not possible. Essentially whether 
I make a database entry or not, I must return a valid response to user.
So ignore it :) If you don't check for errors, you won't see them... 
Makes debugging very annoying, but you won't see em nevertheless. If 
your output is not based on anything from your database-update, then 
there apparently is no need to worry about it.


3. Is there something like connection pool in php? Do usually people 
open/close database connection for every request (I doubt that, it 
sounds really slow).
There is something like that, the persistent connections (ie. via 
mysql_pconnect), but generally people DO open/close connections via the 
same script each and every time the script is executed (this might sound 
very slow, but it's actually not too bad). Using persistent connections 
is not always the best option (and usually doesn't even make much 
sense); there's a good bit of documentation about it in the php docs:

http://www.php.net/manual/en/features.persistent-connections.php

Some code samples or pointers to documentation for the above would also 
be very helpful.

code samples of what exactly ?


Thanks
Ravi


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



[PHP] Re: newbie questions

2007-10-21 Thread Ravi


That was very very helpful. Thanks a ton!

One more question. For every request, I am sending a redirect back to 
the user and the browser takes the user to another url. The problem is 
that the browser is not redirecting until the script finishes. Even if I 
do flush(), the browser waits til script ends. Is there a way to force 
browser to redirect and not wait for the script to end?


In Java I can think of many ways, one is to use threads, hand of data to 
another thread and return the response. Another solution would be to 
store data in memory (static variable) and update only after every 100 
requests.


Is any of this possible in PHP?


M. Sokolewicz wrote:

Ravi wrote:


Guys, I am fairly new to PHP. Here are a few questions, if anybody can 
answer it will help me get started. Thanks


I am trying to build a website and I would like to do the following in 
my scripts


1. I want to return response to the browser and AFTERWARDS make a log 
entry in to a database. I need this so user can experience a fast 
response.
There is no before and after. Everything you do happens during (part 
of) the response. But you can just output your data, whatever it may be, 
flush() it and then log it via the same script. Your user won't notice a 
thing (Hell, even without the flush your user won't notice it probably).


2. If the database update fails, I want to ignore it (since it is just 
log entry). Something like try-catch construct in Java. This is more 
important if item1 mentioned above is not possible. Essentially 
whether I make a database entry or not, I must return a valid response 
to user.
So ignore it :) If you don't check for errors, you won't see them... 
Makes debugging very annoying, but you won't see em nevertheless. If 
your output is not based on anything from your database-update, then 
there apparently is no need to worry about it.


3. Is there something like connection pool in php? Do usually people 
open/close database connection for every request (I doubt that, it 
sounds really slow).
There is something like that, the persistent connections (ie. via 
mysql_pconnect), but generally people DO open/close connections via the 
same script each and every time the script is executed (this might sound 
very slow, but it's actually not too bad). Using persistent connections 
is not always the best option (and usually doesn't even make much 
sense); there's a good bit of documentation about it in the php docs:

http://www.php.net/manual/en/features.persistent-connections.php

Some code samples or pointers to documentation for the above would 
also be very helpful.

code samples of what exactly ?


Thanks
Ravi




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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Richard Heyes

Ravi wrote:


That was very very helpful. Thanks a ton!

One more question. For every request, I am sending a redirect back to 
the user and the browser takes the user to another url. The problem is 
that the browser is not redirecting until the script finishes. Even if I 
do flush(), the browser waits til script ends. Is there a way to force 
browser to redirect and not wait for the script to end?


In Java I can think of many ways, one is to use threads, hand of data to 
another thread and return the response. Another solution would be to 
store data in memory (static variable) and update only after every 100 
requests.


Not having read the rest of the thread, you could call exit just after 
the redirect header is sent, eg:


?php
header('Location: http://www.yahoo.com');
exit;
?

Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Ravi


Richard, unfortunately I cannot end the script. I need something like this:

?php
header('Location: http://www.yahoo.com');
// somehow let the browser move to yahoo.com
// now update the database to store some information about user
exit;
?


Richard Heyes wrote:

Ravi wrote:


That was very very helpful. Thanks a ton!

One more question. For every request, I am sending a redirect back to 
the user and the browser takes the user to another url. The problem is 
that the browser is not redirecting until the script finishes. Even if 
I do flush(), the browser waits til script ends. Is there a way to 
force browser to redirect and not wait for the script to end?


In Java I can think of many ways, one is to use threads, hand of data 
to another thread and return the response. Another solution would be 
to store data in memory (static variable) and update only after every 
100 requests.


Not having read the rest of the thread, you could call exit just after 
the redirect header is sent, eg:


?php
header('Location: http://www.yahoo.com');
exit;
?

Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support



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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Richard Heyes

Ravi wrote:


Richard, unfortunately I cannot end the script. I need something like this:

?php
header('Location: http://www.yahoo.com');
// somehow let the browser move to yahoo.com
// now update the database to store some information about user
exit;
?


In that case you might want to look at register_shutdown_function().

Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Larry Garfield
On Sunday 21 October 2007, Richard Heyes wrote:
 Ravi wrote:
  Richard, unfortunately I cannot end the script. I need something like
  this:
 
  ?php
  header('Location: http://www.yahoo.com');
  // somehow let the browser move to yahoo.com
  // now update the database to store some information about user
  exit;
  ?

 In that case you might want to look at register_shutdown_function().

That would work, but I think you're probably not approaching the question 
properly.  Why do you need to redirect the user first, then log the request?  
PHP/MySQL are fast enough that logging first and then redirecting will have 
no noticeable impact on performance or your user experience.  (I'm assuming a 
logging process here that's only 1-3 queries.)  It sounds like you're trying 
to over-optimize, which is always a bad idea as it makes the code harder to 
understand later. :-)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] Re: newbie questions

2007-10-21 Thread Ravi


Maybe you have a point. I will do performance testing and then decide if 
I should try to optimize to that point.


Yes the logging is just one simple insert into the database.

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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Greg Donald
On 10/21/07, Ravi [EMAIL PROTECTED] wrote:
 Maybe you have a point. I will do performance testing and then decide if
 I should try to optimize to that point.

 Yes the logging is just one simple insert into the database.

Does your database support some form of INSERT DELAYED ?

Like MySQL does: http://dev.mysql.com/doc/refman/5.0/en/insert-delayed.html


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Larry Garfield
I will bet you money that there are far better places to optimize your 
application than moving a single SQL insert to after the final output.

On Sunday 21 October 2007, Ravi wrote:
 Maybe you have a point. I will do performance testing and then decide if
 I should try to optimize to that point.

 Yes the logging is just one simple insert into the database.


-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] Re: Newbie: special characters in regex?

2007-09-25 Thread Al
Suggest using the hex or oct codes for the special characters.  It will save you 
much heart ache.  Here is a great utility http://www.dextronet.com/charprobe.php


Zembower, Kevin wrote:

I'm trying to modify a string so that it can be used as a Distinguished
Name in an LDAP operation. Distinguished Names must have special
characters, such as (, ), / and \ escaped with a backslash. For
instance, 'Kevin (Kev) Zembower, III becomes 'Kevin \(Kev\) Zembower\,
III'.

I tried to do this in this statement:
$entry['FirstName'] = preg_replace('/(\)|\(|\,|\/)/',`\\$1',
$entry['FirstName'];

But it gives me this error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
/var/www/centernet/htdocs/ldap_auth/conversion.php on line 89

Can anyone help me get this statement right? Also, this doesn't seem
very readable or easily maintained. I read about using an array() as the
pattern string, which might make the statement more readable. Can anyone
show me how this would be done, and suggest other ways to make this
statement more easily maintained?

Thanks for your advice and suggestions.

-Kevin

Kevin Zembower
Internet Services Group manager
Center for Communication Programs
Bloomberg School of Public Health
Johns Hopkins University
111 Market Place, Suite 310
Baltimore, Maryland  21202
410-659-6139 


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



[PHP] Re: Newbie Question - Form To Email Needed

2007-05-05 Thread itoctopus
1st page:

form
textarea name='thebody'/texarea
/form

2nd page:

$str_body = $_POST['thebody'];
mail('[EMAIL PROTECTED]', 'This is the 
subject', $str_body);

Of course you can have the email and the subject fields come also from the 
1st page.

Hope that helps!

-- 
itoctopus - http://www.itoctopus.com
revDAVE [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi folks,

 I have a form on page one - and would like to submit to a second page in 
 PHP
 that could grab the fields and send it out as an e-mail.

 Are there any links that show how do this?


 Thanks in advance - Dave


 --
 Thanks - RevDave
 [EMAIL PROTECTED]
 [db-lists] 

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



Re: [PHP] Re: newbie question about storing big5 codes into mysql-5.0.24a

2007-03-25 Thread Stut
Man-wai Chang wrote:
 create table temp ( big5 char(2) ) character set big5 collate big5_bin;
 insert into temp ( big5 ) values ( 0x9f54 );
 insert into temp ( big5 ) values ( 0x9f53 );
 The 2nd query will report duplicated key. How should I fix the problem?
 What does this has to do with PHP?
 First of all I don't see any PHP code, and second this is an error in
 your SQL query, so you should be on the MySQL list.
 
 I used mysqli_query() to send the SQL. How could I make it work?

That really doesn't make this question PHP-related. You really do need
to ask on a MySQL mailing list. This has nothing to do with PHP, and
you're more likely to get a useful answer from a MySQL-specific list.

If you really want to try and justify asking this question here, try the
queries in the command-line MySQL client. If it works there but not
through mysqli_query() then you might have a case for asking here.

-Stut

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



[PHP] Re: newbie question about storing big5 codes into mysql-5.0.24a

2007-03-25 Thread Man-wai Chang
 queries in the command-line MySQL client. If it works there but not
 through mysqli_query() then you might have a case for asking here.

For the 13081 chinese alphabets I tried, only 1 one failed, and it's
0x9f54. mysqli_query() should have escaped the string for me. So ...

I suppose most PHP programmers are also experts in MySQL (they are
basically tied). SO I tried my luck here. :)

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.4
  ^ ^   21:24:01 up 1 day 8:36 0 users load average: 1.00 1.02 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



Re: [PHP] Re: newbie question about storing big5 codes into mysql-5.0.24a

2007-03-25 Thread Jochem Maas
Man-wai Chang wrote:
 queries in the command-line MySQL client. If it works there but not
 through mysqli_query() then you might have a case for asking here.
 
 For the 13081 chinese alphabets I tried, only 1 one failed, and it's
 0x9f54. mysqli_query() should have escaped the string for me.

mysqli_query() doesn't escape anything for you - your assumption that
it *should* is WRONG.

try this: http://php.net/manual/en/function.mysqli-real-escape-string.php

 So ...
 
 I suppose most PHP programmers are also experts in MySQL (they are
 basically tied). 

incorrect supposition. most php programmers have experience using
RDBMs because of the dynamic nature of the websystems they build.

mysql and php and not tied at all .. they just happen to be used together
frequently.

 SO I tried my luck here. :)
 

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



[PHP] Re: newbie question about storing big5 codes into mysql-5.0.24a

2007-03-24 Thread Man-wai Chang
 create table temp ( big5 char(2) ) character set big5 collate big5_bin;
 insert into temp ( big5 ) values ( 0x9f54 );
 insert into temp ( big5 ) values ( 0x9f53 );
 The 2nd query will report duplicated key. How should I fix the problem?
 What does this has to do with PHP?
 First of all I don't see any PHP code, and second this is an error in
 your SQL query, so you should be on the MySQL list.

I used mysqli_query() to send the SQL. How could I make it work?

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.4
  ^ ^   14:43:01 up 1 day 1:55 0 users load average: 1.01 1.02 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



[PHP] Re: newbie question

2007-03-21 Thread itoctopus
Means you're passing the variable as reference.
This means that any change in the variable inside your function will affect
the variable outside your function, in other terms:

if you have

function myfunc($var){
$var = 5;
}

$a = 6;
myfunc($a);

will result in having $a=5 after the function all.

--
itoctopus - http://www.itoctopus.com
bob pilly [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all

 Can anyone tell me what '' means before a var?

 e.g function($var)

 Thanks for any help in advance





 ___
 What kind of emailer are you? Find out today - get a free analysis of your
email personality. Take the quiz at the Yahoo! Mail Championship.
 http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

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



[PHP] Re: newbie php tutorial question

2006-10-02 Thread zerof

srdaniel escreveu:

I setup Apache 2.2.3.0 and PHP 5.1.6.6.

When I run this PHP file:


html
 head
  titlePHP Test/title
 /head
 body
 ?php echo 'pHello World/p'; ?
 /body
/html


-
Start here:
http://www.educar.pro.br/
-
zerof

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread Jon Anderson

Satyam wrote:

for ($x=0;$x1000;$x++) {
   echo ' trtdX is ' , $x , '/td/tr';
}
This seems to be a hair faster. I extended the test to 1 requests 
(still concurrency 10) to make the test a little more reproducible:


echo str,var,str did 604.65 requests a second where trtd?= $x 
?/td/tr did 599.63 requests a second. I also tried echo str . var . 
str, and it came in at about 584.55 requests a second.  printf(str %i 
str,var) came out at 547.01 requests a second and printf(str %s 
str,var) was only 452.03 requests a second.
Can you try and time that one so we have comparable results?  This one 
should be second best:


for ($x=0;$x1000;$x++) {
   echo trtdX is $x/td/tr;
}

Approximately 330 (?!) requests a second for that one.
Back again to what would be 'longer', well, in your example, the whole 
header, up to the loop itself should be faster if sent out of PHP. 
Likewise, you could echo $buffer right after the loop, drop out of PHP 
and send the footer as plain HTML.  This, of course, is harder to time 
since it happens only once.  I admit though that I did time the 
options I listed and on the 'dropping in and out of PHP' I'm relying 
on the PHP manual ( see 
http://www.php.net/manual/en/language.basic-syntax.php, the first 
paragraph after the examples) and the source of the lexical scanner, 
which supports that, though your numbers do contradict it.  Interesting. 
I'm not sure that my results would count as contradictory - I'm running 
APC which would likely throw performance related numbers out of whack as 
compared to out-of-the-box PHP.


Because of that, I wouldn't recommend anyone take my numbers too 
seriously - they're just an example taken from my server: 1.8 GHz 
SMP/1G/RAID5/Linux 2.6.17.7/Apache 2.2.3/PHP 5.1.6/APC 3.0.12p2. Anyone 
else's results would probably vary widely.


jon

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread Stut

How bored am I?

This bored: http://dev.stut.net/phpspeed/

Server is running PHP 5.1.2 (really should upgrade that) with no caches 
of any sort.


-Stut

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread tedd

At 4:56 PM +0100 9/11/06, Stut wrote:

How bored am I?

This bored: http://dev.stut.net/phpspeed/

Server is running PHP 5.1.2 (really should upgrade that) with no 
caches of any sort.


-Stut


Which begs the question, does it make much of a difference? (not you 
being bored, but the rather speed concers).


With all the things out there that can slow your browsers reaction 
time in presenting some result, does a couple of seconds count much 
in the over all scheme of things?


I know, purest will say that they want to make whatever they do as 
fast as possible, but is that time to make it faster be better spent 
elsewhere? We used to have to worry about the size of our strings, 
but now we can place the kjv of the bible in one. So, what's the 
point of counting characters in strings now?


I suspect at some point, probably soon, speed isn't going to matter much.

Opinions?

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread Satyam
I admit I'm totally surprised about the buffered results.  Nevertheless, may 
I sugest you add the following to the series of tests?:


   h3Using line-by-line single-quoted echobr/with comma separated 
arguments/h3

?php
   $start = mt();
   print 'table style=display:none; id=table2a';
   for ($x = 0; $x  $iterations; $x++)
   {
   echo 'trtdX is/tdtd',$x,'/td/tr';
   }
   print '/table';

   $duration = mt() - $start;
   print 'pTook '.number_format($duration, 4).' seconds/p';
?
   praquo; a id=table2alink
   href=# 
onclick=document.getElementById('table2a').style.display='block';
   document.getElementById('table2alink').style.display='none';return 
false;

   Reveal output/a/p

There seems to be one thing rarely anybody remembers, echo admits multiple 
arguments, and as the numbers will show, (or at least they do in my 
machine), they are the second best option.


Satyam


- Original Message - 
From: Stut [EMAIL PROTECTED]

To: Jon Anderson [EMAIL PROTECTED]
Cc: Satyam [EMAIL PROTECTED]; php-general@lists.php.net
Sent: Monday, September 11, 2006 5:56 PM
Subject: Re: [PHP] Re: Newbie question about ?= ?



How bored am I?

This bored: http://dev.stut.net/phpspeed/

Server is running PHP 5.1.2 (really should upgrade that) with no caches of 
any sort.


-Stut

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




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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread Stut

Satyam wrote:
I admit I'm totally surprised about the buffered results.  
Nevertheless, may I sugest you add the following to the series of tests?:


   h3Using line-by-line single-quoted echobr/with comma 
separated arguments/h3

snip

There seems to be one thing rarely anybody remembers, echo admits 
multiple arguments, and as the numbers will show, (or at least they do 
in my machine), they are the second best option.


Done, but again it doesn't seem to make any significant difference to 
the performance.


-Stut

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread Stut

tedd wrote:

At 4:56 PM +0100 9/11/06, Stut wrote:

How bored am I?

This bored: http://dev.stut.net/phpspeed/

Server is running PHP 5.1.2 (really should upgrade that) with no 
caches of any sort.


-Stut


Which begs the question, does it make much of a difference? (not you 
being bored, but the rather speed concers).


With all the things out there that can slow your browsers reaction 
time in presenting some result, does a couple of seconds count much in 
the over all scheme of things?


I know, purest will say that they want to make whatever they do as 
fast as possible, but is that time to make it faster be better spent 
elsewhere? We used to have to worry about the size of our strings, but 
now we can place the kjv of the bible in one. So, what's the point of 
counting characters in strings now?


I suspect at some point, probably soon, speed isn't going to matter much.

Opinions?


I would have to agree. Having watched the server CPU load while playing 
with this test script it would  appear that the performance can be 
skewed a lot more by that than by the method you use for squidging out 
the output.


As a curiosity I've also added a test using ?php print $x; ? and 
bizarrely that appears to be slightly faster than ?=$x?.


Weird.

-Stut

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread Stut

Jon Anderson wrote:

Stut wrote:

How bored am I?

This bored: http://dev.stut.net/phpspeed/

Server is running PHP 5.1.2 (really should upgrade that) with no 
caches of any sort. 
Just looking through the source, could you try changing the first 
example to put the output all on one line? It's the only one that does 
the row output on multiple indented lines - I'm kind of curious what 
effect (if any) that has on the results.


Done. Doesn't seem to make a difference - I didn't expect it to.

I also tried this on my own server. With the opcode cache, the results 
seem to be the inverse of yours without.


I would have been surprised if an opcode cache had made a huge 
difference. I don't think the Zend Engine is intelligent enough to 
compile the various different tests to the same set of opcodes - but I 
could be wrong. I'm still quite new to the PHP internals.


Also, with either server, the first three results seem to vary wildly, 
but the last two always seem to come out the same. I'm not sure why 
that is...


As I said in another post, the performance varies wildly with the load 
on the server.


-Stut

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread Satyam
- Original Message - 
From: Stut [EMAIL PROTECTED]

To: Satyam [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, September 11, 2006 6:32 PM
Subject: Re: [PHP] Re: Newbie question about ?= ?



Satyam wrote:

I admit I'm totally surprised about the buffered results.  Nevertheless,
may I sugest you add the following to the series of tests?:

   h3Using line-by-line single-quoted echobr/with comma separated
arguments/h3
snip

There seems to be one thing rarely anybody remembers, echo admits
multiple arguments, and as the numbers will show, (or at least they do in
my machine), they are the second best option.


Done, but again it doesn't seem to make any significant difference to the
performance.

-Stut




When I run those tests locally, the numbers are totally different and the
performance of one over the other comes out far clearer.  I can only assume
that the numbers in the test run  in a remote server are so much influenced
by the ability of the server to push out the characters into the output
stream that the processing time itself is of very little relevance.  This
table shows the numbers for the different tests as run on my machine,
locally (where output streaming is irrelevant) and run from your site:

Using ?=$x?Took 0.2801 secondsTook
3.5937 seconds

Using ?php print $x; ?Took 0.3286 secondsTook 5.2654 seconds

Using line-by-line single-quoted print:Took 0.1215 secondsTook
3.2256 seconds

Using line-by-line single-quoted echo
with comma separated argumentsTook 0.2542 secondsTook 3.2220
seconds

Using line-by-line double-quoted print Took 0.1782 secondsTook
3.3129 seconds

Using buffered single-quoted printTook 0.0277 secondsTook 3.3077
seconds

Using buffered double-quoted printTook 0.2038 seconds Took 3.3012
seconds

It would seem that it takes about 3 seconds to push those bytes into the
network, the actual processing times get completely masked behind a simple
glitch in the throughput of the communication line.  While the differences
on the rightmost column (except for the second one, which is way off) are no
more than 5%, in the middle column the differences are up to 10 to 1.  But
then there is that second row, which is so much higher and it is so in both
columns.

Unfortunately, I cannot make much sense about all this.  I don't get it.
Nevertheless, something it is clear is that buffering all the output first
and then pushing it out all at once seems to beat them all, specially using
single quoted strings.  Run locally, the differences are amazing!

Satyam

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-11 Thread tedd

At 5:36 PM +0100 9/11/06, Stut wrote:

tedd wrote:

Opinions?


I would have to agree. Having watched the server CPU load while 
playing with this test script it would  appear that the performance 
can be skewed a lot more by that than by the method you use for 
squidging out the output.


As a curiosity I've also added a test using ?php print $x; ? and 
bizarrely that appears to be slightly faster than ?=$x?.


Weird.


My guess would be that it's in the interpreter -- the look-up for 
? as compared to ?php may be delayed because of checking for 
the short-tag option-on, or something similar. But, I admittedly 
don't know.


However, I strongly suspect that drawing to the screen will take 
longer than executing any = or print statement anyway. So 
regardless of the time saved in computation, the delivery would 
appear identical. It reminds me of the hurry-up and wait saying we 
had in the Army some 50 years back.


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

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



[PHP] Re: Newbie question about ?= ?

2006-09-10 Thread Al

Mike Borrelli wrote:

Good day,

While I've been using php for more than a little while now, I've never
understood why the use of the ?= ...? short tag is noted to be
avoided.

Or rather, I understand that there's an option to disable it, and that's
why it's noted in this way, but I don't understand why it's disabled? 
What's gained by writing ?php echo some_function(); ? over ?=

some_function(); ?

Thanks in advance.

Cheers,
Mike
Structurally, there is a far better way to compile your html pages.  This approach is easier to design and debug and it 
is faster since it sends one complete packet instead of one for every short tag. And, it saves using ob_start() and 
ob_flush().


Consider:

$report= '';

$report .= function() [or whatever]

. repeat as necessary to assemble your complete page.

Then simply

echo $report;

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-10 Thread Satyam


- Original Message - 
From: Al [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Sunday, September 10, 2006 5:52 PM
Subject: [PHP] Re: Newbie question about ?= ?



Mike Borrelli wrote:

Good day,

While I've been using php for more than a little while now, I've never
understood why the use of the ?= ...? short tag is noted to be
avoided.

Or rather, I understand that there's an option to disable it, and that's
why it's noted in this way, but I don't understand why it's disabled? 
What's gained by writing ?php echo some_function(); ? over ?=

some_function(); ?

Thanks in advance.

Cheers,
Mike
Structurally, there is a far better way to compile your html pages.  This 
approach is easier to design and debug and it is faster since it sends one 
complete packet instead of one for every short tag. And, it saves using 
ob_start() and ob_flush().


Consider:

$report= '';

$report .= function() [or whatever]

. repeat as necessary to assemble your complete page.

Then simply

echo $report;



Actually, in my experience, that is not the case, my e-mail from more than a 
year ago must be somewhere there in the archives, but what you sugest is not 
the fastest.


The fastest is to escape out of php (with a ? ) for the longer invariable 
parts of immutable HTML. Stepping out from PHP and in again is handled by 
the lexical scanner, it doesn't even reach the parser level so, for all 
effects, the PHP interpreter is basically frozen at the point before the ? 
was found. For the sake of completeness, the ? is translated as a ; for the 
parser so it ends any statement that could have been left open, but it does 
not bother the parser at all for all the rest of the characters found until 
a ?php tag (or equivalent) is found.  If the lexer didn't issue a ; for a 
?, the following code would be valid:


echo 'This ' , ? is ?php 'not valid';

For the variable parts, the best is to issue as little echos as possible 
with its arguments separated by commas, not with dots.  Most people don't 
realize that echo taks a list of arguments, a list separated by commas. 
Thus, in the ratings, from best to worst, it goes:


echo 'p' , $something, '/p';
echo p$something/p
echo 'p' . $something . '/p';
echo 'p'; echo $something; echo '/p';

The reason for this is that generating a single string either from variable 
interpolation as in the second case or by concatenating the arguments, as in 
the third,  requires a lot of memory handling for the strings and its 
intermediate and final results.  Some of it might be delayed until the page 
is served so the time the garbage collector takes to clean it up might not 
be fully reflected in the processing time of a single page, but it does 
affect the overall throughput of the server.  Notice also that I have used 
single quotes whenever possible, which is slightly faster since the parser 
has much less to look for within it.


Finally, the first option is the fastest just as a C++ iostream or a Java 
StringBuffer are faster than plain strings: since you know you will only 
append to the end of them, the characters echoed go into a much more 
efficient character buffer instead of a more complex string which has to be 
available for all sorts of string operations.


Satyam

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-10 Thread Jon Anderson

Al wrote:
Structurally, there is a far better way to compile your html pages.  
This approach is easier to design and debug and it is faster since it 
sends one complete packet instead of one for every short tag. And, it 
saves using ob_start() and ob_flush().


Consider:

$report= '';

$report .= function() [or whatever]

. repeat as necessary to assemble your complete page.

Then simply

echo $report;
I thought I'd look into this, because I'm a bit of a performance nut - I 
like  my code to run as fast as possible at all times. I wrote up a 
quick buffer v.s. direct benchmark for this, and the winner is clear: 
direct output is much faster. (If my example below isn't  what you 
meant, please let me know. I'm always happy to hear  new ways  to 
improve my code.)


Best of 3 runs with apache bench (concurrency 10, 1000 requests total):
Direct output: 582 requests a second
Buffer var: 286 requests a second

I believe the margin would get wider with real-world usage, as the 
buffer variable would increase in size. My test code is copied below.


jon

--- Direct output: testecho.php ---

html
head
style type=text/wastespacetosimulateastylesheet
style1 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style2 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style3 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style4 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
/style
/head
bodytable

?php for ($x=0;$x1000;$x++) { ?
   trtdX is ?= $x ?/td/tr
?php } ?

/table/body
/html

--- Buffered output: testbuffer.php ---

?php

$buffer = '
html
head
style type=text/wastespacetosimulateastylesheet
style1 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style2 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style3 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style4 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
/style
/head
bodytable';

for ($x=0;$x1000;$x++) {
   $buffer .= trtdX is $x/td/tr;
}

$buffer .= '/table/body
/html';

echo $buffer;
?

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



Re: [PHP] Re: Newbie question about ?= ?

2006-09-10 Thread Satyam


- Original Message - 
From: Jon Anderson [EMAIL PROTECTED]

To: php-general@lists.php.net
Cc: Al [EMAIL PROTECTED]
Sent: Sunday, September 10, 2006 9:16 PM
Subject: Re: [PHP] Re: Newbie question about ?= ?



Al wrote:
Structurally, there is a far better way to compile your html pages.  This 
approach is easier to design and debug and it is faster since it sends 
one complete packet instead of one for every short tag. And, it saves 
using ob_start() and ob_flush().


Consider:

$report= '';

$report .= function() [or whatever]

. repeat as necessary to assemble your complete page.

Then simply

echo $report;
I thought I'd look into this, because I'm a bit of a performance nut - I 
like  my code to run as fast as possible at all times. I wrote up a quick 
buffer v.s. direct benchmark for this, and the winner is clear: direct 
output is much faster. (If my example below isn't  what you meant, please 
let me know. I'm always happy to hear  new ways  to improve my code.)


Best of 3 runs with apache bench (concurrency 10, 1000 requests total):
Direct output: 582 requests a second
Buffer var: 286 requests a second

I believe the margin would get wider with real-world usage, as the buffer 
variable would increase in size. My test code is copied below.


jon

--- Direct output: testecho.php ---

html
head
style type=text/wastespacetosimulateastylesheet
style1 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style2 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style3 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style4 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
/style
/head
bodytable

?php for ($x=0;$x1000;$x++) { ?
   trtdX is ?= $x ?/td/tr
?php } ?

/table/body
/html

--- Buffered output: testbuffer.php ---

?php

$buffer = '
html
head
style type=text/wastespacetosimulateastylesheet
style1 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style2 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style3 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
style4 {
   a = 1;
   b = 2;
   c = 3;
   d = 4;
   e = 5;
   f = 6;
}
/style
/head
bodytable';

for ($x=0;$x1000;$x++) {
   $buffer .= trtdX is $x/td/tr;
}

$buffer .= '/table/body
/html';

echo $buffer;
?

--
In my message I was careful to mention that stepping in and out of PHP was 
good 'for the longer invariable  parts of immutable HTML'.  What could be 
considered 'longer' is certainly a matter discussion, your results prove 
that this is not long enough.  Notice that when the parser finds the '?=', 
it converts it into the equivalent of ? echo, thus, though the echo is 
not explicitly there, from the parser on is as if it were.   Then, since you 
have an echo, why not use it for all of the output?The equivalent to 
what I showed as the second best, which would be the first best with 
'shorter' strings would be the following:


for ($x=0;$x1000;$x++) {
   echo ' trtdX is ' , $x , '/td/tr';
}

Can you try and time that one so we have comparable results?  This one 
should be second best:


for ($x=0;$x1000;$x++) {
   echo trtdX is $x/td/tr;
}

Back again to what would be 'longer', well, in your example, the whole 
header, up to the loop itself should be faster if sent out of PHP. 
Likewise, you could echo $buffer right after the loop, drop out of PHP and 
send the footer as plain HTML.  This, of course, is harder to time since it 
happens only once.  I admit though that I did time the options I listed and 
on the 'dropping in and out of PHP' I'm relying on the PHP manual ( see 
http://www.php.net/manual/en/language.basic-syntax.php, the first paragraph 
after the examples) and the source of the lexical scanner, which supports 
that, though your numbers do contradict it.  Interesting.


Satyam

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



[PHP] Re: Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Barry

Duggles Temple wrote:

Hi,

I'd like to say in advance that I am sorry about the silly and very newbie
question I'm asking.

I am having a problem with a shop system. I can't add values into the MySQL
DB via a PHP statement. The values are being transferred from one page to
another (know that from the echo statement), but the SQL statement isn't
working.



What error do you get?



The statement is as follows:

$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect to
database');
$t = $_GET['newdvdtitle'];
$y = $_GET['newdvdyear'];
$c = $_GET['newdvdcost'];
$p = $_GET['newdvdpurchased'];
@mysql_select_db($DBName) or die(Unable to select database $DBName);
$sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
VALUES (  NULL , '$t', '$y', '$c' , '$p' );
echo $sqladd;
$result = mysql_query($sqladd);


Insert Into dvd (title, year,cost,purchased)

When the id is auto_increment you dont have to add it to the query.
Barry


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] Re: Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Dan Parry
Also when specifying the field list (and table name) it may be a better idea
to wrap the values in backticks (`) rather than quotes (')

Always works for me

Dan

-Original Message-
From: Barry [mailto:[EMAIL PROTECTED] 
Sent: 10 February 2006 10:31
To: php-general@lists.php.net
Subject: [PHP] Re: Newbie Question Can't insert values into MySQL DB via
PHP

Duggles Temple wrote:
 Hi,
 
 I'd like to say in advance that I am sorry about the silly and very newbie
 question I'm asking.
 
 I am having a problem with a shop system. I can't add values into the
MySQL
 DB via a PHP statement. The values are being transferred from one page to
 another (know that from the echo statement), but the SQL statement isn't
 working.
 

What error do you get?


 The statement is as follows:
 
 $conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect
to
 database');
 $t = $_GET['newdvdtitle'];
 $y = $_GET['newdvdyear'];
 $c = $_GET['newdvdcost'];
 $p = $_GET['newdvdpurchased'];
 @mysql_select_db($DBName) or die(Unable to select database $DBName);
 $sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
 VALUES (  NULL , '$t', '$y', '$c' , '$p' );
 echo $sqladd;
 $result = mysql_query($sqladd);

Insert Into dvd (title, year,cost,purchased)

When the id is auto_increment you dont have to add it to the query.
Barry


-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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

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



[PHP] Re: Newbie to PHP5

2005-11-22 Thread Yoyo

Danny wrote:

Hi there,
 I´m familiar with PHP syntax, but I´ve been reading some sample scripts, in
PHP5 and i´ve seen some strange things, like diferent ways to read a
collection of rows, magic functions, wrapers, and operators like :: and
-. I know that all is the manual, but before that anyone nows, a website
or a simple tutorial or explained samples, in order that the transition from
PHP4 and PHP5 were easiest as possible.
 Thanks

--
dpc




http://www.faqts.com/knowledge_base/view.phtml/aid/22154/fid/1150

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



Fwd: [PHP] Re: newbie questionsession and cookie by javascript

2005-09-23 Thread Alex Andrew Mosqueda
Thanks.

-- Forwarded message --
From: Ben [EMAIL PROTECTED]
Date: Sep 22, 2005 5:29 PM
Subject: [PHP] Re: newbie questionsession and cookie by javascript
To: php-general@lists.php.net

Alex Andrew Mosqueda said the following on 09/22/05 06:28:
 Hi!
 I there a way I can get the cookie data stored by javascript(client side)
in
 php(server side) and vice versa?
 Thanks.


It never hurts to check php.net http://php.net, plenty of useful
information there...

$_cookie['cookie name']

http://ca3.php.net/manual/en/features.cookies.php

- Ben

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


[PHP] Re: newbie questionsession and cookie by javascript

2005-09-22 Thread Ben
Alex Andrew Mosqueda said the following on 09/22/05 06:28:
 Hi!
 I there a way I can get the cookie data stored by javascript(client side) in
 php(server side) and vice versa?
 Thanks.


It never hurts to check php.net, plenty of useful information there...

$_cookie['cookie name']

http://ca3.php.net/manual/en/features.cookies.php

- Ben

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



[PHP] Re: Newbie Variable Question

2005-03-09 Thread Jason Barnett
Jackson Linux wrote:
...
 php include_once /path/to/cv.$r.include.php; ? asks for
 cv.'1'.include.php ... And I need it to ask for cv.1.include.php

 How can I make a variable to fetch the literal number from the field
 cv.category?

Not 100% certain that it will work, but try casting the variable $r to
an integer:

?php include_once /path/to/cv. . (int) $r . .include.php; ?


 Thanks in advance!
 Jack


--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Re: Newbie Variable Question

2005-03-09 Thread Jackson Linux
On 9 Mar 2005, at 11:15, Jason Barnett wrote:
Jackson Linux wrote:
...
php include_once /path/to/cv.$r.include.php; ? asks for
cv.'1'.include.php ... And I need it to ask for cv.1.include.php
How can I make a variable to fetch the literal number from the field
cv.category?
Not 100% certain that it will work, but try casting the variable $r to
an integer:
?php include_once /path/to/cv. . (int) $r . .include.php; ?

H. If  only. . .This returns, regardless of input and the value of 
$r

cv.0.include.php'
 For chuckles, I did check and the column is set in the table as INT.  
If that matters.
...?

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


Re: [PHP] Re: Newbie Variable Question

2005-03-09 Thread Jochem Maas
Jackson Linux wrote:
On 9 Mar 2005, at 11:15, Jason Barnett wrote:
Jackson Linux wrote:
...
php include_once /path/to/cv.$r.include.php; ? asks for
cv.'1'.include.php ... And I need it to ask for cv.1.include.php
How can I make a variable to fetch the literal number from the field
cv.category?

Not 100% certain that it will work, but try casting the variable $r to
an integer:
?php include_once /path/to/cv. . (int) $r . .include.php; ?

H. If  only. . .This returns, regardless of input and the value of $r
cv.0.include.php'
 For chuckles, I did check and the column is set in the table as INT.  
If that matters.
not really - what matters is that you understand typecasting in php.
a string when cast to an integer will always be zero unless the string
begins with numeric chars, in which case php will take all the numeric chars
it finds until it comes across a char that is not numeric and return those chars
(I don't know exactly how it handles decimal points and minus signs in such as 
case)
echo (int) 1string;
echo (int) string1;
...?
Jack
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Newbie Variable Question

2005-03-09 Thread Jackson Linux
Jochem and everyone,
Thanks, this solved the problem.
Regarding someone's much appreciated comment:
snip[this]...allows any user to simply change the value of r to 
something more to
their liking. given the reset of the code that you included in your
first message, who knows what nice holes they'll find in your code when
they do that. depending on where you go with this, they could end up
with information for/about another user, a nice sql injection on your
database, the ability to hack your system, or something else equally
amusing./snip

I agree, and actually had thought of it. I appreciate your reminding 
me. Because I am new enough that I still find a magical thrill every 
time I pull *anything* from the database, I have been approaching this 
from this point of view:

1. Make db
2. Try to get page to connect
3. Try to print what I want by setting the variable $r so I can point 
to it
4. Fix it so that if someone asks for anything other than an existent 
?r=x  it kicks back a webpage which just shows links to existing pages.

Which brings me to the next question, which I'll post in a second!
Thanks again everyone!
--Jack
On 9 Mar 2005, at 11:43, Jochem Maas wrote:
Jackson Linux wrote:
On 9 Mar 2005, at 11:15, Jason Barnett wrote:
Jackson Linux wrote:
...
php include_once /path/to/cv.$r.include.php; ? asks for
cv.'1'.include.php ... And I need it to ask for cv.1.include.php
How can I make a variable to fetch the literal number from the field
cv.category?

Not 100% certain that it will work, but try casting the variable $r 
to
an integer:

?php include_once /path/to/cv. . (int) $r . .include.php; ?

H. If  only. . .This returns, regardless of input and the value 
of $r
cv.0.include.php'
 For chuckles, I did check and the column is set in the table as INT. 
 If that matters.
not really - what matters is that you understand typecasting in php.
a string when cast to an integer will always be zero unless the string
begins with numeric chars, in which case php will take all the numeric 
chars
it finds until it comes across a char that is not numeric and return 
those chars
(I don't know exactly how it handles decimal points and minus signs in 
such as case)

echo (int) 1string;
echo (int) string1;
...?
Jack

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


[PHP] Re: [NEWBIE] How to allow for a href tags but no others?

2005-02-25 Thread Jason Barnett
The solution for this problem (doing it in the matter that you are
suggesting) is certainly going to involve preg_replace().  However, this
will require you to match only the tags you want to let through (which
is always dangerous) and then strip out all of the rest of them.  This
can be very tricky to say the least.

A common way that forums deal with this problem is that rather than
letting users create url links they create their own specialized
format for letting users create urls.  For instance:

[url=http://somesite.com/path/to/somepage.php]

This way you can still strip out all  and  characters as well as the
text in between them.  And now you've limited the problem text to
everything inside the pattern [url=*].  You'll still have to look out
for MySQL commands, but you've at least limited the problem with tags.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: [NEWBIE] Trying to combine array into one string

2005-02-15 Thread Ospinto
while ($tantoData = mysql_fetch_array($tantoResult))
 {
 $tantoEmailArray[] = $tantoData;
 }

now all the values are stored into an array ($tantoEmailArray). to convert
an array to a string and join the elements together by a delimiter, use
implode.
hence: implode(,,$tantoEmailArray);
so final email command could be:

mail(implode(,,$tantoEmailArray), $subject, $mailcontent, $addHeaders);

cheers


Dave [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 PHP General,

 The Situation:
 I'm retrieving some email addresses from a database. I want to be
 able assemble all the addresses into one string that I can use in the
 mail() command. At no time should there ever be more than about 5 email
 addresses collected from the database. I want all addresses to appear in
 the To: field so everyone receiving the email will know who else has a
 copy.

 The Problem:
 I can't quite figure out how to take the results of the
 mysql_query() and assemble them into a string. In my experiments so far,
 I either get a mysql_data_seek(): Offset 0 is invalid for MySQL result
 index error, or my mail function sends to a blank address.

 What I've Tried So Far:
 My own code is obviously flawed in syntax in logic, so I searched
 the manual and this list's archives under the terms array,
 concatenate, convert, append and string in various combinations.
 However, while I learned some interesting tips on a variety of topics, I
 suspect I'm missing some essential description that will lead me to the
 command I need.

 The Question:
 How do I take the contents of an array and turn them into a single
 string?

 For Reference:
 Here is the code I have. I know it's flawed, but hopefully it will
 give an indication of what I'm trying to achieve:
 --code--
 $tantoQuery = SELECT forum_members.emailAddress AS email FROM
 forum_members, event_tanto WHERE forum_members.ID_MEMBER =
 event_tanto.tanto AND event_tanto.event =' . $show . ';

 $tantoResult = mysql_query($tantoQuery);

 while ($tantoData = mysql_fetch_array($tantoResult))
 {
 $tantoEmail = $tantoEmail . , . $tantoData;
 }

 mail($tantoEmail, $subject, $mailcontent, $addHeaders);
 --code--

 Any help would be much appreciated.

 --
 Dave Gutteridge
 [EMAIL PROTECTED]
 Tokyo Comedy Store
 http://www.tokyocomedy.com/english/

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



Re: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-26 Thread Rolf Østvik
[EMAIL PROTECTED] (John Nichel) wrote in
news:[EMAIL PROTECTED]: 

 Jay Blanchard wrote:
 [snip]
 CR Just a thought, but would it be worth someone posting the list
 CR once a week to catch new users as they sign up?
 
 Isn't it posted once a month as it is?
 [/snip]
 
 It used to be, but it seems that it hasn't been posted in a while. So
 I retrieved it and posted it. I was thinking about setting up a cron
 to post it every other day or so.
 
 Didn't it used to get sent out to people when they subscribed to the 
 list too?  Anyone know if that still happens?

Well, i only accesses this list on usenet. I haven't subscribed to
anything. 

-- 
Rolf

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



RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-26 Thread Jay Blanchard
[snip]
Now, perhaps, an INTERESTING project for some of us to work on would be
that system:

Spec:
Robot subscriber to PHP-General.
Reads all incoming messages.
Discards anything that looks like a 'Reply:' including:
  Has 'Re: ' or 'Fwd:  in subject
  Has Message ID in-reply-to header thingies
Concats Subject and body, with signatures removed.
Removes all common English words
Searches for remaining [key]words in php.net/faq.php
If any matches, deep-link (with #xyz) to the FAQ answers.
If number of remaining [key]words (above) is small, also compose a URL
link to http://php.net/remaining+keywords
Creates a reply email (to original poster only) suggesting that maybe
they
just need to check those links, but to REPLY to their post if they're
STILL lost after reading all that stuff.

That way, if any of us see a question that we KNOW is answered in FAQ or
php.net/xyz and that is not a Reply of some kind, we can let the robot
handle it.

What do you think?

Worth doing?

Waste of time?

You interested in implementing or testing it?

Got a server where you control smrsh and whatnot enough to handle it?
[/snip]

I like it a lot. And I would be glad to put in my 0.02. As we are
developing a knowledge base for our internal users and this falls along
the same lines I would have to say to count me in.

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



RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-26 Thread Jay Blanchard
[snip]
I'm not going to promise any of this.  If someone else is willing to 
donate the hardware to make this happen then contact me / the list.  Of 
course anyone else that wants to donate coding time is more than welcome

to join project ParrotHeadPoster.  :)

I can already imagine it now...

I'm a talking phParrot and I think I can help you.  Try reading what 
you find at the following link(s):
[/snip]

Cool, a ParrotHead reference and name for the project in one post. WTG
Jason!

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



RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-26 Thread Jay Blanchard
[snip]
...lots of really good stuff...
[/snip]

So, basically I saw 3 possible action items from this discussion...

1. phParrot development
2. Weekly CRON of NEWBIE GUIDE (once I get the e-mail portion figured
out)
3. OT posts should contain a TIP or TRICK? If we did this we could
harvest them once in a while for dissemination to the group. How you
say? You could contain the tip in a tag, example...

[tip type=query error checking author=Jay Blanchard]
When issueing a query to the database I always find it healthy to do
error checking in this form
if(!($resultOfQuery = mysql_query($query, $databaseConnection))){
echo This gave me an error  . mysql_error() . \n;
exit();
}
If an error is thrown the application exits immediately so that I can
correct and move on.
[/tip]

As you can see, using some reasonable regex would get the tip out. Also,
when phParrot is up and running a tip can be given with each reply if a
databse of these tips was gathered. Someone then could gather all of the
tips, publish a book and make us all famous.

I may have had too much caffeine this AM -- looks like my enthusiasm
level is set to 'HIGH'

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



Re: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-26 Thread Jochem Maas
Jay Blanchard wrote:
[snip]
Now, perhaps, an INTERESTING project for some of us to work on would be
that system:
Spec:
Robot subscriber to PHP-General.
Reads all incoming messages.
Discards anything that looks like a 'Reply:' including:
  Has 'Re: ' or 'Fwd:  in subject
  Has Message ID in-reply-to header thingies
Concats Subject and body, with signatures removed.
Removes all common English words
Searches for remaining [key]words in php.net/faq.php
If any matches, deep-link (with #xyz) to the FAQ answers.
If number of remaining [key]words (above) is small, also compose a URL
link to http://php.net/remaining+keywords
Creates a reply email (to original poster only) suggesting that maybe
they
just need to check those links, but to REPLY to their post if they're
STILL lost after reading all that stuff.
That way, if any of us see a question that we KNOW is answered in FAQ or
php.net/xyz and that is not a Reply of some kind, we can let the robot
handle it.
What do you think?
Worth doing?
Waste of time?
You interested in implementing or testing it?
Got a server where you control smrsh and whatnot enough to handle it?
[/snip]
I like it a lot. And I would be glad to put in my 0.02. As we are
developing a knowledge base for our internal users and this falls along
the same lines I would have to say to count me in.
I like the sound of it too.
shall we crystalize what we want/decided into a new post?
1. what we want: i.e. repository of list tips/solutions etc
2. a parrot
3. where to host
4. who/where to run the parrot
5. any other business
Jay maybe your the man for that job? not trying to force anything on you
but I reckon we could do with a 'lead man' of some sorts to do a little 
coordinating
and possibly just make a decision (avoid endless discusion about minutae)
Also I may have a machine capable of running the parrot - its on the same 
subnet as nl2.php.net
so connection speed is no probs but I have no idea how process intensive the 
parrot would be
(if its too heavy I would have to decline cos there are commercial site running 
on the same box
which expect a certain level of performance :-) ...paying customers, you get 
the picture!).
BTW ParrotHeadPoster is a fitting name, lets keep it!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-26 Thread Jochem Maas
Jay Blanchard wrote:
[snip]
...lots of really good stuff...
[/snip]
So, basically I saw 3 possible action items from this discussion...
1. phParrot development
2. Weekly CRON of NEWBIE GUIDE (once I get the e-mail portion figured
out)
3. OT posts should contain a TIP or TRICK? If we did this we could
harvest them once in a while for dissemination to the group. How you
say? You could contain the tip in a tag, example...
[tip type=query error checking author=Jay Blanchard]
When issueing a query to the database I always find it healthy to do
error checking in this form
if(!($resultOfQuery = mysql_query($query, $databaseConnection))){
echo This gave me an error  . mysql_error() . \n;
exit();
}
If an error is thrown the application exits immediately so that I can
correct and move on.
[/tip]
4. a website/subsite  related DB to store data for phParrot, tips, etc.
phparrot.net is up for grabs - I'm happy to register it (can't grace the list 
with
ace mathematical explainations :-) but I'm happy to shell out a few bucks as a 
way
of giving back a little) - and I'd just as happily transfer the domain into the 
hands
of an 'official' php organisation if and when people think its required (at no 
charge).
or maybe someone else want to register it?
also nobody seems to dare speak up regarding a 'front man'?

As you can see, using some reasonable regex would get the tip out. Also,
when phParrot is up and running a tip can be given with each reply if a
databse of these tips was gathered. Someone then could gather all of the
tips, publish a book and make us all famous.
I may have had too much caffeine this AM -- looks like my enthusiasm
level is set to 'HIGH'
thats a good thing, everyone feeds of the energy, its how balls start to 
roll :-)

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


RE: [PHP] Re: [NEWBIE GUIDE] For the benefit of new members

2005-01-26 Thread Jay Blanchard
[snip]
4. a website/subsite  related DB to store data for phParrot, tips, etc.

phparrot.net is up for grabs - I'm happy to register it (can't grace the
list with
ace mathematical explainations :-) but I'm happy to shell out a few
bucks as a way
of giving back a little) - and I'd just as happily transfer the domain
into the hands
of an 'official' php organisation if and when people think its required
(at no charge).

or maybe someone else want to register it?

also nobody seems to dare speak up regarding a 'front man'?
[/snip]

I'll take the lead. And go ahead and register. Does anyone know, off
hand, if phpwebhosting.com will allow us to set up the server like we
would like it? If so, I'll set up an account and pay for the space...

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



  1   2   3   >