[PHP] users online

2005-05-01 Thread Anasta
Hi, is this possible--
I need a user (already logged in) to click on a button and his username
shown in a text box next to it.
 This is for a chat and they need to be seated similar to poker game where
they sit-in/sit out.

Any help apreciated !

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



[PHP] Starting a big project

2005-05-01 Thread Danny Brow
I'm about to start writing a big web app (mostly in PHP). But I'm not
sure if I should layout the DB first then write the app, or should I
just start writing the app and add stuff to the DB as I need it. How do
you guys go about it?

Thanks,
Dan.

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



Re: [PHP] Starting a big project

2005-05-01 Thread Miles Thompson
By asking What do I need from the app?
or
What questions will the app have to answer?
or
What information does the client want?
and going from there.
Those are all just about the same question. From there you can determine 
needed inputs, tables, keys, etc.

Cheers - Miles
At 01:45 PM 5/1/2005, Danny Brow wrote:
I'm about to start writing a big web app (mostly in PHP). But I'm not
sure if I should layout the DB first then write the app, or should I
just start writing the app and add stuff to the DB as I need it. How do
you guys go about it?
Thanks,
Dan.
--
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] Starting a big project

2005-05-01 Thread Mike
 I'm about to start writing a big web app (mostly in PHP). But 
 I'm not sure if I should layout the DB first then write the 
 app, or should I just start writing the app and add stuff to 
 the DB as I need it. How do you guys go about it?
 
 Thanks,
 Dan.
 

Dan, 

The single-greatest thing you can do if you haven't already is to get some
paper, get a pen and sketch it all out. Plan your DB schema now, map out all
the parts and get a working flow-chart. 

Then, work on building your framework/foundation (your DB would fall under
here). Get all your db's and tables built and throw in some junk/test data. 

After that, start in on your code. I've always found that with a working DB
(even with just test data), my progress is greater since I see results in
real time and won't have to dev, hope it works and then find out when I'm
setting up the DB that there's other problems.

And all throughout this process keep referring to that flow-chart. Keep
revising it and making/taking notes and ensure that it's accurate and
concise.

While it seems like a lot of overhead, the benefits you get from doing this
when working on larger projects is invaluable. You always know how
everything works and rarely need to grep countless lines of code looking for
comments to figure out how something is working.

In short - work from the bottom up and include the DB structure in that.

Good luck  have fun!

-M

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



[PHP] php5-mysqli

2005-05-01 Thread NSK
hi

how can I ensure that php5-mysqli is correctly loaded? the server is SuSE9.3 
and I have installed the package from yast, but one app (phpmyadmin) says it 
cannot find the mysql extension (although other apps can query the db).

which config files are responsible for loading mysqli in apache/php5 ?

-- 
NSK
http://portal.wikinerds.org

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



Re: [PHP] Starting a big project

2005-05-01 Thread Danny Brow
On Sun, 2005-05-01 at 18:53 +0200, Gabriel Birke wrote:
 You could avoid the decision if you use the O/R mapper propel:
 http://propel.phpdb.org/wiki/


I'm using Pear DB (via PG). And then I'm going to port to postgresql.
I've got most of the tools I'm going to use for the project worked out.
Just figuring out what is better, DB layout - Write App, or Write app 
DB at the same time. Mike sent a real good answer, exactly what I was
looking for.

Thanks for you reply, I'm going to read up on propel even though I will
probably not use it for this project.

Thanks,
Dan

 
 On 5/1/05, Danny Brow [EMAIL PROTECTED] wrote:
  I'm about to start writing a big web app (mostly in PHP). But I'm not
  sure if I should layout the DB first then write the app, or should I
  just start writing the app and add stuff to the DB as I need it. How do
  you guys go about it?
  
 

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



[PHP] Re: Starting a big project

2005-05-01 Thread Sandy Keathley
 I'm about to start writing a big web app (mostly in PHP). But I'm not
 sure if I should layout the DB first then write the app, or should I
 just start writing the app and add stuff to the DB as I need it. How do you
 guys go about it?


You can't predict everything, but if you don't try to develop a very 
detailed spec, including the table layouts, you will (IMHO) be sorry.

-- 
Sandy Keathley
Systems Administrator
Lorentz Consulting Group, LLC
Dallas, TX
-- 

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



[PHP] Problem with array

2005-05-01 Thread Murray @ PlanetThoughtful
Hi All,

 

I have 2 function, 1 which calls another, that I am attempting to use in a
page with, currently, some problems.

 

