[PHP] tool to organize & design a project?

2002-12-21 Thread Chris Hayes
dear list,

I've noticed that the longer i work on a project, the more i use my 
'organic' way of adding features and filter, and the less i understand what 
my own code is doing. Now I do have some projects of, say, 5000 lines and i 
started very organized with flow diagrams and function descriptions and 
shit, but during the project i still managed to sneak in all sorts of 
unintended mess.

So I am looking for some thing that may help me develop, but will not cost 
me more time than it gives back. For instance i tried some flow diagram 
tools and it is just not worth it - the original scrible i make of it on 
paper is just as helpful.
I was thinking of some sort of function list, where i describe the 
functions in a detailed way, including input and output of course.
It should work with classes and object descriptions too, and lists of globals.

Does any such tool exist?

thanks,
Chris

PS apologies if this question is often asked, i just joined the list again.


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



Re: [PHP] I can't code today to save my life! :(

2003-01-04 Thread Chris Hayes
At 22:21 4-1-2003, you wrote:

completely failed, the results were wrong every time:

if (strpos($REQUEST_URI, "register.php") !== 0) { // you're in login.php }


try

if (!strpos($REQUEST_URI, "register.php") === FALSE)


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




Re: [PHP] Pre-built CMS - Anyone recommend one?

2003-01-12 Thread Chris Hayes


I'm looking for a *free*, pre-built CMS with PHP/MySQL.

I've looked at ezpublish but I'm having trouble installing.

Criteria:

*   Must have SE friendly urls (example.com/4/34/)
*   Must allow different 'sections' for articles
*   Must be easy to fix templates for the html/css


I happen to know a bit of the history of PHPNuke and the several forks it 
has lead to.
The basic idea of PHPNuke and its first generation forks is this:

-
  HEADER OF THE PAGE
-
LEFT|   | RIGHT
| CENTER|
BLOCKS  |   | BLOCKS
|   |
-
  FOOTER OF THE PAGE
-

Somehow limiting the creativity of the designer of a 'theme'.
The left and right blocks can be form the core team or from  third parties 
and their queality varies wildly. They can contain a menu, weather, links 
to center modules, search engines, polls etc. In the center would show the 
current "module" which can also be taken from anywhere, and can be a news 
system, a forum, and many other things.

Xaraya and Envolution attempt to really change this strict setup.

In historical order, not claiming to be exact or complete:

PHPNuke
* has built in news articles in sections by default.
  Optional planning of articles and optional feature to let visitors 
discuss articles (also in most other CMSses here)
* I'm not sure about the search engine friendly urls.
* AFAIK it has a separate directory file for the skins, called 'theme', 
where you can design the various CSS styles and the HTML code for basic 
features such as the side blocks.
But i cannot recommend it because the single project leader is hard to 
reach and tends to ignore security warnings.
www.phpnuke.org (often slow)

MyPHPNuke is a fork of PHPNuke, and seems to limit itself in layout and 
seems to have a limited functionality (no modules, i THINK).
www.myphpnuke.org (or .com)

xOOps
is also a fork of PHPNuke and tries to put it all in classes. I have no 
details, check their site. i think xoops.org

PostNuke
is also a PHPNuke fork, a very strong CMS with very strict rules for the 
modules. They are still working towards the 1.0 version but many people 
already used the 0.64 version on production sites.
Very strong system, uses Adodb to allow the use of different databases 
(MySQL now with people working hard on ?Postgress and ?Oracle), many 
modules were made for it but it is not always claear whether it will work 
in the version of Postnuke you are working on.
* There is a way to create search engine friendly URL's, i think it is a 
setting you can choose, you may need Apache to do it. If in doubt ask on 
one of the support areas
* I find the third party module 'ContentExpress' 
(http://pn.arising.net/ce/) the best way to edit articles.
I made a menu module for it (http://www.hieris.info/about/DynMenu).
* Like PHPNuke Postnuke has 'themes' of which you can download several.
http://www.postnuke.com

Xaraya
after a conflict in which some people kept on harrassing the developers, 
the central developers of Postnuke decided to fork to Xaraya, leaving 
Postnuke with just a handful of developers. I must say that Postnuke now is 
up and running again.
Anyway, Xaraya has some real high quality developers but they ain't 
finished yet and after the hectic at Postnuke they decided not to offer in 
between versions but to work steady on the 1.0 version.
When ready it will really kick ass.
The entire system will use templates, allowing you to build pages with all 
content bits just however you like best. Ready for the future: if you do 
not want to use HTMl but rather XML, it's entirely possible already. It 
will allow SE friendly URLs for sure and a rocking article system.
The one i hope to join.
www.Xaraya.org

Envolution
another fork of Postnuke,  uses a templating system, to the joy of some and 
the horror of many. I did not check it as their template system will never 
allow the flexibility i need.
http://www.envolution.com/




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



Re: [PHP] regular expression

2003-01-14 Thread Chris Hayes
At 10:49 14-1-03, you wrote:

hi,
i wrote a regular expression to match email adresses:
$text =
preg_replace("/([a-z0-9_]|\\-|\\.)+@([^[:space:]<>]*)([[:alnum:]-])/i", "
href=\"mailto:\\1\";>\\1", $text);

unluckily also things like ftp:[EMAIL PROTECTED] were matched.
so i rewrote it to:
$text =
preg_replace("/(?]*)([[:alnum:]-]))/i", 

"mailto:\\1\";>\\1", $text);

but this gives me:
http:[EMAIL PROTECTED] -> http:[EMAIL PROTECTED]
ftp:[EMAIL PROTECTED] -> ftp:[EMAIL PROTECTED]
[EMAIL PROTECTED] -> [EMAIL PROTECTED]


This seems to work:

$text =
preg_replace("/([^\/a-z0-9_])(([a-z0-9_]|\\-|\\.)+@([^[:space:]<>]*)([[:alnum:]-]))/i", 

"\\1mailto:\\2\";>\\2", $text);

I did not check the entire regexp but it seems to do what you need.
Um, the NOT thingy in a regexp is the ^ in stead of the !.

And my line will not tagify any email preceded by a forward slash.

Chris Hayes


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



Re: [PHP] globals off in function

2003-01-14 Thread Chris Hayes


in function i call to $smarty variable
"
function showLoginForm(){

   global $db, $smarty; // $smarty = new Smarty in main code
Fatal error: Call to a member function on a non-object in


Are you sure
$smarty = new Smarty
is in the main code?
Can it be in another function?

Try setting
global $smarty;
just before you create $smarty.

Does that help?


( register_globals = off )
Imho, globals don't working with "globals off", nut i can't find this in
manual.

no, register_globals is only about the automatical production of variables 
from FORM, GET and other data input.
But i fully agree the name is confusing.


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



Re: [PHP] Dumping Tables from MySQL

2003-01-14 Thread Chris Hayes
At 17:50 14-1-03, you wrote:
I am having trouble writing a script to dump the data from tables in MYSQL.
Can anyone provide help on how to use the mysqldump command within PHP
(4.2).

Many thanks

Don

Have a look at my wonderful script :) to use mysqldump to get yourself an 
email attachment of a complete database dump.

It's a very helpful script, if you put it on debug mode it checks all sorts 
of things about mysqldump, like the accessability, it finds the path (on 
unix/linux) and it gives helpful comment.
All support text is inside the file. 
http://www.hieris.info/over/backup/backup.php.txt

Pick out what you need. I would like to get a copy of what you do with it.


In case it turns out you do not have access to mysqldump i have made a hack 
on PHPmyAdmin to make it email the database as an atachment at a mouseclick.

Chris Hayes


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



Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Chris Hayes
At 10:07 15-1-03, you wrote:

I have table with six records in it. I can use "while" to display them all,
but in form. Is there any way I can edit all six records, and update them
all with one submit.


One of the many ways to do it:
When writing the form, number the fieldnames with the ID's of the items. 
Separate name and ID with a clear character like '__'




In the receiving page, split the name again.
Then build a query for every record. I'm not sure whether you can string 
multiple queries, separated by a semicolon (;), have a try.

this is a principle code (not working but it shows the idea) for checking 
every incoming variable

 for [each $key, $value in $_POST]
  {if (! strpos('field',$key)==false)
  { $key=explode('__',$key);
 $ID=$key[1];
   mysql_query(UPDATE mytable SET WHERE ID=$ID)
  }
   }


 


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



Re: [PHP] Question about $_GET

2003-01-15 Thread Chris Hayes
At 11:57 15-1-03, Marek Kilimajer wrote:

"SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET[id]";

- removed single quotes


I think that that is a really bad advice.

Let me explain.

For one, the single quotes are not in the way here because the query is 
written between double quotes.

Then, leaving out the single quotes like Marek suggests will only work 
because PHP is too programmer-friendly.
But the indexes of such arrays should always be quoted, because they are 
strings, and not the name of 'constant' values. If you do not quote them 
PHP will first try to look up whether you defined id somewhere, as a 
constant (with define ('id','value');). Which you did not, so PHP will fail 
to find it. Only then PHP will gently assume that since there is no 
constant defined with the name id, that you meant 'id'. Valuable processing 
time wasted for no reason.
Set error_reporting to ~E_ALL if you do not believe me.

I would support  the $_POST suggestion by Jason.

Suggested reading: the 'PHP Bible'.



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



Re: [PHP] update more "same" fields at the same time

2003-01-15 Thread Chris Hayes
At 14:29 15-1-03, you wrote:

> not with the same data
>
You can put your data and the primary keys in  arrays and exec a loop
but the data[0] must be the data for the id[0],
data[1] must be the data for id[1] etc.

The loop should be something like this:

for (int $i=0; $i<=total_records_select_returned -1; $i++)
update table set field1='$data[$i]' where id=$id[$i];

I 'm not sure for the syntax but the idea is correct.


That would work good and is shorter than what i did (and accidently mailed 
to myself in stead of to this list):

You split the record ID and value in two form elements while I lump the 
fieldname with the recordID into the form element name.


I have table with six records in it. I can use "while" to display them all,
but in form. Is there any way I can edit all six records, and update them
all with one submit.


The way i understand the question is, you have several records (or rows) in 
one table that you want to edit on the same page.

One of the many ways to do it:
When writing the form, number the fieldnames with the ID's of the items. 
Separate name and ID with a clear character like '__'



So to make this do something like

1. make a query to select the items, select the values you want to show as 
well as the record's ID field, from now I will call that $recordID.
Echo a  tag

2. Loop through the query result with your favourite loop structure and in 
the loop echo each record somehow like this:
  echo ' ';


In the receiving page, split the name again.
Then build a query for every record.


With fieldname 'fieldname':

while (list ($key, $val) = each ($_POST))   //walk 
through all form results, key is form_element_name
//and 
value is value.
  {if (! strpos($key,'fieldname')===false)  //only 
with variables starting with the fieldname
  { $keybits=explode('__',$key);$recordID=$keybits[1];  //split 
the recordID out of the name of the variable

   $query="UPDATE mytable SET fieldname='.$value.'   WHERE 
recordID=$recordID";
mysql_query($query) or die('Problem updating data );
  }
   }




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



Re: [PHP] All Request to the same script

2003-01-15 Thread Chris Hayes
At 15:39 15-1-03, you wrote:

Hello

Is it possible to send all incoming requests to the same script within
PHP?
In other words: How can I get http://mysite/script.php to point to the
same script as http://mysite/anotherscript.php ? And is it possible to do
send a request like
http://mysite/someextrapathinfo to the same php script?
The background behind it is to create a controler that handles all
incoming requests and dispatches them to different worker scripts as
nessecary.


I think to achieve that you need to have a certain amount of rights, so you 
may have problems to get modules in Apache or .htaccess (see below) working 
when your ISP does not want to help you.

I've heard that Apache's mod_rewrite module can be very powerful in doing 
things like you propose.
But I had to find another way and i have now put a .htaccess file in the 
main directory of my website with a redirect in it:

   ErrorDocument 404 /redirect/redirect.php

So this means that when people ask for a directory or file that does not 
exist, they do not get the standard 404 error message, but they are send on 
to the file www.mysite.org/redirect/redirect.php. BUT! it is very important 
that you do not write www.yourdomain.org because then you loose the 
information in the URL.

So then you come to the redirect.php file.

In this file you should see the original URL in $_SERVER['SCRIPT_URL']:

   $path=trim($_SERVER['SCRIPT_URL']);

The way i did is was to use such links (Search Engine friendly!)
www.mysite.org/news/1224
www.mysite.org/researcher/SLanger

I would then split the URL at the slashes like this:

$path_bits=explode('/',$path);

And then i forward to the longer urls i normally use:

switch (strtolower($path_bits[1]))
{
case 'news':
Header("Location: 
http://www.sense.nl/modules.php?op=modload&name=News&file=article&mode=nested&order=0&thold=0&sid=".trim($path_bits[2]) 
);
break;

case 'researcher':
Header("Location: 
http://www.sense.nl/redirect/research.php?".trim($path_bits[2]) );
break;


default:
Header("Location: http://www.sense.nl/redirect/404.html";);

}



404.html would send real 404's to a polite message.




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



Re: [PHP] Getting a dynamic IP address

2003-01-16 Thread Chris Hayes
At 00:41 16-1-2003, you wrote:

  Hello all,
Newbie here I need to know if there is a way I can get my dynamic IP 
address for use in a php script?
--

There are loads of variables in the arrays $_SERVER and $_ENV, dump these 
arrays and see if there is something in it that you can use. Maybe you can 
get a hint by running the

phpinfo()
?>
function. It will output loads of info.




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



Re: [PHP] What's the PHP-equivalent of Perl's AUTOLOAD feature?

2003-01-17 Thread Chris Hayes
At 02:06 17-1-2003, you wrote:

I just read an interesting article in The Perl Journal (TPJ) about using
AUTOLOAD as a layer of abstraction for accessing database columns and I
would like to write something similar in PHP.  Is this possible?


If you mean some sort of database abstraction so one script would work on 
MySQL as well as Oracle; there is not such a thing within PHP itself. The 
google search term would 'database abstraction layer' and a popular one is 
ADODB (not to be confused with the other adoDB), at 
http://php.weblogs.com/ADODB.

If that's not what you mean please try to explain it again....

Chris Hayes




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



Re: [PHP] Making alternate rows of different colour

2003-01-17 Thread Chris Hayes
At 09:05 17-1-2003, you wrote:

> I put the output of the database query in a table. It works fine. Now I 
have a need to make the alternate rows of a different color.
>
> Can someone please help me with the code?

   $cols = array('#ff','#00ff00');
   $i = 0;
   while(your_loop_to_output_each_row) {
  echo '$row_data';
   }
um, Rasmus, shouldn't this have a
$i++;
line in the while loop?


some other ways (there are many)

- shortest code, you need to use a 'for' loop or add a counter $i that is 
increased in every loop

for ($i=0; $i<=10; $i++)
{  echo '$i";
}


- using a color toggle

$color_toggle=false;
for ($i=0;$i<10;$i++)
{
echo('http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Alternate row colours - what is wrong with this code?

2003-01-17 Thread Chris Hayes
At 13:11 17-1-2003, you wrote:
> I want alternating colours in the output table. Can someone tell me what 
is wrong with this code? I get the data but no alternating colours.

It has to do with the $cols[$i++%2] part.

When I try to print $i++%2 the outcome varies between 1 and none.  Somehow 
the complete row is not show anymore.

The easiest way is to stop trying this approach and move to the tested 
versions i mailed to this list about an hour ago.


Further i would suggest to keep the form within the  bit and not 
overlap it.


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



Re: [PHP] opening tex file

2003-01-17 Thread Chris Hayes
At 14:05 17-1-2003, you wrote:

On Friday 17 January 2003 20:59, Artur Bereœniewicz wrote:

>   how can I open text file and start reading in the middle of it?

AFAIK it's not possible to jump directly into the middle of a file and start
reading.

You would have to read it line-by-line until you get to the part you're
interested in.

If the file isn't large (say less than several MBs) then just read it all 
into
an array using file() and process it from there.

Well why not try something like this




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




Re: [PHP] A Licensing Question

2003-01-22 Thread Chris Hayes
At 17:17 22-1-03, you wrote:

I was wondering what the licensing issues for app frameworks (or any
included PHP classes/libs) are.  I'm creating a rather large PHP
application for a company, and they'd like to potentially resell it to
some of their customers.

Can I safely use GPL'd libraries, classes, etc. (i.e. PearDB) and
resources that fall under other open source licenses when developing the
app and let them redistribute accordingly, or would that be a violation?
Also, thinking ahead here a bit, if they wanted to use something like Zend
Encoder on the project, what sort of added gotchas could that bring up?

Thanks guys!

John


The GPL can be a headache to figure out when it gets to complicated 
situations.
My uneducated working conclusion is that the GPL prevents you from selling 
GPL-ed code as is, or improved GPL-ed code. Selling GPL-ed code, even if 
you improved it, is dead wrong. Even if you eventually totally rewrote the 
code.

The hazy bit comes when you use a free base and write your own code that 
sits on top of the base. It cannot work without the base but it is a 
package of files you wrote. The Nuke communities are still having the odd 
discussion whether one can charge for a module when the system it fits in 
is GPL-ed.

I think the most polite thing to do is to write the makers of PearDB and 
ask their opinion. The nicest thing to do is to get negotiating, and offer 
them a part of your sales.

There are some pages on this subject to be found on the GPL site.

If all else fails you could sell your hours to get the code working, and 
give the code for free, if needed under a distribution limitation or encoded.



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



Re: [PHP] backslash t

2003-01-22 Thread Chris Hayes
At 20:19 22-1-03, you wrote:

Hi,

I want php to print " \tab"
but when I do,  I only get "ab" as output.
How do I keep the \t?


Jan, between "double quotes", several things are translated
this   becomes
\t  a tab
\r  a carriage return
\n  a newline
\"  "
\\  \
There are more, see the documentation.

So to type  \tab
use
   '   \tab '   (note that these are 'single quotes')
or
   "  \\tab  "





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




Re: [PHP] Minor email problem

2003-01-23 Thread Chris Hayes
At 00:48 24-1-2003, you wrote:

hello friends,

I am hosted with an ISP called Apexon. I have written php scripts to send 
mail from a webpage. When I send this mail, the from address 
becomes  [EMAIL PROTECTED] .  Their website says that the variable 
sendmail_from is [EMAIL PROTECTED]  . I want to force my own from address in 
this. I also want to change the sender's name to my name rather than my 
website name.

I have tried many ways, but not successful. Can someone help me?
Did you try to add the values to the 'extra headers' parameter?

Some ISPs restrict what you can change in mail().

In that case i'm afraid you need to find another SMTP server.
You cannot set the default SMTP server in php.ini because that is obviously 
under control by the ISP. I did not try but i think there must be ways to 
change the SMTP in a .htaccess file. But .htaccess is not allowed by every 
ISP. So maybe you need your own mail function. Such things could be 
available on script libraries.

I think a good start would be to read the user annotations in the online 
PHP manual on www.php.net.

Chris H







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



Re: [PHP] Found a PHP bug!!!!!!!!!

2003-01-27 Thread Chris Hayes

>Re: [PHP] Found a PHP bug!
uh oh...



I don't see why a string wouldn't work when I use "08" (string) and match it
against the integer 8, or 08.


They're just different types. Normally PHP is veeery flexible with 
types,  like javascript, but it just can't be flexible for you here because 
it needs to choose the most logic to the entire pool of programmers, and then
"08" = a string
  8 = a decimal integer
 08 = by definition an impossible octal integer, so 0.

Since you cannot tell PHP that $var is of a certain type like in [other] 
programming languages, for example you want it to be treated as an integer, 
PHP will handle it as what seems to be the most logic.


You can try to use intval (does not alter a variable, only the value as it 
is used in a calculation or an if() statement) or settype (alters the 
variable).



"Kirk Johnson" <[EMAIL PROTECTED]> wrote in message
B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef...
>
> > -Original Message-
> > From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
> >
> > Found a PHP bug, I'm using PHP version 4.2.3.  I have been
> > struggling with
> > why PHP code failed to work with the month is August or
> > September
>
> I stumbled into this one a short while ago myself. It is not a bug, but a
> feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets
> them as octal numbers (because of the leading 0). However, 08 and 09 are
> invalid octal numbers, so PHP converts them to zero.
>
> The fixes are numerous:
>  - remove the leading zero;
>  - add zero to them before passing (addition forces a type conversion to
> int);
>  - force a type conversion to integer using (int);
>  - quote them (when PHP converts a string to an integer, it removes the
> leading zero);
>
> Kirk



--
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] PHP vs Perl for system scripts (non-web)

2003-01-28 Thread Chris Hayes


I'm more comfortable writing stuff in PHP.  I use PHP alot more, and I
find the resultant code more readable and easier to maintain.  Aside
from Perl's ubiquity and the dubious advantage of future flexibility by
using Perl's DBI interface to talk to different SQL servers (I'm using
MySQL at the moment), are there any compelling reasons I should write
system stuff in Perl rather than PHP?


If you have complicated tasks there may be more Perl examples on the 
internet, and that would be a vote for Perl. But then again, i once tried 
to translate Perl to PHP and that was unexpectedly easy. Except for the 
crypt() function which turned out to be different.


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



Re: [PHP] Need Guru's Help

2003-01-28 Thread Chris Hayes



At 07:52 28-1-03, you wrote:

Hi All Guru's here,


Sorry, i am not a guru. I do have visions to become the enigmatic leader of 
a sekte but i think that's slightly out of scope here.

(Actually i have 500 html files containing this table struction,and need 
to read all 500 files and convert them to DB schema or XML format)

I had to do something similar. Unfortunately that code is not very 
readable. Maybe you can find something readable in a script library, look 
for 'html page ripper' or 'ripping an html page'.

What i did was i first cleaned up all HTML files in one sweep with the 
Search and Replace in Multiple Files option of UltraEdit. This to remove 
the head section which would bother me, and to remove newlines and tabs and 
double spaces.

Then i selected the keywords (or key sentences) that came back in all files 
that would announce the coming of a new data element. In your case they are 
easy to distinguish: add the  tag to the search sequence. In my files 
the keywords where luckily very unique.
I made an array of these keywords.
I think i did this: $array['name']['key']='Name';

Then i read in the files one by one, and with each file content i would go 
through the content. I would look for the start of every keyword or 
sentence (strpos) and find the end of it by looking for the next  tag. 
This value i would clean up and then add as value to the array. Maybe 
$array['name']['value']=trim($result);

From this array it was easy to build a query.

Next file.





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



Re: [PHP] parsing ini files

2003-01-28 Thread Chris Hayes


I have a file which contains the following syntax:

; Events listings
[event]
month = january
day = 23
year = 2003
venue = some club
description = this is an event

[event]
month = january
day = 12


interesting function, i had not seen it yet.

You could have a look at the alternative function mentioned by the users 
'seb' and 'Tom' in the online manual 
http://nl.php.net/manual/nl/function.parse-ini-file.php, at least you can 
tweak that so the values get added to arrays.


Or you could see whether this will work:
[event]
month[]=januari

[event]
month[]=februari

I doubt whether it would work, the idea is that in this case $month[0] 
would be januari and $month[1] februari.


>$EVENTS = parse_ini_file('./data/events', TRUE);
>while($key = key($EVENTS))
>{
> $$key = current($EVENTS); //variable variables
> next($EVENTS);
>}

if you ask me, i would do it like this:

while (list ($key, $val) = each ($_POST)) {
{
 $$key = $val;
}



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



Re: [PHP] Getting a value back from POST (not the built-in return)

2003-01-28 Thread Chris Hayes
At 01:38 29-1-03, you wrote:

Using a fairly simple fsockopen and POST I'm sending form data to a script 
which populates fields in a database. Everything works fine, however I've 
been trying to figure out how to send a value set on the other machine 
(database) back through the open socket (note: not the return value 
usually retrieved by fgets($fp etc...) which is then available to the 
sending machine. Searching via
Google hasn't given me an answer.

Is it possible? Can somebody help? Syntax would be very nice, I'm not a 
PHP guru.
i never did use fsockopen, but reading a bit in the online user-annotated 
manual (http://www.php.net/manual/en/function.fsockopen.php) i found this 
link that may help you on the sending side:
http://www.faqts.com/knowledge_base/view.phtml/aid/12039/fid/51

On the receiving side, if we're talking POST, then you HAVE to be aware of 
the change in handling them since PHP 4.10, before this version you could 
just try to read the POST variable directly, e.g. Name went to $Name, or 
better $HTTP_POST_VARS['Name']. But since then it is recommended to read it 
through $_POST['Name']. The old way only works if you set register_globals 
on in the php.ini file, if i remember well.

Unfortunately for you i only have a Dutch link to explain this better.


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



Re: [PHP] A way to break up the string????

2003-01-29 Thread Chris Hayes
At 15:52 29-1-03, you wrote:

Just curious, is there a PHP function that will break up the string for us?

Here's the example

--clip--
//Original
$name = "Jennifer B Cuff";

//Whatever is to be end result of the original
$first_name = "Jennifer";
$middle_name = "B";
$last_name = "Cuff";
--clip--

It is a mind challenging game to seperate the data from the whitespace and
break them up.  I wrote a lengthy script to do it for me but it's not
perfect.  I welcome someone with a fresh mind to do that for me.

the easiest for the programmer is to
* add a space after every dot with str_replace()
* then remove double dots with same
* explode() the string to an array
* first array element is firstname
* last array element is lastname
* if there is something inbetween it's probably all middle names (allow for 
several middle names for catholic dutch people that tend to have names such 
as Wilhemus Antonius Johannes Maria den Braber)
Curse those people with double back names, like 'den Braber' here. Or 
spaced first names.

A little more difficult would be to write a regular expression to split the 
name. I suggest a google search for ' "regular expressions" firstname, 
lastname '. This is bound to be something more ppl ran into.


 My next
nightmare is to break up the address into 1) street number, 2) street name,
3) street tty, 4) city, 5) state, 6) zip while I have to interrupt it the
script to put in the "N/A" in street number, street name and street tty if
there is something like "PO Box 1600" or "Apt #23"...  It is a sucker that
the credit bureau, Experian doesn't keep things any simplier.  I like
Equifax better.


Same idea, more testing.



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




Re: [PHP] chat rooms

2003-01-29 Thread Chris Hayes
At 20:33 29-1-03, you wrote:

Does anyone have any suggestions for a good small FREe chat room to add to a
family site?  A friend here at work is hosting a site from home and is
looking to add a chat room.  Some of his site is php so if it is  php based,
that would be great.  We even talked today about creating our own.

When you write your own, have a look in the book 'Web application 
development with PHP 4.0' by Tobias Ratschiller & Till Gerken. Chapter 3 
analyses the development of projects and takes a IRC chat application as an 
example. New Riders Publishing.





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



Re: [PHP] Use Pop3

2003-01-30 Thread Chris Hayes
At 07:49 30-1-2003, you wrote:

Hello,

Is it possible via PHP to :
- join a pop3 server
- make a "query" to recover mails header, subject, date, sender, to
create a list.
- we I have the list when I click on an element of the list recever the
email content (text and attachment) and why not see the email's header
- Have the possibility to delete a specific message (or more)
- Send email too.

search for the phpclasses site with Manuel Lemos' s class for POP3



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




Re: [PHP] SQLqry in PHP

2003-01-30 Thread Chris Hayes
At 12:14 30-1-2003, you wrote:

I try to use a SQLqry in PHP, but i get this anwser in my browser:

FATAL: emalloc(): Unable to allocate 1073741824 bytes

Somthing i can do to fix it in PHP?
(I have no rights at the server)



could you add some code, this is far too cryptic.
also tell us what php version you have and some database details


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




Re: [PHP] Using custom "button" form element instead of standard"submit"?

2003-01-30 Thread Chris Hayes
At 12:18 30-1-2003, you wrote:

sure this would work but it'd be VERY inefficient in my application.  It's a
file browser application so i have hundreds of folder icons on a page .. the
'submit' element will pass back the name of the button clicked and it would
be available immediately/directly, which is what i want.  BUT an 'image'
element would require me to loop through ALL buttons doing an 'isset' test
on each one.

* if there is not other data in the form you coudl turn it into an image 
link and get the value in the $_GET
* else walk through the $_GET vars (each key/value) untill you see a 
varname that could be what you looked for.

I can't believe html provides no means for using an icon as a submit button.

well it does doesn't it?


by the way .. unrelated question ... why would one want to use
$_REQUEST['foo'] instead of just $foo? doesn't php give you access to form
variables using the latter construct which is much cleaner?

not automatically anymore since PHP 4.10.
and the exact reason was that the old way was NOT clean, see the release 
notes for PHP 4.10 for the details.



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



Re: [PHP] problem with header

2003-01-30 Thread Chris Hayes

can it be related to the double slash in that path?
/usr/local/php/bin//php

At 15:42 30-1-2003, you wrote:

i have an script, it send a header response:






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




Re: [PHP] reading attachmentsl

2003-01-31 Thread Chris Hayes
At 11:11 31-1-2003, you wrote:

hi all

I'm writing a mail client and I got problem with attachments. I have no
idea how to read and save attachments. Mayby someone already did something
like that a can help me with some advice or giving me link to some
resourses.

Maybe it helps to see how an attachment is send, then you can try to 
reverse the process to read in attachments.


assume that $filedata holds the data you want to attach
the encoding can done in many ways, so read the headers carefully

//prepare mail body
   $filedata = chunk_split(base64_encode($filedata));
   $type = "application/octet-stream";
   $encoding = "base64";
mt_srand((double)microtime()*100);
$boundary = '--b'.md5(uniqid(mt_rand())) . getmypid();//so the 
boundary line can be quite diverse
$mailbody = "From: PHP backup script by Arakrys\n"
."MIME-Version: 1.0\n"
."Content-Type: multipart/mixed; "
."boundary=\"$boundary\"\n\n"
."This is a MIME encoded message. \n\n"
."--$boundary\n"
."Content-Type: text/plain";
//if ($this->charset != "") $mailbody .= "; charset=$this->charset";
$mailbody .="\n"
."Content-Transfer-Encoding: 8bit\n\n"
.$message . "\n\n\n--$boundary";
   $data = "Content-Type: $type"."; name = \"$filename\""
."\n" ."Content-Transfer-Encoding: $encoding"
."\n\n$filedata\n";
   $mailbody .= "\n$data\n--$boundary"
."--\n";

//send mail
mail($mailto, $MYSQL_DB.' database backup '.date("d M Y H:i"), ' ', 
$mailbody) or die ('Could not send email!');
}


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



