[PHP] Unique Identifier String
I am currently working on a mySQL site administration system and I need help on figuring out how I can create a 24 digit letter/number unique identifier string. I know that I can easily get a random number using a PHP function (I can remember it off the top of my head) but I also need to create random letters and then insert them into the number. Here are the steps of the process: 1. Create a 12 digit random number using a PHP function 2. Create 12 random letters 3. Insert the letters into the number, or the other way around Result: 1h5l79G05OP65kN61LPs1o6Z Out of the steps above, I am not sure how to do 2 and 3 and I would greatly appreciate it if someone could point out for me how to do them. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Formatting XML Data
Hello, I have been working with XML in the recent weeks and I have recently come across the need to format some of the data in my XML. For example I might have a large XML file and I would like some of the text to be bold, or maybe I would like to insert a hyper-link. Unfortunately it does not seem I can do this with ordinary HTML tags because they will be interpreted as XML tags. I am sure, however that there is another way of doing this. Does anyone know how? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Problem
Hello, I am having some problems parsing XML with PHP. Here is an example of my problem: Example 1: SOME TEXT When I try to use the expat XML functions I cannot parse TAG1 in the above example. I simply get nothing. However with the following example: Example 2: SOME TEXT I have absolutely no problems. I get the text in between TAG1 without any problems. However I have some very long documents that I would like to translate to XML and I cannot put the whole document on one line, as it would be impossible to read. I have, however seen other XML files like example 1 that were parsed fine, AND they were parsed with the expat functions. I cannot figure how though. Any help would be appreciated. Thanks in Advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML Problem
You were right, I found the following: # Declare the function that runs each time # character data is encountered. function CharacterHandler($Parser, $Line) { global $CData; # Place lines into an array because elements # can contain more than one line of data. $CData[] = $Line; This should, obviously solve the problem, but I am not sure how I should go about using it? Later on, you make the $Cdata a string, $temp, and then the next time you use it: $Temp = $Data['TRADE-DATETIME'] You re-assign it again without using the data. Did I miss something? -Original Message- From: Analysis & Solutions [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 30, 2002 8:27 PM To: PHP List Subject: Re: [PHP] XML Problem On Sun, Jun 30, 2002 at 05:58:59PM +0200, Sebastian A. wrote: > > I am having some problems parsing XML with PHP. Here is an > example of my problem: The answer hasn't changed since the last time we had this same discussion back in early May. Search groups.google.com for message id [EMAIL PROTECTED] --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- 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] XML Problem
I looked over the revised version of the document and unfortunately I still don't fully understand. I know that I have to save the data on each line, and then either display it or turn it into a variable. You put the data in an array and then implode it into a string, however I am not 100% certain about this process... Could you give me any advice? -Original Message- From: Analysis & Solutions [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 6:26 AM To: PHP List Subject: Re: [PHP] XML Problem Sire: On Sun, Jun 30, 2002 at 10:21:40PM +0200, Sebastian A. wrote: > > Later on, you make the $Cdata a string, $temp, and then the next time you > use it: $Temp = $Data['TRADE-DATETIME'] > You re-assign it again without using the data. Did I miss something? Yes. Further down was the default case, with the line: $Data[$Elem] = $Temp; But, that's not there any more. I reworked that file a bit to clarify that and add in more error checking. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- 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] Session Tutorial
Recently I have been trying to work with sessions however I must admit that I am not sure I completely understand them. Does anyone know of a good tutorial that thoroughly explains sessions? Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.2.0?
On PHP.net it says that version 4.2.0 of PHP is out, yet on the downloads page, I can only find 4.1.2. If anyone has PHP 4.2.0 can you please provide me the URL? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do i upgrade from PHP 4.1.2 to 4.2.0?
What do I have to do to upgrade from PHP 4.1.2 to 4.2.0? Do I just overwrite all the old PHP files with the new ones or must I do something else? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question and PHP DOMXML and Apache
Have the new DOM XML functions been included in the latest version of PHP (4.2) when I try to use one of the new functions, such as domxml_open_file() I get an error message saying I am calling and undefined function. Has anyone successfully used these new functions with PHP 4.2? My second question is about apache. How do I do a "clean" shutdown of apache? When I shut I down through the console, the next time I start it up I am told something about an unclean shutdown... Thanks.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DOM XML
Hello, I have been recently doing experiments with the DOM XML function and I am (not surprisingly) having some problems with it. When I try to run the code below, I get an error saying I am trying to use and endefined function. To me it seems that the DOM XML extension is working fine, because I get no error from xmldoc(), but I am still not sure what the problem is. I am running PHP 4.2 Code: Anyname"; $dom = xmldoc($str); $root = $domxml_root($dom); echo $root->name; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-GTK Question
Hello, I have recently installed PHP-GTK with any problems, however I cannot get it to work. When I click on the php_win shortcut I get an error saying: Usage: php_win Does anyone know how I can fix this and run my PHP-GTK scripts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variables from XML Documents
Hello, I have recently been trying to use templates with XML documents. My problem however is that I cannot get the values between XML tags into variables. For example Example XML Document: Foo-Bar What would I need to do, so that I can get the contents of the tag (Foo-Bar) into a variable? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables from XML Documents
The parsing is not the problem. I am already using the PHP XML parser, but the problem is that it I cannot get the content of elements into variables like I already stated. Does no one know how to do this? -Original Message- From: Analysis & Solutions [mailto:[EMAIL PROTECTED]] Sent: Monday, May 06, 2002 8:25 PM To: PHP List Subject: Re: [PHP] Variables from XML Documents On Mon, May 06, 2002 at 08:20:46PM +0200, Sebastian A. wrote: > > > Foo-Bar > > > > What would I need to do, so that I can get the contents of the tag > (Foo-Bar) into a variable? Check out my "PHP XML Parsing Basics" at http://www.analysisandsolutions.com/code/phpxml.htm --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- 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] XML: Similiar Multiple Tags With Different Data
Hello I have recently been trying to parse an XML document that has different content in the same tags. Here is an example: 1 2 3 ... I am trying to get the content from into an array. I want the content of the first to go into $p->ART_ID[0] and the next to go into $p->ART_ID[1] and so on. Here is what my Element Content Function looks like: - function elementContent($parser, $data, $attrs='') { global $tag, $data, $test; global $p; $ti = sizeof( $tag ) - 1; if ( $tag[$ti] == 'LIST_ITEM' ) { $p->ART_ID[] .= $data; } } When I type in echo $p->ART_ID[0] I should get 1 however I get 1 2 3. For some reason all the content goes only into one section of the array. Does anyone know how I can fix this? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML: Similiar Multiple Tags With Different Data
I tried your suggestion already but It doesn't seem to work. I still can get it to be assigned to different parts of the array. Do you have any other suggestions? -Original Message- From: Kjartan Mannes [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 12, 2002 11:10 PM To: Sebastian A. Cc: PHP General List (PHP.NET) Subject: Re: [PHP] XML: Similiar Multiple Tags With Different Data Sunday, May 12, 2002, 6:39:31 PM, Sebastian A. wrote: > Hello > I have recently been trying to parse an XML document that has different > content in the same tags. Here is an example: > 1 > 2 > 3 > ... > I am trying to get the content from into an array. I want the > content of the first to go into $p->ART_ID[0] and the next to go > into $p->ART_ID[1] and so on. Here is what my Element Content Function looks > like: Without the rest of the code I would suspect this to work: function elementContent($parser, $data, $attrs='') { global $tag, $p; $ti = sizeof( $tag ) - 1; if ( $tag[$ti] == 'LIST_ITEM' ) { $p->ART_ID[] = $data; } } Basically when you are assigning content to a new part of the array you don't use .= but just = -- Kjartan <[EMAIL PROTECTED]> (http://natrak.net/) :: "A program is a spell cast over a computer, turning input into error messages." :: Drupal (www.drupal.org) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML: Similiar Multiple Tags With Different Data
Ok well that function is the character_data_handler function. Here is the Start Element function: function startElement($parser, $name, $attrs='') { global $tag, $Data, $p; array_push( $tag, $name ); while ( list($Key,$Val) = each($attrs) ) { $p->attr_data["$name:$Key"] = trim($Val); } } Here is the end element function: function endElement($parser, $name) { global $tag; } And I just wanted to mention that a lot of that code is from your tutorial (Anlysis and Solutions). I was just experimenting with it, trying to get different things to work. You should know pretty well what everything does. Another thing is that, I think this problem might have something to do with the array_push function in the Start Element function, however I am not sure. -Original Message- From: Analysis & Solutions [mailto:[EMAIL PROTECTED]] Sent: Monday, May 13, 2002 10:04 PM To: PHP List Subject: Re: [PHP] XML: Similiar Multiple Tags With Different Data On Mon, May 13, 2002 at 05:49:04PM +0200, Sebastian A. wrote: > function elementContent($parser, $data, $attrs='') { > global $tag, $p; > > $ti = sizeof( $tag ) - 1; > > if ( $tag[$ti] == 'LIST_ITEM' ) { > $p->ART_ID[] = $data; > } > } You're not posting enough of your code for us to understand how you got here. For example, which parser function are we looking at here? I'm guessing it's the character_data_handler. But, it's not supposed to have an $attrs argument. [OY! I just cought a bug in my online tutorial... Had an $Attr argument for the end handler. Fixed it.] Also, where's the $tag array coming from? Why's it an array? Let alone, why are you trying to process stuff in the content handler when it's more effective to handle it in the end handler? --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- 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] XML: Similiar Multiple Tags With Different Data
I hope I didn't sound impolite, I really didn't mean to offend you, because if it weren't for your tutorial I would probably still be trying to figure out how to parse attributes and get XML Content into variables. Anyway, the performance and efficiency doesn't really interest me at this point. I just want to get the thing working before I work on improving it. What I really want to do is build up to a full time XML Database application. I know a flat file XML DB won't be as fast as mySQL, but the entries can be edited with any text editor, and ported to any platform, and it will be fairly easy to do. I just have to get the hang of XML Parsing and I will be half way there. Anyway, you asked "What's the point of doing the if == 'LIST_ITEM' check in the character handler rather than the end handler?", well the point is that if it is LIST_ITEM I want to the content in a variable. As far as I know this cannot be done in the end handler. Second of all the array_push is there for a reason I am not even sure about, but when I try to remove it the code doesn't work. I will experiment later with alternatives, but for now my main concern is what I previously mentioned: Getting the different values from the same XML tag into an array. >PS: Please be polite. Don't top post and only include immediately relevant portions >from prior emails. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML: Similiar Multiple Tags With Different Data
Ok I see where you're going with this. Thanks a lot. I will be sure to improvise my code. -Original Message- From: Analysis & Solutions [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 15, 2002 8:10 PM To: PHP List Subject: Re: [PHP] XML: Similiar Multiple Tags With Different Data On Wed, May 15, 2002 at 07:49:58PM +0200, Sebastian A. wrote: > performance and efficiency doesn't really interest me at this point. I just > want to get the thing working before I work on improving it. But your haste is making waste. Even funnier, in your haste, you're making more work for yourself. > Anyway, you asked "What's the point of doing the if == 'LIST_ITEM' check in > the character handler rather > than the end handler?", well the point is that if it is LIST_ITEM I want to > the content in a variable. As far as I know this cannot be done in the end > handler. That's why I temporarily store the content in the $CData array. Then, when I get to the end handler, I extract the data from the $CData array, and do what is necessary with it. > Second of all the array_push is there for a reason I am not even > sure about, but when I try to remove it the code doesn't work. But your code isn't working with it either. It's adds a whole series of unnecessary steps. Again, look at the tutorial, http://www.analysisandsolutions.com/code/phpxml.htm, and modify ONLY what you need to. In your case, the only thing you need to change is adding a special case for 'LIST_ITEM' to the switch in the end handler function. THAT'S where you'll stick that stuff into the $p object you were trying to do in the content handler. Oh, of course, drop the case in that switch statement that don't apply to your DTD, but that goes without saying. Good luck, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- 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] Searching Many Text Documents
Hello, I recently have run into a situation where I must search through many text (XML) documents. I would like to implement a search feature on my site that can search through the XML documents I use for my pages. I will probably need to search all the files in a specific directory for a certain term or keyword. Does anyone know how I can do this? And please remember, I need to search through more than just 1 file. Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Searching Many Text Documents
Thanks a lot for this. I will try to implement this in my site. Does anyone have any other suggestions? -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 29, 2002 10:06 PM To: Sebastian A. Cc: PHP General List (PHP.NET) Subject: Re: [PHP] Searching Many Text Documents On Wed, 29 May 2002, Sebastian A. wrote: > I recently have run into a situation where I must search through many text > (XML) documents. I would like to implement a search feature on my site that > can search through the XML documents I use for my pages. I will probably > need to search all the files in a specific directory for a certain term or > keyword. Does anyone know how I can do this? And please remember, I need to > search through more than just 1 file. To do it efficiently, you need to pre-index the documents. Rather than starting from scratch, better to see if there's something already written that can do it for you. For starters, have a look at: http://www.mnogosearch.ru/ miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Question
How do I sort out data from mysql_fetch_row() or mysql_fetch_array? For example say I wanted to list all my users alphabetically. How would I do this? Or say I had a form and I wanted to present the content to the user *AFTER* they have filled it out so that they can check for mistakes. Mysql_fetch_row() returns all the rows in a field, so I would guess that I have to sort using PHP. Can anyone provide me with an idea as to how I could accomplish this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] <<
I am trying to use <
[PHP] Passing Values
Hello, Today I was working on an object that will create all of the columns and tables in my DataBase for my upcoming application. I however, did run into trouble. I am having problems because I cannot pass the name of the database from the form to the function that needs it. Everything is on the same page (sql_create.php), and the functions that gets the data (the form function) and the function that needs the Database name are both within an object. Does anyone have any ideas? I can post some code samples if it will help. Thanks in Advnace -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Includes
Lately I have noticed many scripts that all consist of one file even though they create the appearance of many pages. For example, you would open setup.php and a form would appear. Then after you complete the form a new page appears with the results of your form, however the URL is still setup.php. So basically you can make complicated forms span only one file instead of having separate file to gather, display and save the data, how is this done? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing to Files
Hey All, I have recently been trying to create some logs for the install script I have been making (to make it easier for me to diagnose problems) but I am wondering how to create and write to text files. I know about the fopen() and fwrite() functions, which theoretically should enable me to do this however I am not exactly sure how I should go about this. Also, I realize that there is limited formatting I can have with text, however I would like to know if its possible to control the line spacing between the entries, and whether or not its possible to indent lines. Lastly, are text files a good idea for logs? Do any of you use anything else I should be aware of? Thanks for all your help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to convert a website to a txtfile....?
You can try using fopen() and fwrite(), they are the primary file manipulation tools you should use in this instance. -Original Message- From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 06, 2002 5:52 PM To: [EMAIL PROTECTED] Subject: [PHP] How to convert a website to a txtfile? Hi! I have this website with a webshop that customers can order some products. And when the products are listed up in the cart on the screen, would I like to get the output into a new txtfile and save it on the server. Then it is possible to get it faxed, and that is the goal. Anyone who has done this before? Thanks for all help! Best regards Raymond Lilleodegard -- 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] mailing list using mail()
That's a good question and one that I have too. As far as I know mail() is supposed to utilize sendmail... -Original Message- From: Anzak Wolf [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 10, 2002 7:27 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] mailing list using mail() > > > the combination of PHP and mysql and the ease of use of the mail() > > function obviously leads me to believe that it *should* be a cinch to > > use php to send customised messages to all my users , of whom I have > > details in a mysql table by simply running a "select * from table" and > > then using a while loop to run through every row and sending an e_mail > > to $user_in_table. > >You don't want to use the mail() function. It will take forever to send >17,000 messages since PHP will wait for each message to be delivered >before sending the next one. With DNS lookups, slow remote servers, etc., >it can take a long time to send each message. > >A better solution on *nix machines with sendmail is to write the messages >into the mail queue and use "sendmail -q" to send them out. (If sendmail >is running as a daemon, it's probably already configured with "-bd -q15m" >or a similar set of command line switches. Otherwise you'll need a line >in /etc/crontab that runs "sendmail -q" as root throughout the day.) > >Here's a sample that writes each message into the queue assuming the >appropriate values for each addressee are stored in $from, $to, $subject, >and $message. You'd obviously embed this is an iteration loop. > ># you probably want a sender to handle bounces >$sender="[EMAIL PROTECTED]"; > >### LOOP OVER THESE > ># complete sendmail command; note that this must be in the iteration ># loop to fill in $sender and $name for each recipient >$sendmail="/usr/sbin/sendmail -odq -t -i -f$sender '$name'"; > ># construct the header >$headers= >"Sender: $sender >From: $from >To: $to >Subject: $subject >"; > ># mail the message (write to sendmail socket; queue for delivery) > >$sm=popen($sendmail,"w"); >fputs($sm,$headers); >fputs($sm,$message); >pclose($sm); > >### END OF LOOP ### > > I have a question with regards to this. From reading the docs on mail() it seems that the mail function just opens a socket to sendmail on your local system anyway. So how does forcing the same sort of action help in this case. I'm trying to get a firm grasp around this whole email/sendmail/sockets thing. -Jim _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- 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] XML Flatfile Database
Recently I have caught on to XML, and I think it truly is a good idea. Because XML was *made* to store data I believe an XML flatfile database is (perhaps) one of the best ways to store data because it can be easily exchanged. Therefore I would like to embark on the feat of trying to create xml_db_lib, which (as the name suggests) will be a library of XML database functions. This includes everything from adding data, to querying the data. It would greatly help if anyone could point out a PHP application to me that uses a XML database so I can get a better idea of the inner workings of it, also if you have any suggestions I will gladly hear them... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php