In essence, I have a hierarchical recordset table called tbl_content (contid
and parid, where parid contains the contid of the record to which the
current record belongs). A record without a parid value indicates that the
record is a project level record. I have another table with messages that
have been attached to records in tbl_content, called tbl_content_messages.
Tbl_content_messages contains a contid field indicating the record from
tbl_content to which each message has been attached.

 

I'm trying to create a summary page at the project level (ie all records in
tbl_content that do not have a parid value) displaying the number of
messages in each project (ie, attached to any record in tbl_content that is
part of the hierarchy chain underneath the relevant project record).

 

To do this, for each project I'm trying to determine the list of child
contid values so that I can do a count(*) in tbl_content_messages using the
IN operator, so that only messages attached to records in that project's
hierarchy chain are counted.

 

To generate that child list in the summary page, I'm using:

 

?

$leaflist = listProjectChildren($d-contid); // $d-contid
contains the contid of the project being summarised

?

 

The two functions I'm calling are:

 

?

 

function listProjectChildren($contid, $list=''){

if ($contid''){

$arrtree = array();

$arrtree = buildProjectTree($contid, $level=1);

for ($i=0;$i  count($arrtree);$i++){

$list .= '{$arrtree[$i][2]}',;

 }

}

$list = substr($list, 0,-1);

unset($arrtree);

return $list;

}

 

function buildProjectTree($contid, $level=1){

if ($contid''){

global $arrtree;

$sql = SELECT contid, parid, title FROM tbl_content
WHERE parid='$contid';

$rs = mysql_query($sql);

while ($d= mysql_fetch_object($rs)){

$ind = count($arrtree);

 

$arrtree[$ind][0] = $d-title;

$arrtree[$ind][1] = $level;

$arrtree[$ind][2] = $d-contid;

$arrtree[$ind][3] = $d-parid;

buildProjectTree($d-contid, $level+1);

 

}

mysql_free_result($rs);

}

return $arrtree;

}

?

 

My problem is that when I'm iterating through all of the project level
records, it appears that the content of $arrtree is never reset. New entries
are simply placed on the end, causing the for. loop that builds the
returned $list variable in listProjectChildren() to progressively return
larger and larger lists of contid values. As you can see, I try to UNSET()
the array prior to returning the $list variable, but this doesn't seem to
help.

 

Can anyone help me figure out what I'm doing wrong?

 

Many thanks in advance!

 

Murray

 



[PHP] Re: Starting a big project

2005-05-01 Thread Manuel Lemos
Hello,
on 05/01/2005 01:45 PM Danny Brow said the following:
I'm about to start writing a big web app (mostly in PHP). But I'm not
sure if I should layout the DB first then write the app, or should I
just start writing the app and add stuff to the DB as I need it. How do
you guys go about it?
If you want to implement a big project you should first make some 
analysis and plan it before going ahead to the implementation. For big 
projects, use case partioning is trongly encouraged. If you do not know 
what that is, I strongly encourage reading this book. It succing and 
straight to the point to get you started quickly.

http://www.phpclasses.org/reviews/id/0201309815.html
When you finnaly come to the point of an implementation, I suggest a 
model driven object oriented approch. This means that instead of hand 
coding all the tables and SQL by hand, you should design a model of the 
entities of information of your project and use an object-relational 
mapping tool so in your application you treat every entity as objects: 
clients, products, transactions, etc..

Everything is an object, as opposed to sparse data in database. Then let 
the object relational tool do the tedious job storing and retrieving 
data from a relational database with SQL.

For this purpose, I suggest you use a tool like Metastorage, especially 
because your project is big. It will let you model your business objects 
and generates all access code and database schema in seconds. This will 
be very good for you because it will let you try different models that 
can be changed and regerated quickly until you figure the right model 
for your needs and keep changing it later if necessary.

http://www.meta-language.net/metastorage.html
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php5-mysqli

2005-05-01 Thread Greg Donald
On 5/1/05, NSK [EMAIL PROTECTED] wrote:
 how can I ensure that php5-mysqli is correctly loaded?

if( !in_array( 'mysqli', get_loaded_extensions() ) )
{
if( !dl( 'mysqli.so' ) )
{
echo mysqli.so extension is not loaded;
}
}

 the server is SuSE9.3
 and I have installed the package from yast, but one app (phpmyadmin) says it
 cannot find the mysql extension (although other apps can query the db).

In config.inc.php you might check that you have correctly specified
either mysql or mysqli in the $cfg['Servers'][$i]['extension']
setting.

 which config files are responsible for loading mysqli in apache/php5 ?