Re: [PHP] Exclusion in Regex not working

2003-01-31 Thread Chris Hayes
At 14:11 31-1-2003, you wrote:


So I'm using ereg(pattern, input) to see if the pattern matches or not.

SO for exclusion I build the following pattern [^$] and pass it to ereg
above.  So if the input includes a $ the ereg should return false and the
processing shouldn't take place.

Well the thing is for $pattern = '[^$]' it doesn't work. Input including
'$' is still passed to the allowed stuff code block.

I remember something like $ had to be double escaped like \\$


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




Re: [PHP] any change to see php source?

2003-02-01 Thread Chris Hayes
At 21:36 1-2-2003, you wrote:

> I am studying on php. And the book say, when the server see php 
extension it
> is running php file and giving results to the visiting browser.
>
> But as I see related directories are normal directory, doesn' t like 
cgi-bin
> directories.
>
> Is there any change to see php file source such as file open function or
> something else? I am not going to somebody else file. Just I want to be 
sure
> how secure the php?

It's all in CVS, read the source:

I think he does not mean the PHP program source, but his scripts' source.

Normally people cannot see the script source, as long as you use .php as 
file extension. In some PHP/server setups people can see the source when 
they type filename.phps, see the installation instruction file in the php 
package for details.



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



Re: [PHP] safe mode problem

