[PHP] Re: POST form variables not being sent to destination page
On the PHP Bug board, I managed to find that it was to do with the Apache configuration settings, namely, you should put AddType application/x-httpd-php .php .php3 instead of; FilesMatch \.php$ SetOutputFilter PHP /FilesMatch in the httpd.conf file. This took ages to find and was only posted within that last few days on the PHP bug board, hope it helps you with your elusive first POST variable. Whow, thanks man. It works like a webserver should work. All my problems are gone, even the huge POST problem I've had (bug #19263). Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: changing session name
I want to change the default session name 'PHPSESSID' to say ex. 'seid'. How can I do this without editing to the php.ini since I'm having a site on a virtual host. Try putting this at the start of your scripts: ini_set ('session.name', 'seid'); Luke Welling. -- PHP and MySQL Web Development by Luke Welling and Laura Thomson http://www.amazon.com/exec/obidos/ASIN/0672317842/tangledwebdesign -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count in PHP
why not: select count(*) as counter from table - Original Message - From: Tyler Longren [EMAIL PROTECTED] To: Chuck PUP Payne [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 1:02 PM Subject: Re: [PHP] Count in PHP $sql = mysql_query(SELECT * FROM table ORDER BY whatever); echo(mysql_num_rows($sql)); that should do it. tyler On Tue, 10 Sep 2002 00:58:26 -0400 Chuck \PUP\ Payne [EMAIL PROTECTED] wrote: I am wanting to do a count in PHP. I want to be able to count the number of records from a given database and display this count on the page. Can this be done using PHP or is the sql thing? Chuck Payne -- 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] dropdown Newbie question
Hello, after a little break ( i really needed it ;P), i tried to get this thing wotkig again. I changed action to .$PHP_SELF. and i added the echo to test if it works: echo $_POST['test']; But still emtpy, what do i do wrong? ?php echo ' form name=test action='.$PHP_SELF.' method=POSTbr select id=colorPicker onChange=changeColor(this.options[this.selectedIndex].value) optionBackground Color option value=FFBlue option value=FFRed option value=00FF00Green option value=00Black /select input type=submit value=Click To View Submission /form '; echo $_POST['test']; ? /body /html From: Jay Blanchard [mailto:[EMAIL PROTECTED]] [snip] Did you put a closing form tag? /form you are right, the closeing tag was missing, well, it still doesnt work/stays emty ;/ [/snip] Does this form refer to itself, or another page? Also, like Justin said, echo the variable before writing to a directory to see what is getting written, if anything. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: changing session name
Mohd_q wrote: I want to change the default session name 'PHPSESSID' to say ex. 'seid'. How can I do this without editing to the php.ini since I'm having a site on a virtual host. http://www.php.net/session_name HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
u cannot use form's name as variable . u should replace this row select id=colorPicker like this select name=test id=colorPicker u can see the selected option's value -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Generating CSV files on the fly and getting the browser to download
Hi All, I suspect this is a commonly asked question but; how do I generate a CSV files on the fly and get the browser to download it. Do I actually need to generate a file or can I just generate a variable contain the data that would be in the file? Any help is greatly appreciated. TIA Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generating CSV files on the fly and getting the browser to download
Try this: ?php $fileextension=csv; $filename=report; $fnsave = $filename.$fileextension; header(Content-disposition: filename=$fnsave); header(Content-type: application/force-download); // generate your CSV content here and print them to the browser via ECHO echo 'a,b,c,d,1'; //. ? Elias Henry [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi All, I suspect this is a commonly asked question but; how do I generate a CSV files on the fly and get the browser to download it. Do I actually need to generate a file or can I just generate a variable contain the data that would be in the file? Any help is greatly appreciated. TIA Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generating CSV files on the fly and getting the browser to download
It didn'ti work ;-( Just showed a page with the data in! How would I do it with a file in any case? Henry Lallous [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try this: ?php $fileextension=csv; $filename=report; $fnsave = $filename.$fileextension; header(Content-disposition: filename=$fnsave); header(Content-type: application/force-download); // generate your CSV content here and print them to the browser via ECHO echo 'a,b,c,d,1'; //. ? Elias Henry [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi All, I suspect this is a commonly asked question but; how do I generate a CSV files on the fly and get the browser to download it. Do I actually need to generate a file or can I just generate a variable contain the data that would be in the file? Any help is greatly appreciated. TIA Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Generating CSV files on the fly and getting the browser to download
try making the generated csv file an attachment to the php file... like so... ?php $fileextension=csv; $filename=report; $fnsave = $filename.$fileextension; header(Content-type: application/force-download); header(Content-disposition: attachment; filename=$fnsave); echo '1,2,3,4,5,6,7,8'; ? usually works for me. incidentally, what browser version are you using? on what os? dave -Original Message- From: Henry [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 2:43 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Generating CSV files on the fly and getting the browser to download It didn'ti work ;-( Just showed a page with the data in! How would I do it with a file in any case? Henry Lallous [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try this: ?php $fileextension=csv; $filename=report; $fnsave = $filename.$fileextension; header(Content-disposition: filename=$fnsave); header(Content-type: application/force-download); // generate your CSV content here and print them to the browser via ECHO echo 'a,b,c,d,1'; //. ? Elias Henry [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi All, I suspect this is a commonly asked question but; how do I generate a CSV files on the fly and get the browser to download it. Do I actually need to generate a file or can I just generate a variable contain the data that would be in the file? Any help is greatly appreciated. TIA Henry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generating CSV files on the fly and getting the browser to download
Henry wrote: It didn'ti work ;-( Just showed a page with the data in! How would I do it with a file in any case? You can give the PHP script the extension .csv and use AddType application/x-httpd-php .csv to your httpd.conf or .htaccess file. If you want to use a temporary file, you should use something like $string = 'a, b, c, d, e, f'; $fp = fopen( 'tempfile.csv', 'w' ); fwrite( $fp, $string ); fclose( $fp ); After file creation you should redirect the user to the .csv file. The problem here is that you cannot delete the temporary file afterwards. My first option is the one I'm using myself. You can't put all your faith in header(Content-disposition: filename=$fnsave); because most browsers won't understand it (and ignore it). If you give your php file the .csv extension, then no browser can ignore it. They think it's a normal .csv file, which should be opened with (for instance) Excel... HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DPHPEdit new version
Hi Everyone, specially DPHPEdit users! There is a new version of DPHPEdit - 0.9.4.2, which brings: - Highlighting method for current file can be manually changed in edit session - Custom highlighting support with Keywords and Functions editor - PHP Highlighter now recognizes different code segments in same file (must be closed properly) - Custom Syntax Coloring added! See Options-PHP/HTML Syntax Coloring - Project Tree is sorted after the project is loaded - Updated help file (HTML) Please check home page (http://www.pleskina.com/dphped) for program and manual changes, or download directly from http://www.pleskina.com/downloads/DPHPedit.zip Regards, -- Davor Pleskina [EMAIL PROTECTED] http://www.pleskina.com [EMAIL PROTECTED]; [EMAIL PROTECTED] ICQ#: 38632789 Programmers don't die; they just GOSUB without RETURN... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PhpMyAdmin and PHP4.2.* Too many I/Os
Hi, I have some troubles with PhpMyAdmin and PHP4.2.* I experimented these couples of installations: PhpMyAdmin / PHP 2.2.6 / 4.1.2 2.2.7pl1 / 4.1.2 2.3.0 / 4.1.2 2.2.6 / 4.2.1 2.2.7pl1 / 4.2.1 2.3.0 / 4.2.1 2.2.6 / 4.2.3 2.2.7pl1 / 4.2.3 2.3.0 / 4.2.3 with MySQL v3.23.49 on RedHat7.2 PhpMyAdmin works perfectly with PHP 4.1.2 but with 4.2.* one http request took more than 10 seconds and the linux box performed a lot of disk I/Os. PHP MySQL extension seems to be changed since v4.2.0 Where is the problem? I want to move to 4.2.3 :( Jean-Pierre ___ Do You Yahoo!? -- Une adresse yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail() function problem
Hi Everyone, I did a simple test with this script: ?php mail([EMAIL PROTECTED], test, this is a test mail); echo done; ? I run the script from web accounts on different servers. I can receive the test mail from some but not from others. Is there any configurations that I am missing here? Thanks and regards. -- Alva Chew Stridec Systems mobile: +65 9144-8023 email: [EMAIL PROTECTED] website: www.stridec.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload Progress
http://electroteque.dyndns.org:1023/demo/uploader/ following my other posts i have a working flash progress bar , although i cannot remove the empty arrays in the count how can i remove empty arrays in an array , the empty file inputs seem to still contain something , so instead of 1 as the count if you upload only one file , its still 5 for 5 file input fields Jed Verity [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You're right about it costing more money. But we had one server handling a bunch of uploads, most of them over 25 MB, and 99% being instigated by very impatient, not very technical, people. People who kept canceling and canceling, despite our directions, because they thought it was stuck or frozen or taking too long. It was worth $150 for us to buy the ASP component (I think we used ABCUpload, maybe?). The development time required for a creative PHP solution -- and one that might not have worked as well -- would have been dramatically more expensive than the almost out-of-the-box solution with ASP's components. (And much of the site was already written in ASP.) Other than that, you'll get know argument from me about ASP vs. PHP. I'm head over heels for PHP and, in any context other than the one stated above (and maybe one or two others), I would choose to use God Blessed PHP over anything else. Cheers! Jed P.S. I knew I'd get some fighters with that comment. Haven't learned my lesson yet... ;-) On the threshold of genius, Jay Blanchard wrote: [snip] There really isn't a great solution for this, that I know of. It's one of the few things that makes an argument for ASP over PHP, as far as I'm concerned (if you have the luxury of choosing). Below is what I did once to try to get around the problem. It worked *okay*. [/snip] How does this argue for ASP over PHP? I don't see how. File upload on PHP is built in and therefore free. ASP file upload mechs cost more money. And, having used ASP for a while, and having looked for this feature, no upload progress bar exists there either. And PHP is a language, where ASP is a service ... please do not confuse the two. If you want to argue VBScript vs. PHP , well ,come on ... let's go. :^] PHP can beat VBScript with one curly-brace tied behind its back. I mentioned a while back, when this came up before (see the archives) that this could probably be done with an IFRAME in the upload dialog box. Now I haven't given this much thought, but maybe it could be done. The largest problem that I see is the communication back and forth between client and server. The server would have to know the original size of the file at the point the upload is started, then it would be checked for original_size minus bits_uploaded, flush the reults to the IFRAME drawing a GD graph, and continue to do this as it went on. Another method is to start the upload with a non-progressive animation that quits when is_upload_file() returns true. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: checkbox question
if you can't use [] for the checkbox, the only way out is to have unique name for each checkbox. otherwise, php will always be returning the value of the last checked checkbox if all checkboxes share the same name without the []. --lance Alex Shi wrote: How to ontain data from a group of checkbox using same name? For example, in a form there're 6 checkboxes and all named as Interesting_Area. I know if put a pairs of square brackets at the end of the name then in php all the values of them can be ontained. However, for some reason I cannot use square brackets. Please help me out if anyone know how to do the trick. THanks! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trying to add table prefix variable to query
This query worked until I tried to add support for a table prefix in the config file. Now it can¹t seem to find the table. Any pointers to what I am doing wrong? Thanks, v Original query: ?php ... include(config.php); $open = mysql_pconnect($hostname,$user,$password); mysql_select_db($db,$open); $result = mysql($db,SELECT * FROM teams WHERE username = 'admin'); $i = 0; $total_rows = mysql_numrows($result); ... ? This is my query: ?php ... include(config.php); $open = mysql_pconnect($hostname,$user,$password); mysql_select_db($db,$open); $result = mysql($db,SELECT * FROM . $table_prefix . teams WHERE username = 'admin'); $i = 0; $total_rows = mysql_numrows($result); ... ? This is my config file: ?php $db = sports; $hostname = localhost; $password = mypassword; $user = myuser; $table_prefix = ccl_; ? This is my table name: ccl_teams This is the error: Warning: Supplied argument is not a valid MySQL result resource in...
RE: [PHP] Trying to add table prefix variable to query
[snip] This is my query: ?php ... include(config.php); $open = mysql_pconnect($hostname,$user,$password); mysql_select_db($db,$open); $result = mysql($db,SELECT * FROM . $table_prefix . teams WHERE username = 'admin'); $i = 0; $total_rows = mysql_numrows($result); ... ? This is my config file: ?php $db = sports; $hostname = localhost; $password = mypassword; $user = myuser; $table_prefix = ccl_; ? This is my table name: ccl_teams [/snip] You're query reads like this now SELECT * FROM ccl_ teams WHERE username = 'admin' You need to concatenate the variable with the text (remove the space); SELECT * FROM . $table_prefix . teams WHERE username = 'admin' Here is a useful troubleshooting method; if the query returns an error, print it out. You can generally find errors quite easily. HTH! Jay Guys have feelings too. But, like who cares? * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trying to add table prefix variable to query
Maybe you should assign the query to is's own value doing your string concatenation... i.e. $query = select * ...; then echo out the query: echo $query; I think you will see the problem them, I would guess that when you are adding the table_prefix to the table name that you are getting an extra space in there... So, try that out, and see if it helps -Brad This query worked until I tried to add support for a table prefix in the config file. Now it can¹t seem to find the table. Any pointers to what I am doing wrong? Thanks, v Original query: ?php include(config.php); $open = mysql_pconnect($hostname,$user,$password); mysql_select_db($db,$open); $result = mysql($db,SELECT * FROM teams WHERE username = 'admin'); $i = 0; $total_rows = mysql_numrows($result); ? This is my query: ?php include(config.php); $open = mysql_pconnect($hostname,$user,$password); mysql_select_db($db,$open); $result = mysql($db,SELECT * FROM . $table_prefix . teams WHERE username = 'admin'); $i = 0; $total_rows = mysql_numrows($result); ? This is my config file: ?php $db = sports; $hostname = localhost; $password = mypassword; $user = myuser; $table_prefix = ccl_; ? This is my table name: ccl_teams This is the error: Warning: Supplied argument is not a valid MySQL result resource in... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Populating Other People's Forms
I would like to write a script that would populate someone else's form on the net and get the results. Off hand, I imagine I would use fopen() to open up the web page and pass some variables to it. The problem I have is that the form I want to populate is a multi-step CGI. Is this possible? How do I continue to pass variables to a second or third step, sending variables passed on what the form says to do next (which is predictable)? This is considering I do not have the cooperation of the web site I am trying to fill out the form for step by step, and I would like to write this so it is done in a behind-the-scenes, automated way. For example: A customer registered with me could ask for a product. My 'agent' would go to the site where the product is sold, login, submit all of the appropriate information for purchase and shipment, and then come back with (hopefully) a success message (along with any pertinent information from the purchase). Anyone have any ideas, suggestions, or can point me in the right direction? Thanks, -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trying to add table prefix variable to query (solved)
Doh,... Thanks to all who replied so promptly with similar answers. :) vern On 9/10/02 9:13 AM, Jacob Miller [EMAIL PROTECTED] wrote: Make sure you don't have a space before the 2nd half of the table name Wrong: .. FROM . $table_prefix . teams this will produce FROM ccl_ teams Right: .. FROM . $table_prefix . teams this will product FROM cc_teams - jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: checkbox question
This will work: http://www.php.net/array_merge Call your checkboxes like so: a.php == form action=b.php method=post input type=checkbox name=a1 value=Abr input type=checkbox name=a2 value=Bbr input type=checkbox name=a3 value=Cbr input type=checkbox name=a4 value=Dbr input type=checkbox name=a5 value=Ebr input type=checkbox name=a6 value=Fbr input type=submit name=submit value=SUBMIT /form == then post it to the desired page and do something like this: b.php == ?php $foo = array_merge($_POST['a1'],$_POST['a2'],$_POST['a3'],$_POST['a4'],$_POST['a5'] ,$_POST['a6']); echo $foo; // Returns an array echo pre; print_r($foo); // Look whats in the array echo /pre; ? == Best of luck, Craig B.C. Lance [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... if you can't use [] for the checkbox, the only way out is to have unique name for each checkbox. otherwise, php will always be returning the value of the last checked checkbox if all checkboxes share the same name without the []. --lance Alex Shi wrote: How to ontain data from a group of checkbox using same name? For example, in a form there're 6 checkboxes and all named as Interesting_Area. I know if put a pairs of square brackets at the end of the name then in php all the values of them can be ontained. However, for some reason I cannot use square brackets. Please help me out if anyone know how to do the trick. THanks! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] random array sort
Could someone show me a quick and simple way to randomly sort array elements? I can't seem to pinpoint the correct parameters in the docs. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail() function problem
At 9/10/2002, you wrote: Hi Everyone, I did a simple test with this script: ?php mail([EMAIL PROTECTED], test, this is a test mail); echo done; ? I run the script from web accounts on different servers. I can receive the test mail from some but not from others. Is there any configurations that I am missing here? My guesses: Many mail servers are configured so that they send mail only if the sender receives mail at the same time. One other possible pitfall is that reverse IP lookup is not working correctly and your server rejects the mail as it cannot verify the sender host. Also, many (well configured) servers do not send when there is no live account for that sender. - Pekka Saarinen http://photography-on-the.net - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] random array sort
You could use array_rand() to take stuff out of the array at random and then stuff it all back into another array. -Mike -Original Message- From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 10:22 AM To: [EMAIL PROTECTED] Subject: [PHP] random array sort Could someone show me a quick and simple way to randomly sort array elements? I can't seem to pinpoint the correct parameters in the docs. Thanks! -- 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] random array sort
But if array_rand() truly pulls out random keys, how do you guarantee that you are not randomly pulling out the same key as you iterate through the array? Perhaps you could set the number of keys to return, to the size of the array, and somehow, magically, all the keys would be included in the returned array of keys. i.e. array_rand ( array , array_size) I have no idea what this would produce... -David On Tuesday, September 10, 2002, at 10:33 AM, Mike At Spy wrote: You could use array_rand() to take stuff out of the array at random and then stuff it all back into another array. -Mike -Original Message- From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 10:22 AM To: [EMAIL PROTECTED] Subject: [PHP] random array sort Could someone show me a quick and simple way to randomly sort array elements? I can't seem to pinpoint the correct parameters in the docs. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] random array sort
From what I understand about array_rand() and the example in the manual, it does only pull one of each element of the array. You could easily set up a script to compare what it is pulling to what the array you putting it into currently has in it if it didn't. -Mike -Original Message- From: David Rice [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 10:49 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] random array sort But if array_rand() truly pulls out random keys, how do you guarantee that you are not randomly pulling out the same key as you iterate through the array? Perhaps you could set the number of keys to return, to the size of the array, and somehow, magically, all the keys would be included in the returned array of keys. i.e. array_rand ( array , array_size) I have no idea what this would produce... -David On Tuesday, September 10, 2002, at 10:33 AM, Mike At Spy wrote: You could use array_rand() to take stuff out of the array at random and then stuff it all back into another array. -Mike -Original Message- From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 10:22 AM To: [EMAIL PROTECTED] Subject: [PHP] random array sort Could someone show me a quick and simple way to randomly sort array elements? I can't seem to pinpoint the correct parameters in the docs. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] random array sort
This appears to work // Normal array $a1 = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); srand((float) microtime() * 1000); $a_temp = array_rand($a1, sizeof($a1)); // Random array while (list(, $value) = each($a_temp)) { $a2[] = $a1[$value]; } print_r($a2); - jacob At 22:22 09/10/2002, you wrote: Could someone show me a quick and simple way to randomly sort array elements? I can't seem to pinpoint the correct parameters in the docs. Thanks! -- 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] Handling variables POSTed from form
I'm working on a project for a javascript class, but am having trouble with passing variables. Unfortunately, I can't do this with PHP (that would be too easy), but I have to use Javascript to do some calculations and output based on input from a form on a previous page. I am trying to understand what all I would need to access the variables from page one: index.html -- summary.html -- payment.html -- thankyou.html Order Form Order Summary CC infoThank You/Confirmation (I understand that these will become .PHP pages when I incl the PHP code) The Order Form page collects 7 variables: $state, $Widget1, $Widget2, $Widget3, $Widget4, $Widget5, $Widget6 The Summary page needs to do some calculations, but I can't access the variables (variable undefined... errors) with JavaScript: $cost1 = $Widget1 * 10.00 $cost2 = $Widget2 * 20.00 etc... $subTotal = ($cost1 + $cost2 + etc...) $shipping = ($Widget1 + $Widget2...etc) * 0.1 // fixed 10% charge $tax = $subTotal * 0.08 $total = $subTotal + $shipping + $tax What I am *trying* to do, for lack of a better idea, is on the Summary page: ?PHP import_request_variables(P); ? From here, I'm not sure what to do. Do I need to print an array? Should this be done in the HEAD of the page? Can anyone offer any suggestions here??? THANX for any/all assistance! Wm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Verify phone format?
Just wondering what the best way to validate an entered phone format is? Is anyone doing this currently? I have a form field that people enter in information and I want to force phone entries to XXX-XXX-. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] random array sort -- array() selection quant??
Thanks all for you submissions. This is what I came up with, where $this_key is a random selection from the array $the_exploded_ids. I don't know why, but, array_rand() won't work with selection quanity parameter of less than 2. Anybody know why? srand ((float) microtime() * 1000); $input = $the_exploded_ids; $rand_keys = array_rand ($the_exploded_ids, 2); $this_key=$input[$rand_keys[0]]; $this_key=trim($this_key); ROBERT MCPEAK [EMAIL PROTECTED] 09/10/02 10:22AM Could someone show me a quick and simple way to randomly sort array elements? I can't seem to pinpoint the correct parameters in the docs. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 10 Sep 2002 15:53:46 -0000 Issue 1577
php-general Digest 10 Sep 2002 15:53:46 - Issue 1577 Topics (messages 115806 through 115859): E-mail a submit 115806 by: Chuck \PUP\ Payne Re: QUery success, but blank results/variables 115807 by: Tom Rogers 115809 by: David Freeman Brainfart while uploading 115808 by: César Aracena form variables 115810 by: Hans Prins 115811 by: Chris Shiflett 115815 by: Hans Prins 115817 by: Justin French Re: LDAP (NDS) authentication example... 115812 by: joshua Need more memory... possible to set? 115813 by: Damian Harouff Re: Problems with GD 2.0.1 115814 by: Tim Re: Brainfart while uploading -- SOLVED -- Sorry ;) 115816 by: César Aracena message board and gb... 115818 by: Matt Zur Re: header(location: ) causes GET vars to be encoded in wrong charset in IE5.5 115819 by: Jean-Christian Imbeault 115825 by: Chris Shiflett 115826 by: Chris Shiflett 115827 by: . Edwin 115828 by: . Edwin Count in PHP 115820 by: Chuck \PUP\ Payne 115821 by: Martin Towell 115822 by: Tyler Longren 115823 by: Jome 115831 by: xdrag changing session name 115824 by: Mohd_Q 115830 by: Luke Welling 115833 by: Erwin Re: POST form variables not being sent to destination page 115829 by: Erwin Re: dropdown Newbie question 115832 by: Mario Ohnewald 115834 by: yasin inat Generating CSV files on the fly and getting the browser to download 115835 by: Henry 115836 by: lallous 115837 by: Henry 115838 by: Dave at Sinewaves.net 115839 by: Erwin DPHPEdit new version 115840 by: Davor Pleskina PhpMyAdmin and PHP4.2.* Too many I/Os 115841 by: Jean-Pierre Arneodo Mail() function problem 115842 by: Alva Chew 115852 by: Pekka Saarinen Re: Upload Progress 115843 by: electroteque Re: checkbox question 115844 by: B.C. Lance 115850 by: Craig Donnelly Trying to add table prefix variable to query 115845 by: Verdon Vaillancourt 115846 by: Jay Blanchard 115847 by: bbonkosk.tampabay.rr.com Populating Other People's Forms 115848 by: Mike At Spy Re: Trying to add table prefix variable to query (solved) 115849 by: Verdon Vaillancourt random array sort 115851 by: ROBERT MCPEAK 115853 by: Mike At Spy 115854 by: David Rice 115855 by: Mike At Spy 115856 by: Jacob Miller Handling variables POSTed from form 115857 by: Wm Verify phone format? 115858 by: Jeff Lewis Re: random array sort -- array() selection quant?? 115859 by: ROBERT MCPEAK Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hi, Is there a way that when someone add a submit or edits a record that I can have my php page e-mail that record? And is hard to do? Chuck Payne ---End Message--- ---BeginMessage--- Hi, Tuesday, September 10, 2002, 1:41:23 PM, you wrote: PH Hello everyone..tryin to run this qry against a mysql db, but after it runs, PH it doesn't assign anything to the variables as it should. If i return all PH rows, and spit out each record in the result in an array, i have the same PH problem, but have 24 'blank' records instead of 1. Any ideas? Thanks for any PH input. I tried doing a print mysql_error(); after the query and the result, PH but it doesn't return anything. Column names, db name, and WHERE clause are PH all spelled correctly, and the $currenttaskid is populated (as 1)... PH $detailqry = SELECT id, parentitemid, itemtypeid, itemstatusid, PH itemlevelid, shortdescription, PH createdby_memberid, assignedto_memberid, completedby_memberid, createddate, PH assigneddate, PH estcompletiondate, completeddate, projectid, lastuserid, lastdate FROM item PH WHERE id=$currenttaskid; PH $result = mysql_query($detailqry) or die(Failed finding task details); PH$taskid = $result[id]; PH$taskparentitemid = $result[parentitemid]; PH$taskitemtypeid = $result[itemtypeid]; PH$taskitemstatusid = $result[itemstatusid]; PH$taskitemlevelid = $result[itemlevelid]; PH$taskshortdescription = $result[shortdescription]; PH$createdbyid = $result[createdby_memberid]; PH$assignedtoid = $result[assignedto_memberid]; PH$completedbyid = $result[completedby_memberid]; PH$taskcreateddate = $result[createddate]; PH$taskassigneddate = $result[assigneddate]; PH$taskestcompletiondate = $result[estcompletiondate]; PH$taskcompleteddate = $result[completeddate]; PH$taskprojectid = $result[projectid]; PH
Re: [PHP] Verify phone format?
http://www.webreference.com/programming/php/regexps/5.html Here's a short article that shows how to write a function to validate an ausie phone number (2nd example). Should be easy to modify to suit. perhaps using something like ereg([0-9]{3}-[0-9]{3}-[0-9]{4}$, $phoneNum); Another at http://www.zend.com/codex.php?id=44single=1 HTH -David On Tuesday, September 10, 2002, at 11:30 AM, Jeff Lewis wrote: validate an entered phone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server date and time
Hello, When a use insert the row in a table, I'd like to know the date and time of this insertion. Is there a function to know the server date and time, not the local time user ? Bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Server date and time
Hi Christian, PHP code runs on the server, so any of the date/time functions which the language provides will give you the date/time on the server, rather than the client. HTH, Richy == Richard Black Senior Developer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 951 3481 Email: [EMAIL PROTECTED] -Original Message- From: Christian Ista [mailto:[EMAIL PROTECTED]] Sent: 10 September 2002 17:08 To: [EMAIL PROTECTED] Subject: [PHP] Server date and time Hello, When a use insert the row in a table, I'd like to know the date and time of this insertion. Is there a function to know the server date and time, not the local time user ? Bye -- 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] mysql query
I use the script below to get one value out of a database: $result = mysql_query(select euro from brandstofprijzen where id=2) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $euro = $row[euro]; } mysql_free_result($result); This is working fine, but is there an easier (less code) way to do this? Thankx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] links into DB
Hi all, I want to do this: When somebody do click in this url : http://somehost.somedomain/mailtolinks.php?id=45 the script 'mailtolinks.php' should open my e-mail client (like mailto:[EMAIL PROTECTED] sentence) Any idea? thanks Juan Pablo Aqueveque [EMAIL PROTECTED] Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] links into DB
I don't think its possible to make a normal link open the default email as mailto: is a special trigger built into the browsers. The only way I can think of would be using javascript in the page.. something like body onLoad=document.location='mailto:[EMAIL PROTECTED]'; /body - jacob At 18:51 09/10/2002, Juan Pablo Aqueveque wrote: Hi all, I want to do this: When somebody do click in this url : http://somehost.somedomain/mailtolinks.php?id=45 the script 'mailtolinks.php' should open my e-mail client (like mailto:[EMAIL PROTECTED] sentence) Any idea? thanks Juan Pablo Aqueveque [EMAIL PROTECTED] Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628 -- 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] links into DB
Oh yeah ...I thought this same, I simply wanted to know if somebody could give a better solution. Thank you for your quick answer Jacob!.. greetings!, --jp At 00:55 11-09-2002 +0800, Jacob Miller wrote: I don't think its possible to make a normal link open the default email as mailto: is a special trigger built into the browsers. The only way I can think of would be using javascript in the page.. something like body onLoad=document.location='mailto:[EMAIL PROTECTED]'; /body - jacob At 18:51 09/10/2002, Juan Pablo Aqueveque wrote: Hi all, I want to do this: When somebody do click in this url : http://somehost.somedomain/mailtolinks.php?id=45 the script 'mailtolinks.php' should open my e-mail client (like mailto:[EMAIL PROTECTED] sentence) Any idea? thanks Juan Pablo Aqueveque [EMAIL PROTECTED] Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Juan Pablo Aqueveque [EMAIL PROTECTED] Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] mysql query
Try mysql_result(); in place of that entire while() loop. http://www.php.net/manual/en/function.mysql-result.php Also there's no reason for you to use mysql_free_result() unless you're going to be performing multiple massive SELECTS before the script exits. -Kevin - Original Message - From: Chris Schoeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 10:53 AM Subject: [PHP] mysql query I use the script below to get one value out of a database: $result = mysql_query(select euro from brandstofprijzen where id=2) or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $euro = $row[euro]; } mysql_free_result($result); This is working fine, but is there an easier (less code) way to do this? Thankx -- 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] Need more memory... possible to set?
Several ways: (1) PHP still reads a php.ini file, so you could set it there; try a php -i | grep php.ini to find out where the commandline php thinks it is (and/or do php -i | grep memory_limit to find the default memory limit setting. (2) You can set it at execution time via the -d command option: php -d memory_limit=20M -f yourprogram.php (3) Set it in your program with the ini_set() command: http://php.he.net/manual/en/function.ini-set.php -steve At 11:29 PM -0500 9/9/02, Damian Harouff wrote: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 53738 bytes) in /var/cli/mp3anal/mp3anal.php on line 68. Segmentation fault This is line 68: while ($found = fscanf ($fp, %s - - [%[A-Za-z0-9/]:%[0-9:] %[+-0-9]] \%[A-Z-] %s %[A-Z0-9/.]\ %[0-9-] %[0-9-]\n, $ip, $date, $time, $ofset, $request, $file, $protocol, $code, $bytes)) { Since this is a command line program, is it possible to set the memory allocation higher? It's a program to read the mp3 lines out of an apache log file. This is the entire program: http://www.cekkent.net/upload/mp3anal/mp3anal.phps -- ++ | Steve Edberg [EMAIL PROTECTED] | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | ++ | The end to politics as usual: | | The Monster Raving Loony Party (http://www.omrlp.com/) | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strore Data in File
Hi I want to store the data of a table in a file and read that file just as one would read a table. For e.g. I have a table t_data with cols name,number,cost and my data file data.txt would have the following data: --- john,1,100 mark,2,200 spencer,3,200 --- Now on the web page when the visitor clicks on a link on john then this file (data.txt) must be read and the data should be displayed for john i.e. name = john number = 1 cost = 100 must be displayed Can anyone please give me the code to parse this file and read the data for john and get all the data for that row. Please see that john functions as the primary key in the table Regards Ram __ Give your Company an email address like ravi ravi-exports.com. Sign up for Rediffmail Pro today! Know more. http://www.rediffmailpro.com/signup/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] links into DB
It's a GET request right? So it'll be just like any other Location header. mailtolinks.php will contain.. ? extract($_GET); // get email $addy that corresponds to $id. // header(Location: mailto:$addy;); ? -Kevin - Original Message - From: Juan Pablo Aqueveque [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 4:51 AM Subject: [PHP] links into DB Hi all, I want to do this: When somebody do click in this url : http://somehost.somedomain/mailtolinks.php?id=45 the script 'mailtolinks.php' should open my e-mail client (like mailto:[EMAIL PROTECTED] sentence) Any idea? thanks Juan Pablo Aqueveque [EMAIL PROTECTED] Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628 -- 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] Server date and time
If you are using mysql, you can use the NOW() function to insert the time into a date field. It will insert the time that is on the server's clock. Adam On Tue, 10 Sep 2002, Christian Ista wrote: Hello, When a use insert the row in a table, I'd like to know the date and time of this insertion. Is there a function to know the server date and time, not the local time user ? Bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ODBC text file connection problem
Good morning... I've got one for ya. I've been trying to conenct to a csv text file = (comma delimited, \r\n row separators, and text qualifiers) using the = odbc_connect command and then run simple select statements through it. = It doesn't work and I'm at a loss for why. Here's the meat (I replace = anything potentially sensitive with ***): ODBC connection: Microsoft text driver version 4.00.6200.00 Win2K IIS = 5.0. ODBC schema: I have specified, for the particular file I am trying to = connect to, column name headers and ANSI format. That's it... // ODBC PHP connect string:=20 $odbc =3D odbc_connect(***input,,); // This appears to work as no = errors are reported // ODBC commands to explore connection: $result =3D odbc_tables($odbc); odbc_fetch_into($result,$row); print_r($row); // I get the following output to the screen: Array ( [0] =3D ***:\***\***\*** [1] =3D [2] =3D inputfile.txt [3] = =3D TABLE [4] =3D )=20 // Further commands to select data from text file: $result =3D odbc_exec($odbc,SELECT * FROM inputfile.txt); // ERROR to screen: Warning: SQL error: [Microsoft][ODBC Text Driver] The Microsoft Jet = database engine cannot open the file '(unknown)'. It is already opened = exclusively by another user, or you need permission to view its data., = SQL state S1000 in SQLExecDirect in ***:\***\***\***\basecsv2.html on = line 53 PHP Warning: SQL error: [Microsoft][ODBC Text Driver] The Microsoft Jet = database engine cannot open the file '(unknown)'. It is already opened = exclusively by another user, or you need permission to view its data., = SQL state S1000 in SQLExecDirect in ***:\***\***\***\basecsv2.html on = line 53=20 Any ideas? -Ethan, Modulus, LLC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.2.3, apache 2.0.40 file access problem
Hi Folks, I upgraded to 4.2.3, but am having file access problems. Here's the code that fails: $file = test; if(!is_readable(getcwd() . / . $file))... // works if(!is_readable($file))... // fails If I access a file by full path, it works fine. If I access a file in the local dir, it fails. Even though getcwd() is the same as the full path above. I've combed through httpd.conf and php.ini but could not find the culprit. Any ideas? Thanks Cheers, -Vadim PS: Configuration: RedHat 7.2 Apache 2.0.40 PHP 4.2.3 './configure' '--with-mysql' '--with-apache2=/usr/local/apache2' '--with-apxs2=/usr/local/apache2/bin/apxs' php.ini: ;open_basedir = safe_mode = Off disable_functions = register_globals = On doc_root = extension_dir = ./ ; cgi.force_redirect = 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ODBC text file connect problem
Good morning... I've got one for ya. I've been trying to conenct to a csv text file (comma delimited, \r\n row separators, and text qualifiers) using the odbc_connect command and then run simple select statements through it. It doesn't work and I'm at a loss for why. Here's the meat (I replace anything potentially sensitive with ***): ODBC connection: Microsoft text driver version 4.00.6200.00 Win2K IIS 5.0. ODBC schema: I have specified, for the particular file I am trying to connect to, column name headers and ANSI format. That's it... // ODBC PHP connect string: $odbc = odbc_connect(***input,,); // This appears to work as no errors are reported // ODBC commands to explore connection: $result = odbc_tables($odbc); odbc_fetch_into($result,$row); print_r($row); // I get the following output to the screen: Array ( [0] = ***:\***\***\*** [1] = [2] = inputfile.txt [3] = TABLE [4] = ) // Further commands to select data from text file: $result = odbc_exec($odbc,SELECT * FROM inputfile.txt); // ERROR to screen: Warning: SQL error: [Microsoft][ODBC Text Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLExecDirect in ***:\***\***\***\basecsv2.html on line 53 PHP Warning: SQL error: [Microsoft][ODBC Text Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLExecDirect in ***:\***\***\***\basecsv2.html on line 53 Any ideas? -Ethan, Modulus, LLC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ODBC text file connection problem
[snip] I've got one for ya. I've been trying to conenct to a csv text file = (comma delimited, \r\n row separators, and text qualifiers) using the = odbc_connect command and then run simple select statements through it. = It doesn't work and I'm at a loss for why. [/snip] Why not use fopen()? A CSV file is a plain text file and therefore cannot be treated as a database. The CSV file has no data engine with which to connect to. HTH! Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ODBC text file connection problem
I actually do use fopen to connect to the file and create a table based on the column names I gather from the first line. However, actaully parsing through the file and trying to dynamically create insert statements for each row seems like it would be a regular expression nightmare. I really can't guarantee the format of the csv in any way that is easy to work with... for instance, the first data line might look like this: 2,Ethan Nelson,My favorite quote is To hell with them.,just a test\r\n As you can see, If I'm going to preserve the double quotes in the third column, I would have to come up with a script that would deal with escaped characters. I was hoping that I could just establish an ODBC connection to the text file, which it appears that I can, and then select stuff from it. Microsoft's documentation that I could find states that their text driver doesn't support create/drop table, insert, or update commands (obviously), but it doesn't mention SELECT as being off limits... -Ethan -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 11:48 AM To: Ethan Nelson; [EMAIL PROTECTED] Subject: RE: [PHP] ODBC text file connection problem [snip] I've got one for ya. I've been trying to conenct to a csv text file = (comma delimited, \r\n row separators, and text qualifiers) using the = odbc_connect command and then run simple select statements through it. = It doesn't work and I'm at a loss for why. [/snip] Why not use fopen()? A CSV file is a plain text file and therefore cannot be treated as a database. The CSV file has no data engine with which to connect to. HTH! Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ODBC text file connection problem
[snip] As you can see, If I'm going to preserve the double quotes in the third column, I would have to come up with a script that would deal with escaped characters. I was hoping that I could just establish an ODBC connection to the text file, which it appears that I can, and then select stuff from it. Microsoft's documentation that I could find states that their text driver doesn't support create/drop table, insert, or update commands (obviously), but it doesn't mention SELECT as being off limits... [/snip] The quotes should not be a problem as you could use addslashes() to escape them. On your connection you say that it does not return an error; $odbc =3D odbc_connect(***input,,); // This appears to work as no = errors are reported But you're not testing for errors $odbc =3D odbc_connect(***input,,) OR die(There is an error connecting to the CSV file.); Make sure that you trap every potential error. Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ODBC text file connection problem
I know that the connection works because the following command ODBC_tables into which I feed my connection accurately searches the connection and returns an array with some table information. [snip] // ODBC commands to explore connection: $result = odbc_tables($odbc); odbc_fetch_into($result,$row); print_r($row); // I get the following output to the screen: Array ( [0] = ***:\***\***\*** [1] = [2] = inputfile.txt [3] = TABLE [4] = ) [/snip] inputfile.txt in row 2 is the file I want to select from. Just for kicks, I added the OR DIE and got nothing. I'm pretty sure that I have created a valid ODBC system resource and that my ODBC_connect command succesfully creates a bridge to my materials. Its just that I can't execute commands beyond the odbc_tables without getting this big nasty error: [snip] $result = odbc_exec($odbc,SELECT * FROM inputfile.txt); [/snip] Warning: SQL error: [Microsoft][ODBC Text Driver] The Microsoft Jet database engine \ cannot open the file '(unknown)'. It is already opened exclusively by another user, \ or you need permission to view its data., SQL state S1000 in SQLExecDirect in \ ***:\***\***\***\basecsv2.html on line 53 -Ethan -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 12:03 PM To: Ethan Nelson; [EMAIL PROTECTED] Subject: RE: [PHP] ODBC text file connection problem [snip] As you can see, If I'm going to preserve the double quotes in the third column, I would have to come up with a script that would deal with escaped characters. I was hoping that I could just establish an ODBC connection to the text file, which it appears that I can, and then select stuff from it. Microsoft's documentation that I could find states that their text driver doesn't support create/drop table, insert, or update commands (obviously), but it doesn't mention SELECT as being off limits... [/snip] The quotes should not be a problem as you could use addslashes() to escape them. On your connection you say that it does not return an error; $odbc =3D odbc_connect(***input,,); // This appears to work as no = errors are reported But you're not testing for errors $odbc =3D odbc_connect(***input,,) OR die(There is an error connecting to the CSV file.); Make sure that you trap every potential error. Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help, Parse error caused by quotes andapostrophes in function, How do I fix this?
The following is the format needed in order to run the convert command from command line, but I have a problem in exec() format: convert picture.jpg -font Arial-Bold -pointsize 20 -fill red -gravity southeast -draw text 10,10 'my text to add to picture' text-overlay.jpg this causes problems Parse error: parse error, unexpected T_STRING: exec('convert picture.jpg -font Arial-Bold -pointsize 20 -fill red -gravity southeast -draw text 10,10 'my text to add to picture' text-overlay.jpg'); I am positive the it is due to all the s and 's within the command, I have tried the specialchars for quotes andapostrophes but I am still missing something: exec('convert picture.jpg -font Arial-Bold -pointsize 20 -fill red -gravity southeast -draw quottext 10,10 \'my text to add to picture\'quot text-overlay.jpg'); If anyone has any ides on how to avoid probles with quotes andapostrophes inside the exec() I am all ears :o) Thanks --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.386 / Virus Database: 218 - Release Date: 9/9/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ODBC text file connection problem
[snip] // ODBC commands to explore connection: $result = odbc_tables($odbc); odbc_fetch_into($result,$row); print_r($row); [/snip] Have you tried a WHILE loop to print out each row? I am not sure of the exact syntax but something like; ?php while(odbc_fetch_into($result, $fields)){ print($fields[0]); print($fields[1]); // and so on ... print(br\n); //at end of row } ? Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- 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] dropdown Newbie question
Hi Mario, you can set error_reporting to E_ALL to give you more hints to bugs and to produce clean code. You are having two problems. The first was related to your form and has been addressed by Yasin. The second is that you have autoglobals off. That means you have to use $_SERVER['PHP_SELF']. BTW: You could have found this error by reading about predefined variables, PHP_SELF in the manual. Timo Working: ?php echo ' form name=test action='.$_SERVER['PHP_SELF'].' method=POSTbr select name=color id=colorPicker onChange=changeColor(this.options[this.selectedIndex].value) optionBackground Color option value=FFBlue option value=FFRed option value=00FF00Green option value=00Black /select input type=submit value=Click To View Submission /form '; if(isset($_POST['color'])) {echo $_POST['color'];} ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compiling as BOTH DSO and CGI under apache.
Hi Dan, I am not able to answer your question directly, but maybe you could simply use the CLI command 'chown' to change the owner of the files? Timo Am Dienstag den, 10. September 2002, um 03:35, schrieb [EMAIL PROTECTED]: I need to build php as a CGI for some scripts that need to run as the user (image gallery scripts, where safe mode isn't enough to write to user directories, I need the files written AS a user, and chmodding the directory 6777 is just nuts.). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server date and time
Hi Christian, Assuming that you use MySQL: Read up 6.2.2.2 The DATETIME, DATE, and TIMESTAMP Types in the MySQL manual. Hint: Add a column to hold the timestamps. Timo Am Dienstag den, 10. September 2002, um 18:08, schrieb Christian Ista: When a use insert the row in a table, I'd like to know the date and time of this insertion. Is there a function to know the server date and time, not the local time user ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
Hi Mario, you can set error_reporting to E_ALL to give you more hints to bugs and to produce clean code. You are having two problems. The first was related to your form and has been addressed by Yasin. The second is that you have autoglobals off. That means you have to use $_SERVER['PHP_SELF']. BTW: You could have found this error by reading about predefined variables, PHP_SELF in the manual. Timo Working: ?php echo ' form name=test action='.$_SERVER['PHP_SELF'].' method=POSTbr select name=color id=colorPicker onChange=changeColor(this.options[this.selectedIndex].value) optionBackground Color option value=FFBlue option value=FFRed option value=00FF00Green option value=00Black /select input type=submit value=Click To View Submission /form '; if(isset($_POST['color'])) {echo $_POST['color'];} ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ODBC text file connection problem
So this code: $odbc = odbc_connect(cvalcoinput,,) OR die(There is an error connecting to the CSV file.); $result = odbc_tables($odbc); while(odbc_fetch_into($result, $fields)){ for ($i = 0; $i sizeof($fields); $i++) { echo $fields[$i] . br; } } Derives the following results: D:\INETPUB\CVALCO\INCLUDE\INPUT inputfile.txt TABLE Which makes sense. Those are the contents of the array returned by odbc_tables. Now try to use odbc_exec and I run into my problems. This article on the microsoft KB seems to suggest under text driver limitations that I should be able to run select statements using the odbc_exec command. http://support.microsoft.com/default.aspx?scid=kb;en-us;Q178717 Anyone know of any really good ODBC resources? -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 12:29 PM To: Ethan Nelson; [EMAIL PROTECTED] Subject: RE: [PHP] ODBC text file connection problem [snip] // ODBC commands to explore connection: $result = odbc_tables($odbc); odbc_fetch_into($result,$row); print_r($row); [/snip] Have you tried a WHILE loop to print out each row? I am not sure of the exact syntax but something like; ?php while(odbc_fetch_into($result, $fields)){ print($fields[0]); print($fields[1]); // and so on ... print(br\n); //at end of row } ? Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- 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] ODBC text file connection problem
[snip] $odbc = odbc_connect(cvalcoinput,,) OR die(There is an error connecting to the CSV file.); $result = odbc_tables($odbc); while(odbc_fetch_into($result, $fields)){ for ($i = 0; $i sizeof($fields); $i++) { echo $fields[$i] . br; } } Derives the following results: D:\INETPUB\CVALCO\INCLUDE\INPUT inputfile.txt TABLE [/snip] I think that you need to have $fields in your fetch_into statement. Unfortunately I do not know of any good ODBC reference materials when it comes to ODBC. I am sure that you Googled for it and had a look at the manual, so I don't know where to point you now. Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Help, Parse error caused by quotes andapostrophes in function, How do I fix this?
Hi. Try the backticks (execution) operator instead so you're not fighting yourself with quotes. I think it should work but this is untested. Let me know if it doesn't.. $out = `convert picture.jpg -font Arial-Bold -pointsize 20 -fill red -gravity southeast -draw text 10,10 'my text to add to picture' text-overlay.jpg`; -Kevin - Original Message - From: Kurtis Harper [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 5:35 PM Subject: [PHP] Help, Parse error caused by quotes andapostrophes in function, How do I fix this? The following is the format needed in order to run the convert command from command line, but I have a problem in exec() format: convert picture.jpg -font Arial-Bold -pointsize 20 -fill red -gravity southeast -draw text 10,10 'my text to add to picture' text-overlay.jpg this causes problems Parse error: parse error, unexpected T_STRING: exec('convert picture.jpg -font Arial-Bold -pointsize 20 -fill red -gravity southeast -draw text 10,10 'my text to add to picture' text-overlay.jpg'); I am positive the it is due to all the s and 's within the command, I have tried the specialchars for quotes andapostrophes but I am still missing something: exec('convert picture.jpg -font Arial-Bold -pointsize 20 -fill red -gravity southeast -draw quottext 10,10 \'my text to add to picture\'quot text-overlay.jpg'); If anyone has any ides on how to avoid probles with quotes andapostrophes inside the exec() I am all ears :o) Thanks --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.386 / Virus Database: 218 - Release Date: 9/9/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Escape characters won't go away
Well, I appreciate your input. But the backslashes are (well, were) there. And I wasn't putting them in. Here's what the sequence was: If you leave the default of Magic Quotes on in php.ini, you are adding the backslashes on every GET/POST/COOKIE data element as it comes in. I have a form that an administrator fills out to send an email newsletter. Magic Quotes will add one set of backslashes at that point, for the POST which it assumes you are putting into a database, since that's what 90% of PHP scripts do. Take GET/POST data, stuff it into a database. The form has a confirmation page that it submits to. At this point the At this point, you are writing out an HTML page with the extra set of backslashes that Magic Quotes added. You should have stripslashes() on the data that you dump out to the confirmation page. Also, use htmlentities to convert any HTML special characters to their HTML character entities so they don't mess up your HTML. admin either goes back to make changes or submits the text and subject to be sent out as a newsletter. It is on this page that the data gets stuck into Now, on *this* page, the Magic Quotes is actually helping you, since you can stuff the data into the database and it's already had the addslashes done to it. Magic Quotes essentially just calls addslashes on every GET/POST/COOKIE datum *for* you. the database (mysql). If the user hits 'send email' button the next page retrieves the data from the database, and sends out emails based on what it gets in the database, after a call to stripslashes. What was coming in the If you have correctly managed your data throughout the application path from input to MySQL, then once you have inserted your data to MySQL, there should be no bogus/extra backslashes in it. You should *NOT* need, in general, to call stripslashes on data coming *out* of MySQL. If you do, you did something wrong a long, long time ago when you inserted it or collected it. mail had three! backslash characters behind everything mysql had escaped. More stripslashes calls did nothing, the ereg_replaces you reviewed did nothing. Oddly, the solution turned out to be $text = ereg_replace([\\]+, , $text); While I'm happy this works for you, it's a very grungy hack that only masks the real problem, which is described above. which would seem to me to be functionally equivalent to either of the calls that didn't work, but somehow PHP liked it better. The data you gave on why \\ wouldn't work as a regex didn't quite make sense to me, as PHP turning that into \ was exactly what I was looking for. Theoretically, that You had \\ and \\, both of which are incorrect. By enclosing the \\ inside of [], Regex apparently automatically understands that you mean the character \ rather than treating \ as special, which is does if you have just \. Your original \\ in PHP turns into \ in Regex, as I described. And \\ turns into \\\ in the same way. should then match every \ character in the string, but it didn't manage to find any - in fact it just gave the error message, and I still don't know why. Why wouldn't PHP then just match the \ characters? Doesn't make sense. \ is a special character in PHP strings. When you have \ in PHP, it's just inherently wrong though you can get away with it. But if you have \\ it turns into \ internally. http://www.php.net/manual/en/language.types.string.php \ is *ALSO* a special character in Regex. So if you want to get *ONE* \ in Regex, you need in PHP. And I'm frankly still a bit of a loss as to where they came from in the first place. Perhaps HTML added a set, then PHP escaped those, then mysql figured it had better escape them all. I don't know. I tried turning magic_quotes off for the script's execution, but this did not cut down on the number. Before the initial call to stripslashes() there were actually SIX of them in a row, stripslashes() cut that to 3, but then refused to shave them further. If changing Magic Quotes to off only lost half the \'s, then you almost for sure have an addslashes in your code *SOMEWHERE*. It might be buried in some database class you are using, but it's there. Why? Ya got me. I know why. Perhaps this time around you'll actually me... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Questions regarding inserting and updating data into a MySQL db
Hi, I'm developing a web application that uses forms for user input and then after each form is filled shows something like Welcome Bob to our site ... bla. bla... inserts data in a table and on the same page continues with the rest of the data, and goes to another form and so on. I have no problems inserting the data from the first form in the table,display the personalized message, and then connect to the mySQL db, my problem is some fields in the table which must be filled are null in this first instance, and then on the second form they are filled, but my I don´t know how can I fill the gaps and leave all the data in one row, because the first field auto increments, and I'm worriedthe data instead of filling one row spreads accross two or three. i.e First: Bob Last: Evans //user submits form ///On the second form says "Welcome Bob Evans and congratulations ... bla bla ..." // inserts data into table // Then asks for more data Address : Somewhere 555 Ocupation: Something // user submits form // data is inserted into the table and the gaps are filled or is updated ? here is what I don't know if data is still on the same row and effectively filled the gaps, or it is inserted into another road ... using insert or update ? Thanks for your tips TIA Rick __ICQ#:37031810 Current ICQ status: + More ways to contact me __
Re: [PHP] Strore Data in File
RK, this is ultra-basic stuff. Opening and dealing with files is one of the first things you learn with any language. I would highly recommend buying a beginners guide to PHP book and learning thist stuff on your own. But for now this will get you started... ? //Open a file into an array.. $rows = file('table.txt'); //Separate each row into fields.. for ($i=0; $icount($rows); $i++) { $table[] = explode(',', $rows[$i]); } //Print table.. echo table border=2\n; for ($i=0; $icount($table); $i++) { echo tr\n; for ($j=0; $jcount($table[$i]);$j++) { echo td.$table[$i][$j]./td\n; } echo /tr\n; } echo /table; ? Good luck. -Kevin - Original Message - From: Ram K [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 11:29 AM Subject: [PHP] Strore Data in File Hi I want to store the data of a table in a file and read that file just as one would read a table. For e.g. I have a table t_data with cols name,number,cost and my data file data.txt would have the following data: --- john,1,100 mark,2,200 spencer,3,200 --- Now on the web page when the visitor clicks on a link on john then this file (data.txt) must be read and the data should be displayed for john i.e. name = john number = 1 cost = 100 must be displayed Can anyone please give me the code to parse this file and read the data for john and get all the data for that row. Please see that john functions as the primary key in the table Regards Ram __ Give your Company an email address like ravi @ ravi-exports.com. Sign up for Rediffmail Pro today! Know more. http://www.rediffmailpro.com/signup/ -- 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] Strore Data in File
Example (not tested) $fp = fopen('file.csv', 'r'); // open file for reading while ($data = fgetcsv ($fp, 1000, ,)) { // read each line of file if ($data[1] == $key) { // determine if key matches the current row $name = $data[1]; // assign information to variables break; // quit the while loop and continue the script } } Where $name = $data[1] is where you would assign the information to variables or an array or call a function with the parameters you want. This is going to be considerably slower than using a database server. Jason -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 2:25 PM To: Ram K; [EMAIL PROTECTED] Subject: Re: [PHP] Strore Data in File RK, this is ultra-basic stuff. Opening and dealing with files is one of the first things you learn with any language. I would highly recommend buying a beginners guide to PHP book and learning thist stuff on your own. But for now this will get you started... ? //Open a file into an array.. $rows = file('table.txt'); //Separate each row into fields.. for ($i=0; $icount($rows); $i++) { $table[] = explode(',', $rows[$i]); } //Print table.. echo table border=2\n; for ($i=0; $icount($table); $i++) { echo tr\n; for ($j=0; $jcount($table[$i]);$j++) { echo td.$table[$i][$j]./td\n; } echo /tr\n; } echo /table; ? Good luck. -Kevin - Original Message - From: Ram K [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 11:29 AM Subject: [PHP] Strore Data in File Hi I want to store the data of a table in a file and read that file just as one would read a table. For e.g. I have a table t_data with cols name,number,cost and my data file data.txt would have the following data: --- john,1,100 mark,2,200 spencer,3,200 --- Now on the web page when the visitor clicks on a link on john then this file (data.txt) must be read and the data should be displayed for john i.e. name = john number = 1 cost = 100 must be displayed Can anyone please give me the code to parse this file and read the data for john and get all the data for that row. Please see that john functions as the primary key in the table Regards Ram __ Give your Company an email address like ravi @ ravi-exports.com. Sign up for Rediffmail Pro today! Know more. http://www.rediffmailpro.com/signup/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What these two things mean: __FILE__ and __LINE__
What these two things mean: __FILE__ and __LINE__ ? I searched manul but find nothing about them... Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] What these two things mean: __FILE__ and __LINE__
http://www.php.net/manual/en/language.constants.php -Kevin - Original Message - From: Alex Shi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 2:31 PM Subject: [PHP] What these two things mean: __FILE__ and __LINE__ What these two things mean: __FILE__ and __LINE__ ? I searched manul but find nothing about them... Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- 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 these two things mean: __FILE__ and __LINE__
I read the link, still don't get what are the exact meaning of those two things. What the link refered is a section from PHP manul that I have a copy on my local computer, and to me it doesn't seems like a formal defination of them. From the messages appending to the ariticle I saw one more thing don't understand: __PATH__. Alex Kevin Stone [EMAIL PROTECTED] wrote in message 008801c2590a$28d7ede0$6501a8c0@kevin">news:008801c2590a$28d7ede0$6501a8c0@kevin... http://www.php.net/manual/en/language.constants.php -Kevin - Original Message - From: Alex Shi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 2:31 PM Subject: [PHP] What these two things mean: __FILE__ and __LINE__ What these two things mean: __FILE__ and __LINE__ ? I searched manul but find nothing about them... Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Web based FTP client
Mark McCulligh wrote: I am trying to build or find a web FTP client. I can create a server side FTP app in PHP no problem, but I would like the user to be able to browse their own file system. I thought about using upload functions with PHP FTP functions on the server but I didn't want just an input box with a browse button on the screen. I have also search though JavaScript for FTP functions but I didn't see anything that would really work. I want it to look like a windows based FTP client a list box on one site for the user's file system and a list box on the other for the ftp server. Does anyone know of a good web FTP program in exists or point me in the right direction on how to build one.. I don't think JavaScript gives you this kind of power. I imagine you'd either need to take advantage of Java on the client, or perhaps something based on a cross-platform toolkit like Mozilla. I expect you could build something like what you want with Mozilla's XUL and JavaScript. Thanks, Mark. _ Mark McCulligh, Application Developer / Analyst Sykes Canada Corporation www.SykesCanada.com [EMAIL PROTECTED] -- --- Jonathan Abbey[EMAIL PROTECTED] Applied Research Laboratories The University of Texas at Austin Ganymede, a GPL'ed metadirectory for UNIX http://www.arlut.utexas.edu/gash2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating Other People's Forms
It sounds like you need to look into using cURL. It helps with automated posting. Now, you need to first determine whether the forms in question use a method of get or post before deciding how to proceed. If they use get, you can simply use a series of fopen() calls with the appropriate parameters on the URL. If they use post, you should look at cURL to see if it will handle your needs. Happy hacking. Chris Mike At Spy wrote: I would like to write a script that would populate someone else's form on the net and get the results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help getting count to show up.
Hi, Last night I asked for help doing counts. One of the answers I got was really great but I can't make it work. The answer I more or less show me a great way to create a stats page, ex. SELECT feild1, field2, COUNT(*) FROM tables GROUP BY category, format. But my problem is I can't get count to show. I can get two of the fields. Below is the PHP program that I am wanting to run. How can I get count to show? Thanks. Chuck Payne Magi Design and Support ? $db = mysql_connect('localhost','user','passwd'); mysql_select_db('media',$db); $result =mysql_query(SELECT category, format, COUNT(*) FROM library GROUP BY category, format,$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are no records to display do { printf(%s %s %sbr, $myrow[category], $myrow[format], $myrow[count]); } while ($myrow = mysql_fetch_array($result)); } else { // no record to display echo 'Sorry no records were found!'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help getting count to show up.
SELECT feild1, field2, COUNT([insert field name here]) FROM tables GROUP BY category,format --or-- SELECT feild1, field2, COUNT([insert field name here]) as mycount FROM tables GROUP BY category,format -Original Message- From: Chuck Payne [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 3:25 PM To: [EMAIL PROTECTED] Subject: [PHP] Help getting count to show up. Hi, Last night I asked for help doing counts. One of the answers I got was really great but I can't make it work. The answer I more or less show me a great way to create a stats page, ex. SELECT feild1, field2, COUNT(*) FROM tables GROUP BY category, format. But my problem is I can't get count to show. I can get two of the fields. Below is the PHP program that I am wanting to run. How can I get count to show? Thanks. Chuck Payne Magi Design and Support ? $db = mysql_connect('localhost','user','passwd'); mysql_select_db('media',$db); $result =mysql_query(SELECT category, format, COUNT(*) FROM library GROUP BY category, format,$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are no records to display do { printf(%s %s %sbr, $myrow[category], $myrow[format], $myrow[count]); } while ($myrow = mysql_fetch_array($result)); } else { // no record to display echo 'Sorry no records were found!'; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reading email from stdin
I am working on code that will allow me to read email that is directed to a PHP script (via .forward files) for various purposes, as part of an integrated Intranet project. I have hacked a bit at it and came up with code that works for the tests I can throw at it, but I'm not confident enough with my understanding of SMTP to put my code into live use. The most difficult part I've had is preserving the headers so that they can be individually edited but also reconstructed to forward the mail to another address. My question then, is: - does anyone know of any code libraries that exhibit the kind of functionality I'm talking about (the ability to read a mail message from stdin and store it in variables or as an object) Or, if there is no such code already written - is there anyone on this list who is very familiar with SMTP and would be willing to look over my code and point out all the things I am probably to be missing? Thanks - Matt Miller [EMAIL PROTECTED] PS - Having posed that question, I decided to go look at the source for Mailman and Majordomo before I sent it. It seems they both use a C wrapper for running the scripts that receive mail. Does anyone know why that is - security? Performance? Or something else... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache compile
Hello, I am currently working on compilling php as both a cgi ands as an apache module on the same server. The cgi compile, which I did first with ./configure --with-ldap={ldap dir} --with-mysql, went jsut fine. However, when I try to compile it as an apache module, both as ./configure --with-ldap={ldap dir} --with-mysql --with-apxs or ./configure --with-ldap={ldap dir} --with-mysql --with-apache={src}, I get errors when trying to load a page. The following is my php file I try to open in a browser called phpinfo.php php? echo hi; ? And this generates the following error: warning: failed opening '/usr/web/phpinfo.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0 Any help would be great. William F. Allmendinger Network Manager University of Detroit Mercy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help getting count to show up.
ex. SELECT feild1, field2, COUNT(*) FROM tables GROUP BY category, format. Try this instead: SELECT field1, field2, COUNT(*) AS field3 FROM TABLS GROUP BY category,format Now you'll find your count is available as 'field3'. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Apache compile
Did you delete the config.cache file in the PHP directory after the first configure, make, make install, and make clean commands? Did you add the appropriate info into apache's httpd.conf file so that is knows what .php files are and what to parse them with? Did you add the appropriate command to the top of your PHP page that will be run through as a CGI ( #!/usr/local/bin/php || that should not be inside of any PHP tags...just at the tip top of your page)? Answering these questions will help us solve your problem. ~ Matthew -Original Message- From: William Allmendinger [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 7:04 PM To: [EMAIL PROTECTED] Subject: [PHP] Apache compile Hello, I am currently working on compilling php as both a cgi ands as an apache module on the same server. The cgi compile, which I did first with ./configure --with-ldap={ldap dir} --with-mysql, went jsut fine. However, when I try to compile it as an apache module, both as ./configure --with-ldap={ldap dir} --with-mysql --with-apxs or ./configure --with-ldap={ldap dir} --with-mysql --with-apache={src}, I get errors when trying to load a page. The following is my php file I try to open in a browser called phpinfo.php php? echo hi; ? And this generates the following error: warning: failed opening '/usr/web/phpinfo.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0 Any help would be great. William F. Allmendinger Network Manager University of Detroit Mercy -- 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] Dependent Dropdown Boxes
The Situation: I'm trying to create a pair of dynamic dropdown boxes where the options in the second box are dependent on the selection in the first box. I call the first box categories and the second, subcategories. I want to store the categories and subcategories in a mysql table(s) so that a user can dynamically update them. Currently, I have a single table called categories, with columns: id, category, and subcategory. The primary code for selecting the options for the second box is in javascript. This code makes use of the following datasets for storing the various categories and subcategories. If I can get php to generate this text, then the dependent boxes will work. datasets=new Array(); datasets[0]=Category1,subCategory1_1,subCategory1_2,subCategory1_3,subCateg ory1_4.split(,); datasets[1]=Category2,subCategory2_1,subCategory2_2,subCategory2_3.split( ,); datasets[2]=Category3,subCategory3_1, subCategory3_2, subCategory3_3,subCategory3_4,subCategory3_5.split(,); datasets[3]=Category4,subCategory4_1,subCategory4_2,subCategory4_3,subCateg ory4_4.split(,); datasets[4]=Category5,subCategory5_1,subCategory5_2,subCategory5_3,subCateg ory5_4,subCategory5_5,subCategory5_6.split(,); etc The Problem: Using the following code I can get php to print the results, but only in a line-by-line, category/subcategory format. Of course, this is NOT what is needed. Each subcategory name should be on the same line as its associated category. ?php $dbConnect = mysql_connect(localhost, root, pwd); mysql_select_db(new_kb,$dbConnect); $sql = SELECT * from categories; $result = mysql_query($sql); for ($count = 1; $row = mysql_fetch_row ($result); ++$count) { print brdatasets[$count]=\; print $row[1],; print $row[2]\; } ? datasets[0]=Category1,subCategory1_1 datasets[1]=Category1,subCategory1_2 datasets[2]=Category1,subCategory1_3 datasets[3]=Category1,subCategory1_4 datasets[4]=Category2,subCategory2_1 datasets[5]=Category2,subCategory2_2 etc Can someone explain how to write the php code to output the category and subcategory names from the mysql table to match the javascript format above. Thanks in advance for any help or suggestions. Roger Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Confusing array question ...
Hi, I have 1 primary array called $item containing 20 values each of whose value is part of the name of 20 other arrays containing various number of values. How can I cycle through the primary $item array using a foreach and within that do a for on each of the 20 secondary arrays dynamically inserting each of the 20 secondary array names based on the value of the current primary $item array. Something like the following which obviously does not work. ?php foreach($item as $value) { // do some stuff for($i=0; $icount($beginning_of_array_name_always_the_same . $value . end_of_array_name_always_the_same); $i++) { // do some stuff } } ? I am trying to avoid doing something like the following ... ?php foreach($item as $value) { // do some stuff if($value == 'red'){ $array = $temp_red_file; } elseif ($value == 'green'){ $array = $temp_green_file; // and so on for all 20 possibilities } for($i=0; $icount($array); $i++) { // do some stuff } } ? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] random array sort
Hi, Wednesday, September 11, 2002, 12:22:05 AM, you wrote: RM Could someone show me a quick and simple way to randomly sort array RM elements? I can't seem to pinpoint the correct parameters in the docs. RM Thanks! The function you need I think is shuffle() -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verify phone format?
The problem you have is that not all phone numbers share that format... mine for example (Australia) is 61 3 (that is, CountryCode, State, Exchange, Number). So it depends on who will fill out your form... if you're talking international, you may want to think twice. It never ceases to frustrate me when global sites (usually based in the US I've found) tend to think that their way is the only way. Countless times where the the number format of phone numbers wouldn't let me enter my number correctly, or the state abbreviation was only 2 chars (Australia is 3, eg VIC), only allowing me to select a US state (no other option) -- but still allowing me to select Australia from the country list, etc etc. The best way to make people conform is to break the number into multiple boxes, for country code, area code, and number. You can then join them with a -, and even do some small manipulations on the last one (eg putting a - after 4 chars, or whatever), check they're all filled out, and then insert the completed, correctly formatted number into the database :) Cheers, Justin PS there might be a class to validate to a correct international number format, which MAY give you what you want. on 11/09/02 1:30 AM, Jeff Lewis ([EMAIL PROTECTED]) wrote: Just wondering what the best way to validate an entered phone format is? Is anyone doing this currently? I have a form field that people enter in information and I want to force phone entries to XXX-XXX-. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verify phone format?
If it makes you feel better, it's a site only for Canada. Jeff - Original Message - From: Justin French [EMAIL PROTECTED] To: Jeff Lewis [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 7:35 PM Subject: Re: [PHP] Verify phone format? The problem you have is that not all phone numbers share that format... mine for example (Australia) is 61 3 (that is, CountryCode, State, Exchange, Number). So it depends on who will fill out your form... if you're talking international, you may want to think twice. It never ceases to frustrate me when global sites (usually based in the US I've found) tend to think that their way is the only way. Countless times where the the number format of phone numbers wouldn't let me enter my number correctly, or the state abbreviation was only 2 chars (Australia is 3, eg VIC), only allowing me to select a US state (no other option) -- but still allowing me to select Australia from the country list, etc etc. The best way to make people conform is to break the number into multiple boxes, for country code, area code, and number. You can then join them with a -, and even do some small manipulations on the last one (eg putting a - after 4 chars, or whatever), check they're all filled out, and then insert the completed, correctly formatted number into the database :) Cheers, Justin PS there might be a class to validate to a correct international number format, which MAY give you what you want. on 11/09/02 1:30 AM, Jeff Lewis ([EMAIL PROTECTED]) wrote: Just wondering what the best way to validate an entered phone format is? Is anyone doing this currently? I have a form field that people enter in information and I want to force phone entries to XXX-XXX-. Jeff -- 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] Confusing array question ...
Try adding curly braces around the var name, like this: for($i=0; $icount(${beginning . $value . end}); $i++) { also, a look at the variable variables manual page will help further HTH Martin -Original Message- From: John Kelly [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 9:27 AM To: [EMAIL PROTECTED] Subject: [PHP] Confusing array question ... Hi, I have 1 primary array called $item containing 20 values each of whose value is part of the name of 20 other arrays containing various number of values. How can I cycle through the primary $item array using a foreach and within that do a for on each of the 20 secondary arrays dynamically inserting each of the 20 secondary array names based on the value of the current primary $item array. Something like the following which obviously does not work. ?php foreach($item as $value) { // do some stuff for($i=0; $icount($beginning_of_array_name_always_the_same . $value . end_of_array_name_always_the_same); $i++) { // do some stuff } } ? I am trying to avoid doing something like the following ... ?php foreach($item as $value) { // do some stuff if($value == 'red'){ $array = $temp_red_file; } elseif ($value == 'green'){ $array = $temp_green_file; // and so on for all 20 possibilities } for($i=0; $icount($array); $i++) { // do some stuff } } ? Thanks! -- 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 these two things mean: __FILE__ and __LINE__
If I remember correctly __FILE__ contains the current file name of the script __LINE__ contails the current line number in the script __PATH__ contains the path to the current script HTH Martin -Original Message- From: Alex Shi [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 7:56 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] What these two things mean: __FILE__ and __LINE__ I read the link, still don't get what are the exact meaning of those two things. What the link refered is a section from PHP manul that I have a copy on my local computer, and to me it doesn't seems like a formal defination of them. From the messages appending to the ariticle I saw one more thing don't understand: __PATH__. Alex Kevin Stone [EMAIL PROTECTED] wrote in message 008801c2590a$28d7ede0$6501a8c0@kevin">news:008801c2590a$28d7ede0$6501a8c0@kevin... http://www.php.net/manual/en/language.constants.php -Kevin - Original Message - From: Alex Shi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 2:31 PM Subject: [PHP] What these two things mean: __FILE__ and __LINE__ What these two things mean: __FILE__ and __LINE__ ? I searched manul but find nothing about them... Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Easy Function Question?
I have a need to call a function, where all the variables used might not be set. Is there a way to have a variable in a function have a default setting if the variable passed to the function is VOID? EXAMPLE: $name=me; $phone=; //$zip is VOID function myFunction($name, $phone, $zip){ echo $name.$phone.$zip } can I write...? function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } and then $zip will have a value of if $zip is VOID for some reason...? I thought it was something like this, but I keep batting ZERO and there is no mention of this problem in the places I looked in the docs. Can anyone throw me a bone? Thanks gang! -NorthBayShane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confusing array question ...
Thanks that did it! Martin Towell [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try adding curly braces around the var name, like this: for($i=0; $icount(${beginning . $value . end}); $i++) { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Easy Function Question?
function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } is the corrent format, but if you call it like this: myFunction(name, phone, null); then $zip will equal null, not something like this might help function myFunction($name, $phone, $zip=){ if (!$zip) $zip = ; echo $name.$phone.$zip } HTH Martin -Original Message- From: Shane [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 10:14 AM To: [EMAIL PROTECTED] Subject: [PHP] Easy Function Question? I have a need to call a function, where all the variables used might not be set. Is there a way to have a variable in a function have a default setting if the variable passed to the function is VOID? EXAMPLE: $name=me; $phone=; //$zip is VOID function myFunction($name, $phone, $zip){ echo $name.$phone.$zip } can I write...? function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } and then $zip will have a value of if $zip is VOID for some reason...? I thought it was something like this, but I keep batting ZERO and there is no mention of this problem in the places I looked in the docs. Can anyone throw me a bone? Thanks gang! -NorthBayShane -- 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] Easy Function Question?
Martin, so if I write... function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } and $zip is NOT SET then $zip will = . But if $zip IS SET then $zip will = whatever $zip's current value is, and will NOT be changed to ? Please advise. Thanks Martin -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 5:14 PM To: Shane; [EMAIL PROTECTED] Subject: RE: [PHP] Easy Function Question? function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } is the corrent format, but if you call it like this: myFunction(name, phone, null); then $zip will equal null, not something like this might help function myFunction($name, $phone, $zip=){ if (!$zip) $zip = ; echo $name.$phone.$zip } HTH Martin -Original Message- From: Shane [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 10:14 AM To: [EMAIL PROTECTED] Subject: [PHP] Easy Function Question? I have a need to call a function, where all the variables used might not be set. Is there a way to have a variable in a function have a default setting if the variable passed to the function is VOID? EXAMPLE: $name=me; $phone=; //$zip is VOID function myFunction($name, $phone, $zip){ echo $name.$phone.$zip } can I write...? function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } and then $zip will have a value of if $zip is VOID for some reason...? I thought it was something like this, but I keep batting ZERO and there is no mention of this problem in the places I looked in the docs. Can anyone throw me a bone? Thanks gang! -NorthBayShane -- 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] Easy Function Question?
if you pass a third parameter, then $zip will equal that parameter If you only pass two parameters, then $zip will equal eg1. myFunction($var1, $var2); $zip will = eg2. myFunction($var1, $var2, $var3); $zip will = $var3, no matter what $var3 contains $var3 could be null, , or foobar, it doesn't matter, $zip will = $var3 Martin -Original Message- From: Shane [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 10:22 AM To: Martin Towell; [EMAIL PROTECTED] Subject: RE: [PHP] Easy Function Question? Martin, so if I write... function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } and $zip is NOT SET then $zip will = . But if $zip IS SET then $zip will = whatever $zip's current value is, and will NOT be changed to ? Please advise. Thanks Martin -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 5:14 PM To: Shane; [EMAIL PROTECTED] Subject: RE: [PHP] Easy Function Question? function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } is the corrent format, but if you call it like this: myFunction(name, phone, null); then $zip will equal null, not something like this might help function myFunction($name, $phone, $zip=){ if (!$zip) $zip = ; echo $name.$phone.$zip } HTH Martin -Original Message- From: Shane [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 10:14 AM To: [EMAIL PROTECTED] Subject: [PHP] Easy Function Question? I have a need to call a function, where all the variables used might not be set. Is there a way to have a variable in a function have a default setting if the variable passed to the function is VOID? EXAMPLE: $name=me; $phone=; //$zip is VOID function myFunction($name, $phone, $zip){ echo $name.$phone.$zip } can I write...? function myFunction($name, $phone, $zip=){ echo $name.$phone.$zip } and then $zip will have a value of if $zip is VOID for some reason...? I thought it was something like this, but I keep batting ZERO and there is no mention of this problem in the places I looked in the docs. Can anyone throw me a bone? Thanks gang! -NorthBayShane -- 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] Questions regarding inserting and updating data into aMySQL db
You should search for some SQL tutorials on the Web. What it sounds like you are looking for is the update SQL statement which modifies an existing row (for your second form, for example). Thus, you insert the row to create it (which assigns the key using the auto increment), then update that row to make any modifications you need to after that. Happy hacking. Chris Axis Computers wrote: I'm developing a web application that uses forms for user input and then after each form is filled shows something like Welcome Bob to our site ... bla. bla... inserts data in a table and on the same page continues with the rest of the data, and goes to another form and so on. I have no problems inserting the data from the first form in the table, display the personalized message, and then connect to the mySQL db, my problem is some fields in the table which must be filled are null in this first instance, and then on the second form they are filled, but my I don´t know how can I fill the gaps and leave all the data in one row, because the first field auto increments, and I'm worried the data instead of filling one row spreads accross two or three. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: Questions regarding inserting and updating data into a MySQL db
- Original Message - From: Axis Computers To: [EMAIL PROTECTED] ; PHP Sent: Tuesday, September 10, 2002 4:51 PM Subject: Questions regarding inserting and updating data into a MySQL db Hi, I'm developing a web application that uses forms for user input and then after each form is filled shows something like Welcome Bob to our site ... bla. bla... inserts data in a table and on the same page continues with the rest of the data, and goes to another form and so on. I have no problems inserting the data from the first form in the table,display the personalized message, and then connect to the mySQL db, my problem is some fields in the table which must be filled are null in this first instance, and then on the second form they are filled, but my I don´t know how can I fill the gaps and leave all the data in one row, because the first field auto increments, and I'm worriedthe data instead of filling one row spreads accross two or three. i.e First: Bob Last: Evans //user submits form ///On the second form says "Welcome Bob Evans and congratulations ... bla bla ..." // inserts data into table // Then asks for more data Address : Somewhere 555 Ocupation: Something // user submits form // data is inserted into the table and the gaps are filled or is updated ? here is what I don't know if data is still on the same row and effectively filled the gaps, or it is inserted into another road ... using insert or update ? Thanks for your tips TIA Rick __ICQ#:37031810 Current ICQ status: + More ways to contact me __
[PHP] subdomain
G'day everyone, I have a dilemma... I'm running BIND locally, with a wildcard A record. That means that if someone goes to http://somebullshit.mydomain.com/ they'll get my page up. What I want to do is catch that subdomain into a variable... Is there a PHP global that can get that? So, if someone goes to http://liam.mydomain.com/, the page will echo Hello Liam Any ideas guys? Cheers, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] subdomain
Try this: $subdomain = $_SERVER[SERVER_NAME]; And then get all the text before the first .. Tyler On Wed, 11 Sep 2002 10:55:56 +1000 Liam MacKenzie [EMAIL PROTECTED] wrote: G'day everyone, I have a dilemma... I'm running BIND locally, with a wildcard A record. That means that if someone goes to http://somebullshit.mydomain.com/ they'll get my page up. What I want to do is catch that subdomain into a variable... Is there a PHP global that can get that? So, if someone goes to http://liam.mydomain.com/, the page will echo Hello Liam Any ideas guys? Cheers, Liam -- 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] Thanks...
Many thanks. That was the trick. :) Chuck Payne Magi Design and Support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Capitialisation
G'day all... $variable = joe blow; How can I automatically make $variable = Joe Blow; The value's obviously dynamic, so I need to capitalise each letter of each word in the var. Any ideas? For those of you who read my previous post, you may have worked out what I'm doing ;-) Cheers, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capitialisation
ucwords() Liam MacKenzie wrote: $variable = joe blow; How can I automatically make $variable = Joe Blow; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capitialisation
oh cool, didn't know that existed! thanks! - Original Message - From: Chris Shiflett [EMAIL PROTECTED] To: Liam MacKenzie [EMAIL PROTECTED] Cc: php [EMAIL PROTECTED] Sent: Wednesday, September 11, 2002 11:53 AM Subject: Re: [PHP] Capitialisation ucwords() Liam MacKenzie wrote: $variable = joe blow; How can I automatically make $variable = Joe Blow; -- 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] Don't read if easily offended...
Give a man a day at home sick with nothing to do, and you get some... Interesting results... http://bill.clinton.fuckedyourmum.com/ Try your mate's name in there... =) Thank's for everyone's help in producing this absolutely useless masterpiece! Cheers, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't read if easily offended...
You should check to make sure the variable isn't empty. And if it is put some other name in there (like Bill Clinton). Cuz if you go to just http://fuckedyourmum.com, you just get: fucked your Mum!!! for text. Just a suggestion, Tyler On Wed, 11 Sep 2002 12:08:03 +1000 Liam MacKenzie [EMAIL PROTECTED] wrote: Give a man a day at home sick with nothing to do, and you get some... Interesting results... http://bill.clinton.fuckedyourmum.com/ Try your mate's name in there... =) Thank's for everyone's help in producing this absolutely useless masterpiece! Cheers, Liam -- 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] Don't read if easily offended...
Yeah, good idea. I'll do that now, I've got nothing else to do! :-) - Original Message - From: Tyler Longren [EMAIL PROTECTED] To: Liam MacKenzie [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, September 11, 2002 12:13 PM Subject: Re: [PHP] Don't read if easily offended... You should check to make sure the variable isn't empty. And if it is put some other name in there (like Bill Clinton). Cuz if you go to just http://fuckedyourmum.com, you just get: fucked your Mum!!! for text. Just a suggestion, Tyler On Wed, 11 Sep 2002 12:08:03 +1000 Liam MacKenzie [EMAIL PROTECTED] wrote: Give a man a day at home sick with nothing to do, and you get some... Interesting results... http://bill.clinton.fuckedyourmum.com/ Try your mate's name in there... =) Thank's for everyone's help in producing this absolutely useless masterpiece! Cheers, Liam -- 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] subdomain
Grab the $SERVER_NAME environmental variable. Then parse the variable using explode on the period in the domain name. Count the number of elements in the array. and selcct the element you want to use /dkm - Original Message - From: Liam MacKenzie [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 8:55 PM Subject: [PHP] subdomain G'day everyone, I have a dilemma... I'm running BIND locally, with a wildcard A record. That means that if someone goes to http://somebullshit.mydomain.com/ they'll get my page up. What I want to do is catch that subdomain into a variable... Is there a PHP global that can get that? So, if someone goes to http://liam.mydomain.com/, the page will echo Hello Liam Any ideas guys? Cheers, Liam -- 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] subdomain
Thanks, I tried that but I couldn't get it to work. It only returned fuckedyourmum.com without the subdomain. I used $_SERVER[HTTP_HOST] instead. Look at the source if you like... http://source.fuckedyourmum.com/index.phps - Original Message - From: Dennis Moore [EMAIL PROTECTED] To: Liam MacKenzie [EMAIL PROTECTED]; php [EMAIL PROTECTED] Sent: Wednesday, September 11, 2002 12:31 PM Subject: Re: [PHP] subdomain Grab the $SERVER_NAME environmental variable. Then parse the variable using explode on the period in the domain name. Count the number of elements in the array. and selcct the element you want to use /dkm - Original Message - From: Liam MacKenzie [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Tuesday, September 10, 2002 8:55 PM Subject: [PHP] subdomain G'day everyone, I have a dilemma... I'm running BIND locally, with a wildcard A record. That means that if someone goes to http://somebullshit.mydomain.com/ they'll get my page up. What I want to do is catch that subdomain into a variable... Is there a PHP global that can get that? So, if someone goes to http://liam.mydomain.com/, the page will echo Hello Liam Any ideas guys? Cheers, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php