The mysqli support in my PHP is built in using --with-mysqli during
the configure.  You can also load the extension in the php.ini or with
the dl() function.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Problem with array

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 10:21 am, Murray @ PlanetThoughtful said:
 ?

 function listProjectChildren($contid, $list=''){

 if ($contid''){

 $arrtree = array();

 $arrtree = buildProjectTree($contid, $level=1);

 for ($i=0;$i  count($arrtree);$i++){

 $list .= '{$arrtree[$i][2]}',;

  }

 }

 $list = substr($list, 0,-1);

 unset($arrtree);

 return $list;

 }

The $arrtree in the function above has *NOTHING* to do with the $arrtree
in the function below.

Not connected at all, really.

 function buildProjectTree($contid, $level=1){

 if ($contid''){

 global $arrtree;

//Start with an empty tree every time this function is called:
$arrtree = array();

 $sql = SELECT contid, parid, title FROM
 tbl_content
 WHERE parid='$contid';

 $rs = mysql_query($sql);

 while ($d= mysql_fetch_object($rs)){

 $ind = count($arrtree);



 $arrtree[$ind][0] = $d-title;

 $arrtree[$ind][1] = $level;

 $arrtree[$ind][2] = $d-contid;

 $arrtree[$ind][3] = $d-parid;

 buildProjectTree($d-contid,
 $level+1);



 }

 mysql_free_result($rs);

 }

 return $arrtree;

 }

 ?

 My problem is that when I'm iterating through all of the project level
 records, it appears that the content of $arrtree is never reset. New
 entries
 are simply placed on the end, causing the for. loop that builds the
 returned $list variable in listProjectChildren() to progressively return
 larger and larger lists of contid values. As you can see, I try to UNSET()
 the array prior to returning the $list variable, but this doesn't seem to
 help.


 Can anyone help me figure out what I'm doing wrong?

There is *NOTHING* in the code given here that makes it right to have
$arrtree be a GLOBAL variable in your function.

That means you are probably doing that wrong too.

Try it with just the line I added, and no global $arrtree; line.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] users online

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 1:35 am, Anasta said:
 Hi, is this possible--
 I need a user (already logged in) to click on a button and his username
 shown in a text box next to it.
  This is for a chat and they need to be seated similar to poker game where
 they sit-in/sit out.

?php echo $name;?

What am I not getting here?...

Maybe you want it to happen on the CLIENT which wouldn't be PHP?...

FORM ACTION=# METHOD=GETINPUT TYPE=SUBMIT VALUE=Who Am I?
onClick=JavaScript:showname('?php echo $name;?'); return true;/FORM

Your showname function in JavaScript will probably have to use the
'innerHtml' value or something like that to alter the text you want to
change.  I forget exactly what it is, but this isn't a JavaScript list
anyway.



-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] automatic PHP Template engine

2005-05-01 Thread Evert | Rooftop Solutions
Hi,
I'm working on a template engine, and I want my template engine to be 
automaticly started when a .stl file is called from the browser.
I know this can be done with mod_rewrite, but I really need a 
platform-independant solution. Has anybody some ideas on how to make it 
work everywhere (preferable also on hosts where you don't have access to 
configuration/shared hosting).

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


RE: [PHP] Problem with array

2005-05-01 Thread Murray @ PlanetThoughtful
Hi Richard,

Color me confused. I removed global $arrtree; and added $arrtree =
array(); to the function buildProjectTree() and now the parent function
(listProjectChildren) returns no values at all.

I've checked the page from which listProjectChildren() is being called, and
$arrtree does not appear as a variable in it at all, so it seems global
$arrtree; was doing SOMETHING, but at this point I have no idea what.

Still trying to work this out, if anyone else has any suggestions?

Much warmth,

Murray

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Monday, 2 May 2005 5:04 AM
 To: Murray @ PlanetThoughtful
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Problem with array
 
 On Sun, May 1, 2005 10:21 am, Murray @ PlanetThoughtful said:
  ?
 
[Here there be snippage: please see original post for outline of problem]

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



Re: [PHP] Splitting Vars from MySQL in PHP

2005-05-01 Thread Richard Lynch
On Sat, April 30, 2005 8:16 pm, Rasmus Lerdorf said:
 php -a
 ?php
   $foo = array('a'='apple', 'b'='banana', 'c'='coconut');
   while (list($k, $v) = each($foo)){
 echo $k: $v\n;
   }
 ?
 Content-type: text/html
 X-Powered-By: PHP/4.3.11

 a: apple
 b: banana
 c: coconut

 It has worked just fine with alpha indices since PHP 3.0rc2, at a
 minimum,
 cuz I've been doing it that long.

 I dunno who was smoking what that day they typed the documentation :-)

 I'm pretty sure it's not an undocumented feature that it works.

 Richard, this is what the docs are talking about:

list($a,$b,$c,$d) = array('a','b','c','d');
echo $a,$b,$c,$d;

 vs.

list($a,$b,$c,$d) = array('a'='a','b'='b','c'='c','d'='d');
echo $a,$b,$c,$d;

 In your case you are calling each() which itself returns a numerically
 indexed array.

I realized how stupid my post was about 30 seconds after sending it.

I plead sleep deprivation :-)

The correct answer, of course, was http://php.net/extract

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Problem with array

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 1:08 pm, Murray @ PlanetThoughtful said:
 Color me confused. I removed global $arrtree; and added $arrtree =
 array(); to the function buildProjectTree() and now the parent function
 (listProjectChildren) returns no values at all.

 I've checked the page from which listProjectChildren() is being called,
 and
 $arrtree does not appear as a variable in it at all, so it seems global
 $arrtree; was doing SOMETHING, but at this point I have no idea what.

 Still trying to work this out, if anyone else has any suggestions?

I'm not real clear on what you are trying to do in the first place, but if
taking out the global messed up, put it back :-)

Maybe add another global $arrtree in the other function so *BOTH*
functions are using the same $arrtree?



-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] automatic PHP Template engine

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 12:54 pm, Evert | Rooftop Solutions said:
 I'm working on a template engine, and I want my template engine to be
 automaticly started when a .stl file is called from the browser.
 I know this can be done with mod_rewrite, but I really need a
 platform-independant solution. Has anybody some ideas on how to make it
 work everywhere (preferable also on hosts where you don't have access to
 configuration/shared hosting).

At one end of the scale, you could write a Module for Apache, *just* like
PHP is.

At the other end, you could give documentation to users about using
httpd.conf and/or .htaccess and Apache's ForceType directive to fire up
PHP.

Somewhere in the middle, I guess you could create an extension of PHP,
just like php_mysql.[so|dll] and that *might* maybe give you the ability
to hack enough things, including the installer/configure scripts that
would do what you want...  Probably not though, now that I think about it.

I think the most realistic approach, honestly, is to just educate
users/hosts how to easily send all your .stl scripts through PHP.  If your
.stl becomes even moderately popular, they'll do that, certainly *long*
before they'll install your STL module to Apache.

If a host won't let the webmaster use .htaccess (or whatever IIS does
that's like that) then they're certainly not going to install/configure
their server to use your .stl until it's wildly popular.  You can't really
get around that.  Focus on making it the best damn Template system and
making it *EASY* for most hosts to configure and QA it.

To give you an analogy:

In the indepdenent music industry, many artists think they want to get a
Distribution deal, where some big-name company will get their music CDs
into all the big-name stores like Tower.

Nothing could be further from the truth, which is:

Demand Drives Distribution

It does one absolutely NO GOOD to have your CDs sitting on the shelf at
Tower, or even Wal-Mart, if nobody ever heard of the band.  The CDs will
just collect dust and get shipped back at (ultimately) artist expense.


In the case of .stl --

While making it easy to install/configure .stl is a laudable goal, you're
simply not in a position to make it something the mass-market
ultra-conservative control-panel-only webhosts will allow to be installed,
no matter *HOW* easy it is.  In fact, you're at the point now where such
hosts will actively work to suppress your .stl engine, as an unproven
un-tested un-trusted technology.

Your effort (for now) needs to focus on the hosts who allow some degree of
configuration/control to their clients.

If a webmaster (or their host) can't (won't) do this in .htaccess
(httpd.conf):

Files ~ *.stl
  ForceType application/x-httpd-php
/Files

then you need to ignore them for now, until you're an 800-pound gorilla
they can't ignore :-)

WARNING:  I may have the Files ... part wrong...
-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Problem with array

2005-05-01 Thread Murray @ PlanetThoughtful
 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Monday, 2 May 2005 6:16 AM
 To: Murray @ PlanetThoughtful
 Cc: php-general@lists.php.net
 Subject: RE: [PHP] Problem with array
 
 On Sun, May 1, 2005 1:08 pm, Murray @ PlanetThoughtful said:
  Color me confused. I removed global $arrtree; and added $arrtree =
  array(); to the function buildProjectTree() and now the parent function
  (listProjectChildren) returns no values at all.
 
  I've checked the page from which listProjectChildren() is being called,
  and
  $arrtree does not appear as a variable in it at all, so it seems global
  $arrtree; was doing SOMETHING, but at this point I have no idea what.
 
  Still trying to work this out, if anyone else has any suggestions?
 
 I'm not real clear on what you are trying to do in the first place, but if
 taking out the global messed up, put it back :-)
 
 Maybe add another global $arrtree in the other function so *BOTH*
 functions are using the same $arrtree?