2003-02-03 Thread Chris Hayes
At 11:39 3-2-03, you wrote:

what you did should work (you must be root to change owner). You can use 
-R switch to change owner recursively

Gurvinder Singh wrote:

hi
i create a php page dynamically in my php script. this page include one of
my other php file. when i run the newly created script i get this error

Warning: SAFE MODE Restriction in effect. The script whose uid is 48 is not
allowed to access file.php owned by uid 831

Is there a way to handle this.

i even tried chown to change the newly created file's owner to be 831 but it
doesnt seem to work

I think you did it just the wrong way round, the way i read it the owner of 
the file you wanted to read already was 831, so try to chown it to 48.

Safe mode writes files with chmod 750, so now effectively 0 for the php 
script that tries to reach it. In stead of chowning, you can also chmod the 
file to read (file.php) to 777, if you do not mind the security too much, 
if possible take the file out of the www directory.


I have a big problem with safe mode now with a script that needs to create 
subdirectories itself, so with every new added course i would need to go 
and change the chmod by FTP.



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



Re: [PHP] Need to check whether a param exists!

2003-02-03 Thread Chris Hayes
At 17:54 3-2-03, you wrote:

if (is_object($_REQUEST['page']))


for me

if (isset($_REQUEST['page']))

works.
I often add a check against an empty value after this check.


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




Re: [PHP] Help with classes (oop)

2003-02-03 Thread Chris Hayes
Apparently it does not like the function name to be the same as the class 
name. So change one of them.

first(35, "chris");

print $test;

?>




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




Re: [PHP] testing a query for success--code doesnt work

2003-02-04 Thread Chris Hayes
At 21:51 4-2-2003, you wrote:

hi..
posted a message about what the code was to test an update query to see if
it was successfull using mysql and i tested my code and for some reason even
if none of the fields were updated it still reports the success message...