(Laugh) It's probably because I'm not explaining myself well... Let me try
to outline pseudo recordsets for the 2 tables:

Tbl_content:

Contid, parid
1,
2,1
3,1
4,
5,4
6,1
7,5
8,2
9,7

Tbl_content_messages:

Msgid, contid
1,2
2,2
3,4
4,5
5,5
6,5
7,6
8,6
9,8
10,9
11,9


Okay, so what I'm trying to do is display a summary count of all of the
messages in tbl_content_messages for each project in tbl_content (in this
case the 2 records with contid of 1 and 4, as they have no parid value).

The only way I could think to do this was to create a query that did a
SELECT COUNT(*) from tbl_content_messages using the IN operator with a list
of all of the contid values associated with each project.

For the project associated with contid 1, the entire list of contids in the
project would be 1,2,3,6,8. So, my select query for that project should look
like:

SELECT COUNT(*) FROM tbl_content_messages WHERE contid IN (1,2,3,6,8)

Using the association of contid between tbl_content and
tbl_content_messages, that should return a total count of 5 messages for the
project hierarchy that begins with tbl_content record with contid of 1.

Similarly, the next project in tbl_content, with contid of 4, would be
summarized by:

SELECT COUNT(*) FROM tbl_content_messages WHERE contid IN (4,5,7,9)

Again, from the pseudo recordsets above, that should return a message count
of 6.

So, in the two functions from my original message I'm trying to build the IN
list of contid values for each of the projects.

In the page that calls the functions, I pull a recordset of all records in
tbl_content that have no parid (and thus, by definition, are projects).

Using a while loop, I move through the project recordset and for each record
in it I have $leaflist = listProjectChildren($contid);. In the example
above, for the project contid of 1, I am hoping to return from
listProjectChildren() a variable that contains the value '1,2,3,6,8', so
that this can be used in a SELECT COUNT(*) query using the IN operator to
count all messages that are attached at any level in the project hierarchy
underneath contid 1.

I know this is probably needlessly convoluted, but I inherited this table
structure from another developer and I'm trying to make sense of it in some
way.

Hope that explains a little better what I'm going on about.

Thanks again,

Murray

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



[PHP] empty function and array indices

2005-05-01 Thread Gabriel Birke
Hello!

Suppose I have the following code:

$a = array('a'=1, 'b'=2);
echo empty($a['c'])?'empty':'not empty';
echo $a['c'];

Why doesn't the 2nd line output a warning when error_reporting is set
to E_ALL? Is empty() some kind of special function where the validity
of indices is not checked? If that is the case, I have two questions:

1. Will this behavior persist in future versions of PHP?
2. Are there other functions or a general rule where PHP doesn't
output warnings when a nonexistant index is given?

-- 
Immanuel doesn't pun, he Kant.

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



Re: [PHP] empty function and array indices

2005-05-01 Thread Rasmus Lerdorf
Gabriel Birke wrote:
Hello!
Suppose I have the following code:
$a = array('a'=1, 'b'=2);
echo empty($a['c'])?'empty':'not empty';
echo $a['c'];
Why doesn't the 2nd line output a warning when error_reporting is set
to E_ALL? Is empty() some kind of special function where the validity
of indices is not checked? If that is the case, I have two questions:

1. Will this behavior persist in future versions of PHP?
Sure
2. Are there other functions or a general rule where PHP doesn't
output warnings when a nonexistant index is given?
isset() as well for obvious reasons.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] empty function and array indices

2005-05-01 Thread Mark Cain
From the Manual:

empty() is the opposite of (boolean) var, except that no warning is
generated when the variable is not set

It appears that there is a revamp of what is considered to be empty in PHP
5.

http://php.net/empty

You might be better served with
array_key_exists()

such as:
 echo array_key_exists('c', $a)? 'empty':'not empty';

Mark Cain