heres the code i have:
$query=mysql_query("update members set company="\$company\", );
if($query){
message if successfull...
}
else{
message if not or if failed..//never gets used
}
anybody know why this doesnt work if 0 records were changed?


* if the update does not have anything to work on it does not mean it is a 
failure! except when you EXPECTED it to update something.

* i'm not sure whether  "if ($query) "  is the proper way to check this.
for trapping development errors i always suggest:
$q="update members set company="\$company\", 
$query=mysql_query($q) or
 die ('DB update failed in '.__FILE__.' line 
'.__LINE__.'Query was:'.$q.'mysql reported:'.mysql_error());

* for counting the affected rows use
http://nl.php.net/manual/nl/function.mysql-affected-rows.php




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



Fwd: Re: [PHP] Function to make a select box

2003-02-04 Thread Chris Hayes


Date: Tue, 04 Feb 2003 22:02:12 +0100
To: "Leonard Burton" <[EMAIL PROTECTED]>
From: Chris Hayes <[EMAIL PROTECTED]>
Subject: Re: [PHP] Function to make a select box


Could anyone offer any suggestions?  The following function prints a blank
select box.

$result= "select auto, '$field' from '$table' order by '$field' order by
name asc";

what are these single quotes doing there? quotes in a query only go around 
STRINGS.
(sorry if i sound patronizing, it is late here)


$result= mysql_query($result);


for debugging code please use
$q="update members set company="\$company\", 
$result=mysql_query($q) or
 die ('DB update failed in '.__FILE__.' line 
'.__LINE__.'Query was:'.$q.'mysql reported:'.mysql_error());
you would have gotten a meaningful mysql error message!


if ($result)

this 'if' will fail with errrors, not with empty result sets



Here is a working example that is not in a function:
$result= mysql_query("select * from ledger_accounts order by name asc");

see, no quotes around the tablename here!




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




Re: [PHP] Is there a way to retrieve an entire source code from a phpfile?

2003-02-05 Thread Chris Hayes


There is a php file that retrieve the source code from the url www.url.com 
and this source is treated and you get content from this file and show it 
on the response page.

Is this possible? Can anyone show me the right direction?
yes, codeword is 'ripping', i found some hits on google with

php ripping html -audio -track -mp3
.


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




Re: [PHP] Creating associative array

2003-02-05 Thread Chris Hayes
At 13:28 5-2-03, you wrote:

Try:
$image_array = array();
$image_array[$file_name] = $image_url;

PHP wrote:


I am trying to create associative array in a while loop..

$image_array = array();  $image_array = 
array_push("$file_name"=>"$image_url");
i agree with the suggestion, but maybe (this may be a stupid newbie 
comment) this will also work, if you insist on using array_push:

$image_array = array_push(array("$file_name"=>"$image_url"));


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



Re: [PHP] getting javascript string values

2003-02-05 Thread Chris Hayes


How can I get the value of an javascript string and pass it to a php variable?


var x = "test";




Well as you know, but just as a reminder, when you make a page with both 
php and javascript in it, the PHP code is executed on the server and then 
the resulting html plus javascript is send to the user, and the browser 
executes the javascript.
So it is easy to fill in PHP-made variables into the javascript,
e.g.

$phpvar=3+8+31;
?>


theanswer =

But to give javascript results to PHP you have to give it back to another PHP page. I can think of three ways: - write a cookie with javascript and have the next page read the cookie with PHP - set a form element's value with javascript (document.formname.elementname.value=(6*7)) then submit the form (document.formname.submit()), In the following php page read $_POST['elementname'] (PHP>=4.10) - build the variable into the URL like window.location.href='http://www.mysite.org/nextpage.php?variable1=' + (50-8) +'&variable2='+theanswer . in the nextpage read $_GET['variable1'] and 2 In all cases make sure that you are very careful with inserting the result in SQL queries or to include files. Imagine that [your favourite enemy] tries to add some sql code or include a selfchosen file from the server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] regex

2003-02-07 Thread Chris Hayes


i have to check if there's a dot in a string, and i need nothing but the
regex pattern for this... tryed a lot, but the dot itself means to matches
all.


you can read a little and not very clear introduction here:
http://nl.php.net/manual/nl/pcre.pattern.modifiers.php
and
http://nl.php.net/manual/nl/pcre.pattern.syntax.php

I cannot find it there eitherr but i am pretty sure the normal escape \ 
counts, so \. in stead of . .




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



Re: [PHP] Alternating Row Colors in PHP........

2003-02-08 Thread Chris Hayes
At 00:25 9-2-2003, you wrote:
Hey all.

I'm coming from Cold Fusion to PHP; in CF I could alternate rows with the
following:



Any ideas how to do this in PHP?

one way would be:



$color_toggle=true;
$color1='red';
$color2='white';


$output="";
for ($i=0;$i<10;$i++)		//or any other way to walk through results
{	$output.= ''.$i.' 
Make love not war';
	$color_toggle=!$color_toggle;
}
$output.="";


echo $output;

-

or shorter:

$color_toggle=false;
echo('');
for ($i=0;$i<10;$i++)
{
   echo(''.$i.' 
Leve de SP');
}
echo('');


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



Re: [PHP] need help with preg_match

2003-02-08 Thread Chris Hayes
At 17:21 8-2-2003, you wrote:

Hi
I have to alter this code:
http://www.whatever.ee/', 'r');

for ($src = ''; !feof ($fp); $src .= fgets ($fp, 1024));

fclose ($fp);

if (preg_match ('/\([^<]*)\<\/font>/i', $src, $matches))
echo'Match: '.$matches[1].'';
else
echo'No match !';
?>

It extracts the data (words) from www.whatever.com between  and
.
It works well if the source looks something like this:
text (it echos "text")
but i am having some serious problems when the source looks like
thistext. It wont do anything if
it is supposed to echo html. but i need html!
Could somebody help me change the script so that it can extract html as
well?
If you can, mail me at [EMAIL PROTECTED] or just reply here
Thank You!



anyway. this did what you asked for.


$src='text.';
$pattern='/\(.*)\<\/font>/i';

if (preg_match ($pattern, $src, $matches))
echo'Match: '.htmlspecialchars($matches[0]).'';
else
echo'No match !';

  ?>

note that i show the output with htmlspecialchars() so you can actually see 
the tag while testing
also note that i replaced your [^<]* with .*





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



Re: [PHP] Problem When Linking Array Element To Itself

2003-02-08 Thread Chris Hayes


I have an array called $array_of_files.
I want to echo each element of that array as a link to itself.
That way when I click on an element I can send it as an actual value
/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/php/categories/links1.txt

Once I place the variable $category inside the  statement it
looks like this:
http://www.myserver.com/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/php/categories/links1.txt

Why is it the  adds 'http://www.myserver.com' to the front of
the value of $category?


It is the browser trying to help by completing what it sees as a relative 
link.

I worked around this by placing '?file=$category' in the echo statement
above.  Just wondered if anyone had any better way to do this...


Looks like an excellent way.

Other ways might include making associated arrays but i see no reason to do 
it differently.

By the way, i don't know what you do with the rest of the code but what 
happens if some joker links to
'?file=etc/passwd' ?




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



Re: [PHP] PHP and Serach Engines...

2003-02-09 Thread Chris Hayes
At 22:00 9-2-2003, you wrote:

Hello,

How do search engines react to PHP pages?  If every page of a
site has a .php extension will search engines not react well to that?
If it does, is there a possible way to handle tracking sessions with
php, without being punished by the search engines?



it's not that they ignore .php pages, more that they do not see a 
difference between
  domain.org/index.php?page=1
  domain.org/index.php?page=123
  domain.org/index.php?page=129909
  domain.org/index.php?module=board&ID=445
so only the 1st page will be indexed.

A common workaround involves the use of Apaches' mod_rewrite,  or an 
error_document trick so the links are:
 domain.org/page/1
and
  domain.org/page/129909

search engines have no problem to see these as different.




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



Re: [PHP] Static functions

2003-02-09 Thread Chris Hayes
At 22:18 9-2-2003, you wrote:

Hi, I'm a bit of a newbie to PHP, I've done some stuff in Java/VB/C++
but I'm having a few problems finding info on this issue.

Does PHP support something like static functions in Java?

afaik the answer is no, but please do not rely on my pitiful opinion. I 
only use my classes with one single object, just to keep the code cleaner.

See one of the articles on objects, in no particular order:

PHP makers on OOP   http://www.php.net/oop
Lotsotalk   http://www.liquidpulse.net/articles/125
knowledgebase   http://www.faqts.com/knowledge_base/view.phtml/aid/7569
ZEND Using objects to create an application 1 
http://www.zend.com/zend/tut/tutorial-johnson.php
ZEND An Introduction to Classes http://www.zend.com/zend/tut/class-intro.php
ZEND Overusing 
OO   http://www.zend.com/zend/art/mistake1.php#Heading13
Devarticles http://www.devarticles.com/art/1/241 
http://www.devarticles.com/art/1/245
http://www.devarticles.com/art/1/262 
http://www.devarticles.com/art/1/285
Devshed Accessing Databases with Class 
http://www.devshed.com/Server_Side/PHP/Class/
Back to Class 
http://www.devshed.com/Server_Side/PHP/BackToClass
PHPBuilder  Classes and PHP 
http://www.phpbuilder.com/columns/rod19990601.php3
Vamsi: Object Oriented Programming in PHP http://php.vamsi.net/article/3/1
OOP Talk : A slide presentation http://www.sdphp.net/talks/talks/sdphp_class



for example in Java I can write:

public class someClass {
public static void someMethod() {}

 PHP has no public or private methods


import someClass;


public class anotherClass {
someClass.someMethod()
}

Is there some way to access methods of a class without creating an
object in PHP?

afaik you do need to create an object.
You can override a function with class y extends (class) x, see the 
articles for examples


Right now I just include the file (not using a class) and then call
the function but I would like to have it more seperate.





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




Re: [PHP] Re: Static functions

2003-02-09 Thread Chris Hayes
At 22:49 9-2-2003, you wrote:

yes, you can call a static method on a class by specifying the class name,
then 2 colons and finally the function name:

classname :: functionname([arg,.])

(of course properties can not be accessed by such methods)

ah ok, cool


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




Re: [PHP] Re: Static functions (java/php)

2003-02-09 Thread Chris Hayes
At 23:09 9-2-2003, you wrote:

you may find the following link interesting
http://www.tek271.com/articles/JavaOrPhp.html

David Eisenhart

I cannot suppress the feeling that someone out there has a slight prejudice 
in favour of Java!




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



Re: [PHP] little problem with ' " and stuff

2003-02-10 Thread Chris Hayes
At 09:27 10-2-2003, you wrote:

hi there,

i'm having a small problem, wondering if anybody can help

// a line in my script defining $url
 $url = $directory . '/main.php?id=' . $id;

// a line later on in the frameset calling this $url
 echo '';

this gives me a paring error on the last line


please get yourself a strong pot of coffee and spend some time reading the 
manual, in this case http://www.php.net/manual/en/language.types.string.php



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



Re: [PHP] Writing text files in Windows 2k

2003-02-10 Thread Chris Hayes


I need to write some data to a text file but when I use

 $this->ao_file_handle = fopen($this->ao_file_name,"ab");
$str_txt.= "\n";
 fwrite($this->ao_file_handle,$str_txt);

It does not display the new line. I saw somwhere that for DOS files you need
to use ASCII LF and CR. Which I did. It still does not display the new line.


LF CR = "\r\n"
What did you view the file with?



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




[PHP] Re: [PHP-GTK] Word Documents

2003-02-10 Thread Chris Hayes


Is it possible to "embed" a Word document with-in a PHP-GTK app (Windows)?
I'm thinking of the way Internet Explorer does it. Then to have a button to
Save the document to the harddrive, or a Print button which would somehow
cause the Word Doc to be printed.

Any thoughts?


some tuppences:
- from within Visual Basic for (microsoft) Applications (VBA), this is done 
with 'OLE Automation'. You can read a bit about it if you have Word, press 
alt_f11 (or: extra/macro/visual basic editor), go to the help and fo a 
search on 'OLE'. I'm quite sure the internet explorer uses this to embed 
word etc. The fact that other browsers do not embed office documents may 
indicate that it is hard to do this from outside a VBA-enabled prog (but it 
may also indicate that they do not want to facilitate MS Office).

- i once made a VBA macro for Excel and it only worked on my pc, on another 
pc i had to make it again with new links to the libraries because the paths 
to the libraries were different. So keep an eye on portability.





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



Re: [PHP] PHP error page not redirecting

2003-02-10 Thread Chris Hayes
At 10:59 10-2-2003, you wrote:

I'm having a dispute with an ISP (surprise) about the non-functioning of
a PHP error script.

Currently, the error script is at
http://www.touristguides.org.uk/error.php - a direct click on that link
will redirect you, using:
header("Location: http://www.touristguides.org.uk/index.php";);
And sure enough, you end up at /index.php

However, when I ask for /nosuchpage I get a blank window, and the
following source is output:
And that's all.


- check the url of 'nosuchpage' (i assume that that is a directory?), try 
to include the filename: /nosuchpage/index.html
- check whether you rely on POST or GET data in '/nosuchpage'
- if this fails, try a .htaccess file with a line
  ErrorDocument 404 /nosuchpage/error.php
   this will save your POST and GET variables (must be a RELATIVE link)


But the script works nicely on another server, suggesting that it might
be something to do with the Apache configuration.

is it approached via exactly the same detour?





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




Re: [PHP] Newbie recursive directory

2003-02-11 Thread Chris Hayes
At 23:28 10-2-2003, you wrote:

G'day all

I've been trying for a day or so to get a script to traverse all the levels
of a directory.


did you see the first user comment on 
http://nl.php.net/manual/nl/ref.dir.php ? may help!

With help from list archives and web sites I've come up
with this:

";
}

?>

I've read lots f stuff about "if (is_dir($blah)" but I get a bit lost with
the navigation after that (I'm _real_ new to *nix as well).  Could someone
please help as to how it would fit into my script?

Cheers and thanks

kim


--
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] Regex Help

2003-02-11 Thread Chris Hayes
At 07:47 11-2-2003, you wrote:

I am new to regex and broke my head on it the other day...in vain...

Can any one tell me a place to get a step by step tutorial on it or help me
out on how to work it out ?


Some tutorials:
http://codewalkers.com/tutorials/30/3/  Codewalkers - Using PCRE
http://samuelfullman.com/team/php/working/regex.php PCRE - Samuel Fullman
 http://www.yapf.net/faq.php?cmd=viewitem&itemid=113  How can i 
replace text between two tags
http://www.yapf.net/faq.php?cmd=viewitem&itemid=152 Counting words
http://www.phpbuilder.com/columns/dario19990616.php3  Learning to use 
Regular Expressions by example
 http://www.phpbuilder.com/columns/dario19990616.php3?page=3 email addresses



I am trying to make a link collector.

after opening the desired page, I want to get all the hyperlinks on it...




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




RE: [PHP] Echo # problem

2003-02-12 Thread Chris Hayes
At 13:46 12-2-03, you wrote:

The code I am trying to get working is shown below however, as the # is
interpreted as a comment the header function is only redirecting to

./itemadmin.php3?submittedby=$submittedby&cat=$cat

$head = "./itemadmin.php3?submittedby=$submittedby&cat=$cat#$edit";
header ("Location:$head");


I think  the problem may be that the #zzz should be before the ?x=1&y=2
If i am right it means that # was not considered a comment by PHP but that 
the browser cannot find it.Does the url in the browser show with the #edit 
part?

In that case try

$head = "./itemadmin.php3#$edit?submittedby=$submittedby&cat=$cat";

or maybe

$head = './itemadmin.php3#'.$edit.'?submittedby='.$submittedby.'&cat='.$cat;

PS   ./ ?


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



Re: [PHP] need help with a table please - sorry

2003-02-12 Thread Chris Hayes
At 15:43 12-2-03, you wrote:

Hello friends.

Sorry I sent the wrong code in my last mail. Here is my correct code.

I want the output of my query to be formatted such that after every 7th 
output, the 8th one should start on a new row in the table. I have written 
the following code but does not work. Can someone please help?

Quote :

If you imagine to walk through your code, with every step $i increases. If 
you start the second row,
Besides, your second  print '' for every cell, which will break your 
table, and possibly other tables on your page.




 

  
   $i=0;
 while($row=mysql_fetch_array($result)){
 $i=$i+1;
 if ($i==7){
 Print "";
 Print"";
  Print "
 color=\"#40\" size=\"2\">$row[CategoryName]"."   ";
 Print "";
 }else{
 Print "";
 Print"";
  Print "
 color=\"#40\" size=\"2\">$row[CategoryName]"."   ";
 Print "";
 if ($i==6){
 Print "";
 }}
 }
 ?>
   

  


Trying to keep as much from your code as possible: (not tested)



 


   $i=1;
while($row=mysql_fetch_array($result))
{
$i=$i+1;
if ($i>7){ Print ''; $i=1}

Print ''
''
   .''
.$row[CategoryName]
   .''
.''
  .'';
}

   //     // what was this for?

//extra code to finish the row if total # of results is not dividible by 7
for (;$i<=7;$i++){echo ' ';}

 ?>


  



Note that i replaces double quotes with single quotes when possible.




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



Re: [PHP] need help with a table please - sorry

2003-02-12 Thread Chris Hayes

woops i did not finish that line:


If you imagine to walk through your code, with every step $i increases. If 
you start the second row,

then the counter is at 8 and will never be 7 again.


And some bad english:

Besides, your second  print '' for every cell, which will break your 
table, and possibly other tables on your page.
i mean to say that the second clause prints  for every cell.

by the way, my proposal has less tests than the other solution you got, so 
i guess it is an itsy bit faster :)



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



Re: [PHP] Exotic Assign operators what do they do.

2003-02-13 Thread Chris Hayes
At 20:38 13-2-2003, you wrote:

The PHP manual neglects to tell us what these assignment operators are,
can somebody point me to what they mean?

http://nl.php.net/manual/en/language.operators.bitwise.php
please also chek the user annotations for examples



 &=
 |=
 ^=
 ~=
 <<=
 >>=

just curious that's all

--
Jeff Bearer, RHCE
Webmaster, PittsburghLIVE.com


--
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] emptying jammed mailbox by PHP?

2003-02-17 Thread Chris Hayes
hi,
maybe not the most professional way but my mailbox is jammed and i want to 
clear it. My ISP host is doing some office refurnishing and needs all his 
attention to pick the right color hues.
So i thought maybe i can send a simple POP command to delete all mails in 
the mailbox? It's 14000 mails since last thursday!
Maybe using mr Lemos' POP script class?

My email client eudora complains it cannot get a 'lock'- mailbox in use. 
This can be the mail subsystem thingy keeping sending itself a warning 
email. Ideas?

BTW PHP on the server is running in safe mode,
Chris
 


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



Re: [PHP] Cannot add header information

2003-02-19 Thread Chris Hayes
At 15:33 19/02/03, you wrote:

I have a script which adds header information to a different page, on my 
server I get a Cannot add header information - headers already sent by. 
But on other servers it works fine, does any1 know why??

Are you sure you did not edit a file?

Take care that there is not __any__ output before the header() command. The 
error message you got gives you an indication where the output starts. Have 
a close look at that line.

Remove all spaces and enters in the PHP files before .

An error message before this error message is also output, for which PHP 
creates headers.



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



Re: [PHP] what's the matter?

2003-02-22 Thread Chris Hayes
At 14:36 22-2-2003, you wrote:
index.php:
choice your gender
  male
 female
 

x.php:

but at last it said that the gender had not been defined???




help me!
"by your command."
( a 'please' would be nice, X!)
Since PHP 4.1 form data are not automatically available as variables in the 
followup file.

http://nl.php.net/release_4_1_0.php explains it all, for now it's enough to say
- either turn register_globals on in php.ini (google knows how)
 - or read $_POST['gender'], e.g.
$gender=$_POST['gender'];




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


Re: [PHP] sending results by email

2003-02-22 Thread Chris Hayes
my friend Google told me this is explained at 
http://www.thickbook.com/extra/php_email.phtml !


how can i make the server email me
the results of this form __

  
  

  

  no 
  

Don't forget to close the form.



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


Re: [PHP] University researcher's question

2003-02-23 Thread Chris Hayes
At 09:21 23-2-2003, you wrote:
[i] How or why do researchers adapt technology to their research projects? 
Should they adapt their projects to technology? Indeed, how often does the 
research assistant end up reinventing the wheel? [/i]
'Research' is an extremely broad field, with many places where technology 
can jump in: observation, data collection, data entry, making mathematical 
models, making statistics, making graphs or GIS pictures Walk through 
the average university corridor and most ppl will use something existing, 
like office, SPSS, MatLab... But you will also find ppl writing their own 
models, not in PHP but rather in other languages. I think your would need 
to make some very specific questions and ask at your local university 
whether they can help you.


I know most of you are E-Commerce oriented, but I would appreciate your 
feedback. I use PHP & MySQL in a university research setting. I'm writing 
a conference paper on this problematic and I would appreciate your input.

Am I the only university type online tonight :) ?
On courses you can have a look at the Moodle site: developer of the PHP 
course support sytem Moodle.org has written papers on this distant learning 
(and is writing his dissertation now). But 99% of universities and 
highschools buy Blackboard 'because everybody else does'.

I am only using PHP/MySQL to let researchers put their work online, and 
will use it to let PhD's administrate their own progress, which will be a 
big relief for the administration people. So it is university related but 
not really research related.



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


Re: [PHP] why this ?????????

2003-02-23 Thread Chris Hayes
hi Luis,
I would like to ask you to _please_ (<--see i used the magic word so you 
have to do it! :) ) make your mails fitting to the generally accepted formats:
1) Keep the mail title the same if the question is the same. Use the reply 
button of your program, in such a way that in in replies we can see 'Re: 
existing title ' , so we can all follow what belongs together and what 
suggestions already have been made,
2) do not repeat the same question within one day, or even within two 
hours, like on 22/2/03,
3) Save us and yourself time: read the answers given! I gave you a link 
that explains your question very clearly and also explains why your piece 
of code does not work anymore. But obviously you did not read it. So here 
it is again:  http://www.thickbook.com/extra/php_email.phtml. (Google gave 
me after a 1 search - maybe Google wants to be your friend too!)
4) Make your titles more explicit than 'why this ??'

thanks,

Chris



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


Re: [PHP] update query not working

2003-02-23 Thread Chris Hayes


print "";
print "";



if ($_POST['Update'])
{
print "updated!!";
}
I do not see the statement "updated!!!" printed, but I cannot see anything
wrong with my syntax. Any help would be appreciated.
You are looking for a value, where the array is of the form
 $_POST['form_element_NAME'='form_element_VALUE'
So try looking for

if ($_POST['Submit']=='Update')
{
}


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


Re: [PHP] [!NEWBIE ALERT!] fread() question

2003-02-23 Thread Chris Hayes
At 00:05 24-2-2003, you wrote:
trying to parse a URL and write html code to a file, then search the file
for a string between  ...   how would I implement the fread
function below, and regular expressions to read the specific conent.  thx
or is there a php function that can return the TITLE of a URL?

i would read in the entire file, and use a 'regular expression' such as
ereg()  http://nl.php.net/manual/nl/function.ereg.php explained on
http://www.phpbuilder.com/columns/dario19990616.php3
or preg_match http://nl.php.net/manual/nl/function.preg-match.php

I think this may work, with the $string from your code:
$pattern="/(.*)<\/title>/i";
preg_match($pattern, $string, $matches);
$title=$matches[1];
echo $title;


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


Re: [PHP] What is wrong with this?

2003-02-24 Thread Chris Hayes
At 02:04 24/02/03, you wrote:
Hi,

yes in fact it worked...I also had the $numrows with wrong mysql command, it
should be mysql_num_rows() instead of the mysql_fetch_rows().
Thx Ernest
But now that this is working, i have another big problem...my
$drop_down_list isn't assuming the value of the shown option...right here on
the below part

for ($i = 0; $i < $num; $i++) {
$aviao = mysql_result($resultaviao, $i, "aviao");
$sk = mysql_result($resultaviao, $i, "sk");
$drop_down_list .= "$aviao";
}
**
So he isn't getting the data from DB. He displays all records on DB
available at aviao field, but he is not making the correct mysql query...
For debugging:
- please show us the query if you believe it is wrong (echo $query;).
- if you think something goes wrong at the mysql side, also do echo 
mysql_error(); after the mysql_query line, to get the mysql error.
- echo $num .
Also have a look at the html source to see whether it has the right options 
but another error than you expected.


$drop_down_list .= "$aviao";
Put some quotes around the tag value for just in case the $aviao has a 
space in it:
$drop_down_list .= "$aviao";

FInally, why do you extract $sk when you do not use it?


Anyone knows why?

- Original Message -
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
To: "Miguel Brás" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 9:45 AM
Subject: Re: [PHP] What is wrong with this?
At 10:37 24.02.2003, Miguel Brás said:
[snip]
>//logical request
>if ($nome) {
>$sql="aviao = '$nome' ";
>}
>if ($code) {
>$sql="code = '$code' ";
>}
>$query = "SELECT * FROM ssr WHERE";
>$query .= $sql;
[snip]
Hi,

I've copied only the relevant lines of your program.

The issue here is that your string concatenation results in
SELECT * FROM ssr WHEREaviao = 'Airbus'
Note the missing space after "WHERE". Your code should better read
   $query = "SELECT * FROM ssr WHERE ";
   $query .= $sql;
Have an eye on the added blank after WHERE.
HTH,

--
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/


--
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] Me again...