- Original Message -
From: Gabriel Birke [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, May 01, 2005 4:47 PM
Subject: [PHP] empty function and array indices


 Hello!

 Suppose I have the following code:

 $a = array('a'=1, 'b'=2);
 echo empty($a['c'])?'empty':'not empty';
 echo $a['c'];

 Why doesn't the 2nd line output a warning when error_reporting is set
 to E_ALL? Is empty() some kind of special function where the validity
 of indices is not checked? If that is the case, I have two questions:

 1. Will this behavior persist in future versions of PHP?
 2. Are there other functions or a general rule where PHP doesn't
 output warnings when a nonexistant index is given?

 --
 Immanuel doesn't pun, he Kant.

 --
 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] php5-mysqli

2005-05-01 Thread Marek Kilimajer
NSK wrote:
hi
how can I ensure that php5-mysqli is correctly loaded? the server is SuSE9.3 
and I have installed the package from yast, but one app (phpmyadmin) says it 
cannot find the mysql extension (although other apps can query the db).

which config files are responsible for loading mysqli in apache/php5 ?
pmp_mysqli !== php_mysql
mysqli works only with mysql = 4.1.3, do you have this installed?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] empty function and array indices

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 1:47 pm, Gabriel Birke said:
 Is empty() some kind of special function where the validity
 of indices is not checked?

Bingo!

That's rather the whole point of empty and isset. :-)

The behaviour of empty has changed over time, with various releases.

isset seems more stable in that regard, so I prefer to use that one.

Also, to me, philosophically and from an application logic perspective, I
generally want to do something different when some variable is not set at
all, as opposed to having  in it.  But that's maybe just me. :-)

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Problem with array

2005-05-01 Thread Richard Lynch
On Sun, May 1, 2005 1:46 pm, Murray @ PlanetThoughtful said:
 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Monday, 2 May 2005 6:16 AM
 To: Murray @ PlanetThoughtful
 Cc: php-general@lists.php.net
 Subject: RE: [PHP] Problem with array

 On Sun, May 1, 2005 1:08 pm, Murray @ PlanetThoughtful said:
  Color me confused. I removed global $arrtree; and added $arrtree =
  array(); to the function buildProjectTree() and now the parent
 function
  (listProjectChildren) returns no values at all.
 
  I've checked the page from which listProjectChildren() is being
 called,
  and
  $arrtree does not appear as a variable in it at all, so it seems
 global
  $arrtree; was doing SOMETHING, but at this point I have no idea what.
 
  Still trying to work this out, if anyone else has any suggestions?

 I'm not real clear on what you are trying to do in the first place, but
 if
 taking out the global messed up, put it back :-)

 Maybe add another global $arrtree in the other function so *BOTH*
 functions are using the same $arrtree?

 (Laugh) It's probably because I'm not explaining myself well... Let me try
 to outline pseudo recordsets for the 2 tables:

 Tbl_content:

 Contid, parid
 1,
 2,1
 3,1
 4,
 5,4
 6,1
 7,5
 8,2
 9,7

 Tbl_content_messages:

 Msgid, contid
 1,2
 2,2
 3,4
 4,5
 5,5
 6,5
 7,6
 8,6
 9,8
 10,9
 11,9


 Okay, so what I'm trying to do is display a summary count of all of the
 messages in tbl_content_messages for each project in tbl_content (in this
 case the 2 records with contid of 1 and 4, as they have no parid value).

Okay, I'm lost.

You're tossing around words like project, but you've got a field contid
and parid, and I read this three times and I don't know which is which.

What's a cont?
What's a par?

I assume Msg is short for message.

Type them out.  Your fingers may hurt today, but your brain will thank you
tomorrow. :-)

 The only way I could think to do this was to create a query that did a
 SELECT COUNT(*) from tbl_content_messages using the IN operator with a
 list
 of all of the contid values associated with each project.

I think you maybe want LEFT OUTER JOIN to keep the projects with 0 messages.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] form array

2005-05-01 Thread Sebastian
i've created file upload scripts in the past that allows multi-upload inputs
using the bracket [] array in form.

so now i have to create the same type of script but each file input field
will also be followed by a text box for a file caption type thing.

what would i used for the input text box?

file: input type=file name=foo[]

now for my text field?
input type=text name=??

something like foo[caption][] ?

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



Re: [PHP] automatic PHP Template engine

2005-05-01 Thread Evert | Rooftop Solutions
Richard Lynch wrote:
On Sun, May 1, 2005 12:54 pm, Evert | Rooftop Solutions said:
 

I'm working on a template engine, and I want my template engine to be
automaticly started when a .stl file is called from the browser.
I know this can be done with mod_rewrite, but I really need a
platform-independant solution. Has anybody some ideas on how to make it
work everywhere (preferable also on hosts where you don't have access to
configuration/shared hosting).
  