2003-02-24 Thread Chris Hayes
At 03:48 24/02/03, you wrote:
Hi, please see the following red code...
(i get plain text, so not red)

it adds info to a MySQL Table called "Schools". Whats the problem? 
Although the first time you execute it, it works, after the first time you 
send the form you get ERROR.

$qs = 'INSERT INTO Schools (LongName, Abbreviation) VALUES (' .
  "'" . addslashes(trim($longname)) . "'," .
  "'" . addslashes(trim($abbrev)) . "')";
if(!mysql_query($qs, $db))
  echo 'Error';
---
KEY Approved (Approved),
KEY ShortName (ShortName),
UNIQUE ShortName_2 (ShortName)
It seems that the problem resides in ShortName but I still don´t 
understand what to do...
i guess that ShortName_2 is the problem, since it needs to be unique and 
the first time you enter the form it enters a data set or row with 
Shortname_2 empty, and the second time you try it is still empty.

When developing a script, try
 echo 'Error: '.mysql_error().'';
to see mysql's reactions.
or
$result=mysql_query($qs,$db)
 or die ('Error in '.__FILE__.' line 
'.__LINE__.'Query was:'.$qs.'Mysql error:'.mysql_error()):

PS please choose a better title than 'Me again...'

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


Re: [PHP] dynamic list box

2003-02-24 Thread Chris Hayes
At 15:01 24/02/03, you wrote:
Hello,

I have an sql statement that pulls data into a dynamic list box, the problem
is, I have this list box twice on my form, since the query returns a lot of
rows, I do not want to have the query executed twice but I populate my list
box using the while loop so when it is time for the second list box, the
query is already at end of file.  I tried to get my result then just copy
that to another array but that doesn't seem to work, any one have any ideas?
i think your problem is that after you did an array operation often the 
array pointer moves along, and at the end of a walkthrough over the array, 
the arraypointer is at the end.

reset($array) between the two operations should work, this does not empty 
the array but only sets the pointer to the first element. I would recommend 
to use it every time before you walk through an array.

http://www.php.net/manual/en/function.reset.php



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


Re: [PHP] emailing a web-page

2003-02-24 Thread Chris Hayes
At 15:31 24/02/03, you wrote:
I want to automate the process of connecting to a web-page and sending it as
a HTML email (like a weekly newsletter in html).
I've been reading up a bit on PEAR's Mail_mime
(http://pear.php.net/manual/en/core.mail.mime.php) but I just wanted to know
what the fastest way to accomplish my requirement is from your collective
experience?
is it a webpage you create with php or is it a webpage that you get from 
just any site?

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


Re: [PHP] Re: Maximum execution time explanation needed

2003-02-24 Thread Chris Hayes
At 01:27 25-2-03, you wrote:
Thank you, but it doesn'T explain why i can run the other script for 5
minutes without any set_time_limit
In php.ini the default time limit is set.

And when you set the time limit in a script at the start of a loop, the 
limit counter starts counting at zero again, or in any cae if you set it to 
180, the script gets another 180 secs to run

i'd like to get a precise explanation on why it's doing it, for the time
being i will use set_time_limit for this script.


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


Re: [PHP] How to get tree structure into an array?

2003-02-25 Thread Chris Hayes
At 11:16 25-2-03, you wrote:
Hi all!

i have to solve one problem, but i have no idea how to make this. I have
got a tree strucutre in mysql table, id - parent - name. I need make
function, which return array which will contains a strucutre of this
tree-menu, table example:
ID Parent Name
-- -- --
1  0  Components
4  1  Main boards
5  1  HD
7  5  IDE
8  5  SCSI
and result:

$array = Array(
"id" => "1",
"name" => "Components",
"sub" => array(
"id" => "4",
"name" => "Mainboards",
"sub" => no_array  (no sub pages)),
array(
"id" => "5",
"name" => "HD",
"sub" => Array(
 "id" => "7",
 "name" => "IDE",
 "sub" => no_array  (no sub pages)),
 Array(
 "id" => "8",
 "name" => "SCSI",
 "sub" => no_array (no sub pages))
)
);

an so on, source table has got about 300 items, so i need function which
make an array for next work with this tree structure.
thanks a lot for some help!

jiri.nemec at menea.cz
http://www.menea.cz
ICQ: 114651500
hi jiri,
i found this an interesting question, so i tried to think up some rough 
function to do it.
But while writing that, i wondered why you wanted to make the array with 
the structure you propose. Are you sure this is the easiest way to do it?

The problem with your proposal is in my eyes that for instance the SCSI 
name will be in $array['sub']['sub']['sub']['name'];

So i stopped trying to finish this function because my problem is i cannot 
think of an elegant way to indicate where the subarray should be glued to.

The rough idea of this could be an iterative function that does a query 
every time:

function buildtree($parentID=0, $arrayposition)
{ global $Tree;
$result=query("SELECT ID, Parent,Name FROM sourcetable WHERE 
Parent=$parentID") or die('error:'.mysql_error());

walkthrough $result  //use your favourite loop to go through the result set
{
$branch=array($ID,$Name, 'sub'=> (buildtree( $ID, 
$arrayposition )) );
}

return $branch;
}


It may be quicker to just load in the entire table in a simpe array in the 
same format as the table,  and then use it in a smart way.

So q: could you elaborate on the why of the array structure you proposed?



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


Re: [PHP] How to get tree structure into an array?

2003-02-25 Thread Chris Hayes
the longer i stare at it the more i think it may do the job. i'm not sure. 
expecially about the 'sub'=>buildtree($ID) part.

function buildtree($parentID=0)
{
$result=query("SELECT ID, Parent,Name FROM sourcetable WHERE 
Parent=$parentID") or die('error:'.mysql_error());

walkthrough $result  //use your favourite loop to go through the result 
set, make fields available as e.g. $ID and $Name
{   if ($ID==0) {echo 'loop danger, 
exiting';exit();}
   $branch[]=array($ID,$Name, 'sub'=> (buildtree( $ID)) );
}
 return $branch;
}

It should iteratively call itself, adding the branches, untill it exhausted 
all branches, then finally return the entire array.
You might like to check Google for iterative functions in PHP with arrays.

At 12:09 25-2-03, Chris Hayes wrote:
At 11:16 25-2-03, you wrote:
Hi all!

i have to solve one problem, but i have no idea how to make this. I have
got a tree strucutre in mysql table, id - parent - name. I need make
function, which return array which will contains a strucutre of this
tree-menu, table example:
ID Parent Name
-- -- --
1  0  Components
4  1  Main boards
5  1  HD
7  5  IDE
8  5  SCSI
and result:

$array = Array(
"id" => "1",
"name" => "Components",
"sub" => array(
"id" => "4",
"name" => "Mainboards",
"sub" => no_array  (no sub pages)),
array(
"id" => "5",
"name" => "HD",
"sub" => Array(
 "id" => "7",
 "name" => "IDE",
 "sub" => no_array  (no sub pages)),
 Array(
 "id" => "8",
 "name" => "SCSI",
 "sub" => no_array (no sub pages))
)
);

an so on, source table has got about 300 items, so i need function which
make an array for next work with this tree structure.
thanks a lot for some help!

jiri.nemec at menea.cz
http://www.menea.cz
ICQ: 114651500
hi jiri,
i found this an interesting question, so i tried to think up some rough 
function to do it.
But while writing that, i wondered why you wanted to make the array with 
the structure you propose. Are you sure this is the easiest way to do it?

The problem with your proposal is in my eyes that for instance the SCSI 
name will be in $array['sub']['sub']['sub']['name'];

So i stopped trying to finish this function because my problem is i cannot 
think of an elegant way to indicate where the subarray should be glued to.

The rough idea of this could be an iterative function that does a query 
every time:







It may be quicker to just load in the entire table in a simpe array in the 
same format as the table,  and then use it in a smart way.

So q: could you elaborate on the why of the array structure you proposed?



--
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] FormatDateTime in PHP

2003-02-25 Thread Chris Hayes
At 13:25 25-2-03, you wrote:
Please,

How do I make to format my date in the my format? For Example:
you forgot to tell how the date in the database is formatted, that is quite 
important.

did you read the php manual on date() ?
http://www.php.net/manual/en/function.date.php

## I filter
$filter = " SELECT DTVECTO FROM CLIENTS";
$result = mysql_query($filter);
$rows   = mysql_num_rows($result);
while($rows = mysql_fetch_array($result)) {
   ## I get date to the data base
   $my_date = $rows["DTVECTO"];
   ## I print
   print($my_date);
}
I want to show my date in format: 01/12/2003 (dd/mm/).
For Example
DateValue
01/09/2003 $ 50.00
01/10/2003 $ 60.00
01/11/2003 $ 70.00


thanks


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


Re: [PHP] My server cannot displayed a php extension file.

2003-02-25 Thread Chris Hayes
At 16:54 25-2-03, you wrote:
I am new to PHP.I have manually installed it to my Windows 2000 server 
that runs on IIS 5.0 .
But also it included a .php file if i write correct url  it could not 
displayed the file on ÝE5.5.
What is the problem?
* does the server work with html files?
* which installation instructions did you follow?
* what url did you use (please show the complete url) and what did you see?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] server problem?

2003-02-25 Thread Chris Hayes
i made some adjustments to the internet settings via internet explorer on 
win98, and now when i try to access a file on the localhost (apache) i get 
with every browser a file download dialog.

ie's dialog says
when i try http://137.224.157.67 (used to work)
filename 137.224.157[1]
filetype 157[1] type
from: 137.224.157.67
when i try http://localhost (used to work)
filename localhost
filetype
from: localhost


and opera said it was of the  text/x-server-something type

What on earth did i do wrong?





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


RE: [PHP] page shown, but browser keeps doing something

2003-02-25 Thread Chris Hayes
At 17:01 25-2-03, you wrote:
are you preloading graphics using JavaScript?
well, i turned javascript off so that can't be it. 

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


Re: [PHP] server problem?

2003-02-25 Thread Chris Hayes
At 17:06 25-2-03, you wrote:
i made some adjustments to the internet settings via internet explorer on 
win98, and now when i try to access a file on the localhost (apache) i get 
with every browser a file download dialog.

ie's dialog says
when i try http://137.224.157.67 (used to work)
filename 137.224.157[1]
filetype 157[1] type
from: 137.224.157.67
when i try http://localhost (used to work)
filename localhost
filetype
from: localhost
additionaly
when i try http://localhost/index.html, this file is copied to 
C:\WINDOWS\Temporary Internet Files\Content.IE5\SDYFWTA7\index[1].html and 
shown from there in a new browser window






and opera said it was of the  text/x-server-something type

What on earth did i do wrong?





--
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] Trouble Passing Variables On Test Server

2003-02-25 Thread Chris Hayes
At 17:49 25-2-03, you wrote:
Hi guys, I have installed a test sever from those guys are FirePages.com.au
on my Windows XP Machine at home to test websites on http://localhost.
The only problem is the forms are not passing on the variables. I have used
the same scripts on a webserver and they work fine. Could anyone tell me
what I should check so that these variables are passed thru? Has anybody
come across this problem before?
The most likely reason is that PHP has more secure way of making form 
variables available since  PHP 4.10. To use the old way i think you had to 
edit php.ini and set register_globals=On.

Check this by having a page after a form with element name 'test' with this 
line
echo $_POST['test'];
because that is the new way.

Explained on http://www.php.net/release_4_1_0.php

[gee, the net is slow now, can all these Americans please go back to bed :) ]

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


Fwd: Re: [PHP] help please

2003-02-25 Thread Chris Hayes


There is no need to post this thrice.
Anyway. What went wrong? Did you get an error message? Are both sites on 
the same machine?

At 18:40 25-2-03, you wrote:
Hello all,

I am having problems with a script.  The script works great on one of my
sights, however, when I transferred it to another site, it does not
function.  I contacted my hosting company (both sites are on the same
server), they told me that I needed to check the script and that it has
nothing to do with them, since they ran a  test.php and it worked fine.
   Here is the script:


$ToEmail = "[EMAIL PROTECTED]";

$ToSubject = "Flash Contact Form";

$EmailBody = "Sent By: $FirstName\nSenders Email: $Email\n\nMessage
Sent:\n$ToComments\n";
mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, "From: ".$FirstName."
<".$Email.">");
?>

Please if anyone knows anything about this stuff (Im a newbie to this) You
help is greatly appreciated!
Thanks in advance,
mark johnson




--
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] help please