At one end of the scale, you could write a Module for Apache, *just* like
PHP is.
At the other end, you could give documentation to users about using
httpd.conf and/or .htaccess and Apache's ForceType directive to fire up
PHP.
Somewhere in the middle, I guess you could create an extension of PHP,
just like php_mysql.[so|dll] and that *might* maybe give you the ability
to hack enough things, including the installer/configure scripts that
would do what you want...  Probably not though, now that I think about 
it.

I think the most realistic approach, honestly, is to just educate
users/hosts how to easily send all your .stl scripts through PHP.  If 
your
.stl becomes even moderately popular, they'll do that, certainly *long*
before they'll install your STL module to Apache.
 

[snip]
I've should have mentioned:
The template format is primairily going to be used by inside developers 
and partners. They want to be able to use it for every client they 
encounter, but are sometimes restricted by the clients (shared-)host.

Thank you for your big explaination, I think I know enough to dive into 
the subject.

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


[PHP] Newbie Help

2005-05-01 Thread Thomas Bonham
Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it 
call a page and I get a error line 42. Error: 
http://bonhamlinux.org/idex.php?page=links/index.php

The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
{include($_GET ['page']..php);}
 else
{echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Newbie Help

2005-05-01 Thread Thomas Bonham
Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it
call a page and I get a error line 42. Error:
http://bonhamlinux.org/idex.php?page=links/index.php
The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
 {include($_GET ['page']..php);}
 else
 {echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie Help

2005-05-01 Thread Andre Dubuc
On Sunday 01 May 2005 10:39 pm, Thomas Bonham wrote:
 Hello All,

 First of I'm new to this a hop I'm doing this right.

 If some one can help me with my web site page. I'm trying to make it
 call a page and I get a error line 42. Error:
 http://bonhamlinux.org/idex.php?page=links/index.php

 The code that I'm trying to do this is the following:
 ?php
   if(isset($_GET ['page']))
   {include($_GET ['page']..php);}
   else
   {echo(Page Not Set.);}
 ?

 My site is: http://bonhamlinux.org
 My email is: [EMAIL PROTECTED]

 Thanks for all the help.
 Thomas


I spot perhaps a typo in http://bonhamlinux.org/idex.php?page=links/index.php

Might that be 'index' instead?

Hth,
Andre
   ^^   

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



Re: [PHP] Newbie Help

2005-05-01 Thread Thomas Bonham
Andre Dubuc wrote:
On Sunday 01 May 2005 10:39 pm, Thomas Bonham wrote:
Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it
call a page and I get a error line 42. Error:
http://bonhamlinux.org/idex.php?page=links/index.php
The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
{include($_GET ['page']..php);}
 else
{echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas

I spot perhaps a typo in 
http://bonhamlinux.org/idex.php?page=links/index.php
Might that be 'index' instead?
Hth,
Andre
   ^^   
Thanks for replying so fast.
That is not a typo because the index.php pages is the following:
?php
header(Location: idex.php?page=main);
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie Help

2005-05-01 Thread Mark Cain
Perhaps the path to the included files is incomplete:

according to your error message you are trying to open
links/index.php.php

Does it need both of the dot php's ??

Would it help to include the full path to the includes such as:
/home/bonhamli/public_html/links/index.php.php

so something like that.

Mark Cain


- Original Message - 
From: Thomas Bonham [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, May 01, 2005 10:39 PM
Subject: [PHP] Newbie Help 


 Hello All,
 
 First of I'm new to this a hop I'm doing this right.
 
 If some one can help me with my web site page. I'm trying to make it 
 call a page and I get a error line 42. Error: 
 http://bonhamlinux.org/idex.php?page=links/index.php
 
 The code that I'm trying to do this is the following:
 ?php
   if(isset($_GET ['page']))
   {include($_GET ['page']..php);}
   else
   {echo(Page Not Set.);}
 ?
 
 My site is: http://bonhamlinux.org
 My email is: [EMAIL PROTECTED]
 
 Thanks for all the help.
 Thomas
 
 -- 
 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] Newbie Help

2005-05-01 Thread Thomas Bonham
I Think the .php.php is the problem but I don't know have to fix it.
Let me know if you won't to see the full src page.
Thomas
Mark Cain wrote:
Perhaps the path to the included files is incomplete:
according to your error message you are trying to open
links/index.php.php
Does it need both of the dot php's ??
Would it help to include the full path to the includes such as:
/home/bonhamli/public_html/links/index.php.php
so something like that.
Mark Cain
- Original Message - 
From: Thomas Bonham [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, May 01, 2005 10:39 PM
Subject: [PHP] Newbie Help 


Hello All,
First of I'm new to this a hop I'm doing this right.
If some one can help me with my web site page. I'm trying to make it 
call a page and I get a error line 42. Error: 
http://bonhamlinux.org/idex.php?page=links/index.php

The code that I'm trying to do this is the following:
?php
 if(isset($_GET ['page']))
 {include($_GET ['page']..php);}
 else
 {echo(Page Not Set.);}
?
My site is: http://bonhamlinux.org
My email is: [EMAIL PROTECTED]
Thanks for all the help.
Thomas
--
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] Newbie Help

2005-05-01 Thread Thomas Bonham
Here is all of the page, except one or two and the
images.

Thomas
--- Mark Cain [EMAIL PROTECTED] wrote:
 YES let see the src
 
 - Original Message - 
 From: Thomas Bonham [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Sunday, May 01, 2005 11:31 PM
 Subject: Re: [PHP] Newbie Help 
 
 
  I Think the .php.php is the problem but I don't
 know have to fix it.
  
  Let me know if you won't to see the full src page.
  
  Thomas
  
  Mark Cain wrote:
   Perhaps the path to the included files is
 incomplete:
   
   according to your error message you are trying
 to open
   links/index.php.php
   
   Does it need both of the dot php's ??
   
   Would it help to include the full path to the
 includes such as:
   /home/bonhamli/public_html/links/index.php.php
   
   so something like that.
   
   Mark Cain
   
   
   - Original Message - 
   From: Thomas Bonham [EMAIL PROTECTED]
   To: php-general@lists.php.net
   Sent: Sunday, May 01, 2005 10:39 PM
   Subject: [PHP] Newbie Help 
   
   
   
  Hello All,
  
  First of I'm new to this a hop I'm doing this
 right.
  
  If some one can help me with my web site page.
 I'm trying to make it 
  call a page and I get a error line 42. Error: 
 

http://bonhamlinux.org/idex.php?page=links/index.php
  
  The code that I'm trying to do this is the
 following:
  ?php
if(isset($_GET ['page']))
{include($_GET ['page']..php);}
else
{echo(Page Not Set.);}
  ?
  
  My site is: http://bonhamlinux.org
  My email is: [EMAIL PROTECTED]
  
  Thanks for all the help.
  Thomas
  
  -- 
  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
  
  
 

Thomas Bonham
Linux Rocks
http://www.bonhamlinux.org
Cell 602 402 9786
E-mail [EMAIL PROTECTED]
YIM freeswimfreak

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Newbie Help

2005-05-01 Thread Mark Cain
first remove the space between GET and [
I think this keeps your script from find the variable page

secondly the variable page already has the php extension being passed to
it via the GET statement
make the include like:

{include($_GET['page']);}

try it and let us know.

Mark Cain

 The code that I'm trying to do this is the following:
 ?php
   if(isset($_GET ['page']))
   {include($_GET ['page']..php);}
   else
   {echo(Page Not Set.);}
 ?
 

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



Re: [PHP] Newbie Help

2005-05-01 Thread Mark Cain
Also, after I looked at more of your code you will need to specify the php
extension in only one of two places.  Currently you are specifying it in 1)
the code below and in 2) nav.php and in nav.php you don't have it specified
for the main but you do for the other links.  That means that the code
supplies the .php extension for main (which it needs to because it is simply
main and not main.php) but the other pages are specified as name.ext
with the .php.  Then when that page name gets to the script, the script is
adding .php onto the variable -- resulting in main.php, links/index.php.php,
email/email.php.php and so forth.

Do it one place or the other -- but do it consistently.

Looks like you're close to getting it to work and I'm close to going to bed.

Mark Cain



 The code that I'm trying to do this is the following:
 ?php
   if(isset($_GET ['page']))
   {include($_GET ['page']..php);}
   else
   {echo(Page Not Set.);}
 ?
 
 My site is: http://bonhamlinux.org
 My email is: [EMAIL PROTECTED]
 
 Thanks for all the help.
 Thomas
 
 --
 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Submit name change

2005-05-01 Thread Anasta
I need this to change the value of the button 'sit in'  to the name of a
user --it doesnt work so anyone got any ideas or is what i am looking to do
impossible.
Either the button name can show the username or a text field can change from
blank to show the username when clicked.


FORM ACTION=?=$PHP_SELF? METHOD=GET
   INPUT TYPE=SUBMIT VALUE=Sit in
 onClick=JavaScript:showname('?php echo $uname;?');
 return true;
/FORM



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