2003-02-25 Thread Chris Hayes


Mark,
you've GOT to give us something to work on. We're not ESP, well, at least I 
am not.

Try debugging a bit. Echo all values just before you do the mail(), see 
whether they really are what you thought they were.

Try a simple script that will only send a mail, take the example from the 
manual (www.php.net/mail)

Try setting the error warning level high for a while, by adding this to the 
file:

   error_reporting (E_ALL);



PS please keep the discussion in the list
At 19:15 25-2-03, you wrote:
Chris,

  Im so sorry about the posting three times, I didnt know how to do it, then
I subscribed after I sent it twice.
  I cant figure out what is wrong with the script.  I do not get an error
message.  Basically, I am suppsed to get an email with the info that the
user entered.  I get the email from http://www.bionicegg.com/html/Mail.html
, but It doesnt work for http://www.nypalet.com/Mail.html .
I do not know jack about PDP, I got the script from www.flashkit.com.

Thanks so much for the response.

Mark J
- Original Message -----
From: "Chris Hayes" <[EMAIL PROTECTED]>
To: "bionicegg" <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 1:07 PM
Subject: Re: [PHP] help please
> There is no need to post this thrice.
> Anyway. What went wrong? Did you get an error message? Are both sites on
> the same machine?
>
>
> At 18:40 25-2-03, you wrote:
> >Hello all,
> >
> >
> > I am having problems with a script.  The script works great on one
of my
> >sights, however, when I transferred it to another site, it does not
> >function.  I contacted my hosting company (both sites are on the same
> >server), they told me that I needed to check the script and that it has
> >nothing to do with them, since they ran a  test.php and it worked fine.
> >Here is the script:
> >
> > >
> >$ToEmail = "[EMAIL PROTECTED]";
> >
> >$ToSubject = "Flash Contact Form";
> >
> >$EmailBody = "Sent By: $FirstName\nSenders Email: $Email\n\nMessage
> >Sent:\n$ToComments\n";
> >
> >mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, "From:
".$FirstName."
> ><".$Email.">");
> >
> >?>
> >
> >Please if anyone knows anything about this stuff (Im a newbie to this)
You
> >help is greatly appreciated!
> >
> >Thanks in advance,
> >mark johnson
> >
> >
> >
> >
> >
> >--
> >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] unlink problem... please help...

2003-02-26 Thread Chris Hayes
At 16:42 26-2-03, you wrote:
$result=unlink('$dir_to_upload/$row->Photo');
what do you get when you echo

echo htmlspecialchars('$dir_to_upload/$row->Photo');

and do you use the full file path? Images accept relative links but in my 
experience PHP's file handling functions want the full path. 

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


Re: [PHP] conditional question.

2003-02-26 Thread Chris Hayes
At 17:10 26-2-03, you wrote:
I have a conditional that looks like this:
if ((is_array($HTTP_POST_VARS['cart_quantity'])) && 
(is_array($HTTP_POST_VARS['products_id']))){
//do stuff
}

The evaluation returns false.  What makes this confusing is just before 
this block, for debugging purposes, I have the following:
echo $HTTP_POST_VARS['cart_quantity'];
echo $HTTP_POST_VARS['products_id'];

Both of them return the string "Array", indicating to me that they are 
arrays.  Now, if they're both arrays, and the conditional is checking to 
see if they're both arrays, wouldn't it make sense that it should evaluate 
to "true"?
My first reflex was to check the user-annotated manual and the last note 
seems to fit just fine to your problem:


syncro at outgun dot com
30-Jan-2003 10:16
I have noticed that is_array() acts a bit weird when the argument is an 
expression, rather than a variable. Working with a multilevel nested array, 
is_array($bigArray[$part]) does not return what it should, but 
$column=$bigArray[$part]; and then is_array($column) does the job fine...
It looks like this might happen with other is_* functions as well.

(from http://nl.php.net/manual/nl/function.is-array.php)

I suggest to also try $column=&$bigArray[$part]; <--- note the added &, so 
the (sub)array does not need to be copied.



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


Re: [PHP] Deleting a page after viewing it

2003-02-26 Thread Chris Hayes
At 18:32 26-2-03, you wrote:
I have a confirmation of "membership" page a user would arrive at after 
clicking on a URL in an email. After they click on a link in this page I 
want to delete the page itself so it will only exist for this one use. The 
URL in the page does go to another "Welcome" page which is on another 
server. Do I need to include something in the second page that will do the 
deleting, or can I delete it from within the script for the first page 
that deletes as of the click on the URL. Haven't written any code yet for 
this, but I'm thinking "unlink."
I think this is usually done with a link like 'confirm.php?id=23sahd', and 
with that link a database field in the usertable called 'email_confirmed' 
that was false by default and then is changed to true. Another field called 
'expires_on' with a date in it.

However back to your question. I would not delete a file that is currently 
being executed. That could lead to all sorts of confusion by the server 
and/or php. So you could pass the filename on to the second or you could 
read the $_server['http_referer'] to see the filename as url. Then i think 
you need to change that in a proper filepath, by chopping the referer off 
from the last slash (eg finding last slash with strpos() and selecting the 
end of the string with substr()). See the true file path with

echo __FILE__;

or by running php_info();

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


Re: [PHP] $PHP_SELF with redirected domain

2003-02-26 Thread Chris Hayes
...and the problem that the form immediately goes to the real url is that 
people see the real url?

What about one of the following:

 - chop off the subdir again by only putting the last part of $PHP_SELF as 
form action (f.i. with a combination of substr($PHP_SELF,...,...) and 
strpos('/') )

or
 -  when i do a full path in the redirect in .htaccess:
ErrorDocument 404 http://www.domain.org/redirect/redirect.php
it is treated as a fresh page and all form results are lost
but when i do
ErrorDocument 404 /redirect/redirect.php
in .htaccess,  the original post and get vars stay, and i suppose 
also the  original $PHP_SELF

Maybe the same happens with your thing, i happen not to know what %1/$1 
does. If %1 is the domain, try to do it without that (but with the slash, 
so /$1 ). Worth a try innit?

or
- simply make a new page that receives the file, or not using $PHP_SELF but 
the actual filename.

At 18:42 26-2-03, you wrote:
If I use $PHP_SELF as the action in a form where the domain name is 
redirected,
I get the extra directory.

Is there a way around that?

Details:

The domain name is redirected in .htaccess like this:

RewriteCond   %{REQUEST_URI}  !domain2
RewriteRule   ^(.*)   %1/$1 [L]
So, domain2 is really a directory on domain1, but http://domain2.com will be
taken to that directory on domain 1 as if it was the http root
But, when using $PHP_SELF, I get the extra directory, so the form may start
here:
http://domain2.com/myform.php

But the $PHP_SELF forces the next POST page to be

http://domain2.com/domain2/myform.php

Ideas?

kind regards,

bill hollett

--
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] Capitalising Personal Names

2003-02-28 Thread Chris Hayes

> What is someone spells their name Desilva?
>
> On February 28, 2003 06:21 am, Justin French wrote:
> > What about DeSilva And McSomething?
I found another thread on this subject here: 
http://www.phpbuilder.com/mail/php-general/2002102/2138.php, but i did not 
read it.

Looking at all the examples here,  i'ld only interfere if all chars are 
upper or all are lower. Only in those cases i would apply the simple 
uc-first. Then you would only upset ani difranco who wants to be all 
lowercase. (Maybe you should run a check on that name :) ).





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


Re: [PHP] Get variable from PHP before submit

2003-03-01 Thread Chris Hayes
I am putting my gamma-epsilon-psycho telepathy beamer to the maximum but 
there are too many coders inbetween us, i cannot receive you.

Please give a little hint on what these functions are and what value comes 
from where and goes where.

At 04:00 1-3-2003, you wrote:
I'm trying to implement the following functionality into the file test.php:

When I scroll down the page and then hit a button, the page should remember
the scrolled position, refresh the page and then scroll down to the
remembered position. I've almost managed to make this work, but only almost.
The first time I click one of the buttons, the page won't scroll, but after
that it works fine. I think the reason for this is that the function
hentKoordinat() gets called before $teller is set. hentKoordinat() uses
$teller.
Anyone know a way to make this work?

Thanks alot!

Lars

File test.php:

http://www.w3.org/TR/html4/loose.dtd";>

Ykoordinat: " . $yKoord . "

"; echo "Teller: " . $teller; for($i=0; $i<150; $i++) { echo '
'; } for($teller=0; $teller<2; $teller++) { ?>  

--
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] changing colors on buttons

2003-03-03 Thread Chris Hayes
At 18:13 3-3-03, you wrote:
is there a way you can change the text color on buttons as well as the
background color for a button?
you do that by making a css style for the button, plenty of examples on the 
net, if you can figure it out from a german site try 
http://www.webmatze.de/webdesign/css/buttontricks.htm, (nice examples) if 
not do you own search.





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


Re: [PHP] Splitting up big strings

2003-03-04 Thread Chris Hayes
At 19:17 26-2-03, you wrote:
On Thu, 27 Feb 2003 01:02:54 +0800, Jason Wong wrote:
>On Thursday 27 February 2003 00:54, {R}ichard Ashton wrote:
>> I have the body ov a Usnet article, all of it, in $body. I want to
>> split it into lines.
>>
>> I have tried
>>
>> $lines = explode( X, $body);
>>
>> where I have used
>>
>> X = "0x0A"
>> X = '0x0A'
>> X = "0x0D"
>> X = '0x0A'
>> X = "\r"
>X = "\r"
X = '\r'
X = "\n"
X = '\n'
I then have

echo "pieces $pieces[0] ";
echo "pieces $pieces[1] ";
echo "pieces $pieces[2] ";
echo "pieces $pieces[3] ";
echo "pieces $pieces[4] ";
echo "pieces $pieces[5] ";
If I look at $body with Hex editor there are lots of 0D 0A pairs and
further if I look at the source of the page generated by
echo $body; I can see the CRLF's
I think 0D0A is "\r\n" (double quotes!).
Maybe you can start with str_replacing all "\r\n" and "\r" with "\n" so you 
can explode by "\n" only. Use double quotes for best result.

Chris H.



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


Re: [PHP] assign gobal values in class?

2003-03-05 Thread Chris Hayes
At 13:35 5-3-03, you wrote:
   can you assign global value in a class like:

class test{

global $arr;

}

anyone?
try! :)
if it does not work in this place, try setting it in the constructor 
function, which is a function in the class with the same name as the class,


class test{
var $test_arr;
  function test()
  {gobal $arr;
  $this->test_arr=$arr;
//or maybe even
  $this->test_arr=&$arr;
  }

}


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


Re: [PHP] coockies in windows xp

2003-03-05 Thread Chris Hayes
At 15:29 5-3-03, you wrote:
having to use coockies to identify visitors I seem to have a problem with
visitors using windows xp.
the command I use is setcoockie("coockie1", "true", time()+600)

any ideas???
Did you test this with various versions of windows?
Do these people have cookies turned on, do you have a test built in?
Do these people use one of these nightmare 'Safe Internet' tools installed?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mortgage calculator

2003-03-05 Thread Chris Hayes
At 17:49 5-3-03, you wrote:
I'd like to add a mortgage calculator to a client's site. I've been unable
to find the formula.
Well the calculation depends on the companies policy of course.
1. Normal rent calculation would go like this:
where
 i = interest or rent over a certain the period of time (
usually between 0 and 1 (1=100%). With 3.5% interest, i is 
3.5/100=0.035
 n = the amount of timeperiods that passed
 $ = pack of money   , and $(0) is heap at start, $(n) is at end of n 
timeperiods

  $(n)= $(0) * (1+i)^n

(x raised-to-the-power-of y is sometimes written as x^y, sometimes as x**y 
(Perl))

in PHP
$startsum=$_POST['startsum'];
$interest=$_POST['interest'];
$timeperiods=$_POST['timeperiods'];
  $endsum = $startsum * pow(1+$interest/100,$timeperiods);
With a 3% year-rent  in 5 years $10 grows to
  $(n) = 10 * 1.03^5
2. Mortgage calculation
Well how do they pay back?
You can have them pay a fixed part of the loan plus the interest of the 
month, here called an annuiteiten-hypotheek
Then every month you pay
($in_this_month *interest)  + (1/$totalmonths * $startsum )

$in_this_month is probably
$n=thismonths number
so the monthly payment would look something like

((1 - $n/$totalmonths) * $startsum ) + (1/$totalmonths * $startsum )

I suppose you can simplify this if you are a mathematician.
If you are a bloody consultant you should have learned these formulas once 
up on a time.

You can loop through $n of course to make a nice list.






 In searching php.net, I found a discussion from back in
2000 related to some buggy code. My web search hasn't produced anything
other than realtor and mortgage companies and a perl script site. I'm not
familiar with perl and would prefer avoiding it until my knowledge improves.
There were corrections for a java script somewhere, but I'm beginning to
think it is down. Some things seem so obvious that you just don't think you
need to bookmark! So why can't I remember...
Perl is not that hard to translate to PHP if it is clear what every 
variable means.

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


Re: [PHP] pharse file random work with -n lines

2003-03-05 Thread Chris Hayes
At 01:27 6-3-2003, you wrote:
// Code start

$i = 0;
$fp = fopen ("./../../cgi-bin/Classifieds/data/ads.data", "r");
while($tmp= fgetcsv($fp,5,"\|")) { $array[]=$tmp; }
fclose ($fp);
$rand_array=array_rand($array, 10);


foreach($rand_array as $line) {
did you check to print_r($line); here to see if there is data in it?


list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier,
$usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat,
$ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3,
$Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei,
$dreidrei, $dreivier, $dreifunf, $dreisechs ) = ($line);
echo " $line $Endzwei $End3 
";
did you try to
echo $adnr;
etc. here and see whether it has content?

}

// Code end

Only returns the random line numbers on the page : $line
no errors no content
the arrays are empty ?
can not find out whats wrong,
--
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] What am i doing wrong? SQL Query in PHP

2003-03-09 Thread Chris Hayes
At 13:37 9-3-2003, you wrote:
I want to display the first 3 words of my record in
the my table and following is the code i'm using.
When i use the SQL Query in mySQL.. it works great..
but when i try to implement it in my php page.. i'm
not getting anything.. no error, no display, no
result.. just blank.. why?
i don't know what's wrog but you could do some quick debugging
by echoing mysql_error() when the query fails.
($result=mysql_query(.) or die ('Query failed at'.__FILE__.' line 
'.__LINE__.' and mysql says:'.mysql_error());



$db = mysql_connect("localhost","user","pass");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT substring_index(title, '
', 3) from news order by ID desc limit 4",$db);
if ($myrow = mysql_fetch_array($result)) {
  do {
check whether there are some results walked through by doing something 
silly like echo '*'; here.


echo(" $myrow[title] ");
  } while ($myrow = mysql_fetch_array($result));
}
?>


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


Re: [PHP] What am i doing wrong? SQL Query in PHP

2003-03-09 Thread Chris Hayes
At 13:37 9-3-2003, you wrote:
if ($myrow = mysql_fetch_array($result)) {
  do {
echo(" $myrow[title] ");
  } while ($myrow = mysql_fetch_array($result));
}
PS same result with

while ($myrow = mysql_fetch_array($result));
{   echo $myrow['title'];
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Easy Way.

2003-03-09 Thread Chris Hayes
At 22:23 9-3-2003, you wrote:
You're looking for the str_pad function.
http://www.php.net/str_pad
$i = 3;
$i = str_pad($i, 5, '0', STR_PAD_LEFT);
echo $i;  // outputs '3'
Just keep in mind that it won't help you if your input is greater than 5
to begin with, you'll have to check that seperately.
You can also have a look at http://nl.php.net/manual/en/function.sprintf.php

Example 5. sprintf(): zero-padded integers
$isodate = sprintf("%04d-%02d-%02d", $year, $month, $day);
if it is only for output, have a look at 
http://nl.php.net/manual/en/function.printf.php

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


Re: [PHP] Can someone explain this? include problem.....?

2003-03-09 Thread Chris Hayes
At 22:15 9-3-2003, you wrote:
Hi,

I have a php script which does some stuff and at the end of the file I have
it include a file which has a form in it. The problem I am having is that it
is missing code.  If you go down to the second input - it has a value="0"
field - this does not show up when I view the source from my browser. The
first input value= works fine.
have a closer look at it!!

compare your first line:

to the failing line:

I'm sure you can see it :)

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


Re: [PHP] eval error

2003-03-10 Thread Chris Hayes
At 12:54 10-3-03, you wrote:

what problem I want to use eval in my script but its generate this error :
Parse error: parse error, unexpected T_LNUMBER in 
C:\Projects\phpmag\admin\functions\admin_cont.php(22) : eval()'d code on line 4
   eval ("\$all_types_list .= \"$all_types_list\";");


For those who do not know what all the CAPITALIZED secret words in error 
messages mean: i found a list of them on 
http://www.zend.com/manual/tokens.php. A T_LNUMBER is an integer.

I __suppose__ that $all_types_list contains a number, maybe 144, and while 
you mean to do
$all_types_list.="144";
the eval function somehow evaluates
$all_types_list.=144;

And .= expects a string on the right side, not an integer.

Maybe someone who is more experienced with eval() can shed more light on this.



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


Re: [PHP] Cleaning up HTML table structure

2003-03-10 Thread Chris Hayes

PS: If you want a tool which really cleans up HTML you should use HTMLTidy 
of course. :)
http://tidy.sourceforge.net/#source 

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


Re: [PHP] php/apache timeout

2003-03-11 Thread Chris Hayes
At 18:40 11-3-03, you wrote:
We are using Apache/PHP and using ORACLE as the database. When I submit 
the page with hugs database when the server side script (PHP) running I am 
getting an error "Page not found". But on the background it is adding 
records to the database. Though I modified all the configuration in 
php.ini file max_script_execution , sesssion_gc_maxsize .etc and 
http.conf file TimeOut, KeepAliveTime paramets. How to stop this error?? 
do I need to sent any other parameters either in php.ini or in http.conf file.
Can it be that your script works like this:

* a page with the form, for instance form.php
 - when someone presses submit, they are sen on to either the page 
mentioned in  , or a 
location.href="nextpage.php" in a bit of javascript
[nextpage.php could be form.php itself, with a form submission detection.]

* nextpage.php will check the entered values and enter them in the 
database, and looking at probably
 - lead the user to a next page. in this case probably  with a bad url.
Check for lines with 'headers(location' or javascripts with location.href...



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


  1   2   3   4   >