Re: [PHP] Re: checkboxes
I have another idea - to use javascript to change hidden value (input type=hidden id=chkbox value=0) When you check this box - javascript changes hidden value to 1 and submits form ( function chkboxAndSubmit() { var box_name = document.GetElementById('box_name'); var chkbox = document.GetElementById('chkbox'); if (box_name.checked===true) { box_name.checked = false; documen.chkbox.value = 0; } else { box_name.checked = true; documen.chkbox.value = 1; } document.form_name.submit(); } ) and then after submitting document you must create (if it uses only function - variable must be global) variable with name $chkbox and check - if (chkbox==1) //checked else //unchecked
[PHP] SMTP
Hi, I have PHP running on my Debian (unstable distribution) box. I'm trying to generate an email via the mail() function. It keeps failing because I do not have a properly installed/configured SMTP daemon on my machine. This is despite the fact that I have modified the SMTP variable in the php.ini file to point to my ISP's SMTP server. Has anyone else experienced this problem before? Regards, [ lucas ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] help with dbase!!!
I'm trying to read a record from a dbase data base so I've previously opened it successfully. The problem is that I call the function dbase_get_record, but it returns no records. The database is ok because I call the funcion dbase_numfields and dbase_numrecords and they give me correct information. Would you help me, please?. Here is the source code that fails. [EMAIL PROTECTED] Estoy intentando leer un registro de una base de datos dbase, por lo que antes la he abierto con éxito. el problema residen en que llamo a la función dbase_get_record, pero no me devuelve ningún registro. La base de datos está bien, porque llamo a la función dbase_numfields y dbase_numrecords y me dan información correcta. ¿Me podríais ayudar, por favor?. Ahí va el código fuente: [EMAIL PROTECTED] Source code- Código fuente: ? $based=articulo.dbf; if (($descriptor=dbase_open ($based, 0))==0){ printf (brError al abrir la base de datos); }else{ printf (brBase de datos abierta); $num_registros=dbase_numrecords($descriptor); $num_campos=dbase_numfields($descriptor); for ($i=1;$i=$num_registros;$i++){ $registro= dbase_get_record ($descriptor, $i); for ($j=0;$j$num_campos;$j++){ printf (brFila %d,Campo %d vale %S, $i, $j, $registro[$j]); } } dbase_close($descriptor); printf (brBase de datos cerrada); } ?
[PHP] Re: help with dbase!!!
I don't really know anything about dbase. But don't you need to tell it which tables and fields you wish to retrieve? Regards, [ lucas ] Alejandro Viana [EMAIL PROTECTED] wrote in message 001e01c15ec9$d3d566a0$9db2243e@miordenador">news:001e01c15ec9$d3d566a0$9db2243e@miordenador... I'm trying to read a record from a dbase data base so I've previously opened it successfully. The problem is that I call the function dbase_get_record, but it returns no records. The database is ok because I call the funcion dbase_numfields and dbase_numrecords and they give me correct information. Would you help me, please?. Here is the source code that fails. [EMAIL PROTECTED] Estoy intentando leer un registro de una base de datos dbase, por lo que antes la he abierto con éxito. el problema residen en que llamo a la función dbase_get_record, pero no me devuelve ningún registro. La base de datos está bien, porque llamo a la función dbase_numfields y dbase_numrecords y me dan información correcta. ¿Me podríais ayudar, por favor?. Ahí va el código fuente: [EMAIL PROTECTED] Source code- Código fuente: ? $based=articulo.dbf; if (($descriptor=dbase_open ($based, 0))==0){ printf (brError al abrir la base de datos); }else{ printf (brBase de datos abierta); $num_registros=dbase_numrecords($descriptor); $num_campos=dbase_numfields($descriptor); for ($i=1;$i=$num_registros;$i++){ $registro= dbase_get_record ($descriptor, $i); for ($j=0;$j$num_campos;$j++){ printf (brFila %d,Campo %d vale %S, $i, $j, $registro[$j]); } } dbase_close($descriptor); printf (brBase de datos cerrada); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Error: Can't redeclare already declared function (PHP 3.0.15)
On Fri, 26 Oct 2001 20:54:00 -0400 impersonator of [EMAIL PROTECTED] (Gerard Onorato) planted I saw in php.general: Hi, Another solution I have used when I have to do conditional includes which may cause the same page to be included twice Unfortunately, you can't include FUNCTION() conditionaly (well, you can, but then you can't use it out of this if():). Why only such dumn restriction, PHP developers? At the top of the code to be included (the separate file) put something like: if ($theFileAlreadyInclude != 1) { Right. That what i do too, but you include _code_ (whithout functions:() in that case.. -- i -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Error: Can't redeclare already declared function (PHP 3.0.15)
I include files in each other all the time, and some of them might call the same functions (like database functions). I just use a string in all function declaration with the name of the functions or set of functions in the file. if(!$function_test) { $function_test=1; function test() { dfg fdggfdg fdg } } This way you can include the same functions many times without error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Error: Can't redeclare already declared function (PHP 3.0.15)
Unfortunately, you can't include FUNCTION() conditionaly (well, you can, but then you can't use it out of this if():). Why only such dumn restriction, PHP developers? I think it's only true for php3 I use many many class definitions in php4 that are inluded conditionally in another classes' functions, and of course it works fine. Arpi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Replace text
Hello guys function replace_text_smiley(){ global $comment; // To add a relation between a text smiley a an image smiley do this: // $faces[text smiley here] = img tag to image smile here; $faces[:)] = IMG SRC=\emoticons/smile.gif\; $faces[:P] = IMG SRC=\emoticons/tongue.gif\; $faces[:D] = IMG SRC=\emoticons/happy.gif\; $faces[:(] = IMG SRC=\emoticons/mad.gif\; $faces[;)] = IMG SRC=\emoticons/wink.gif\; while(list($text,$image) = each($faces)) { $comment = str_replace($text,$image,$comment); } return $comment; } this function replaces faces to smilies images then in a separete file i use this function and another one to replace urls... the url replacement is ok but it doesn't change the text to smilies.. any guesses?? :) Thnx in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] RE: help with dbase!!!
It has only 1 table . Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Replace text
Hello guys function replace_text_smiley(){ global $comment; // To add a relation between a text smiley a an image smiley do this: // $faces[text smiley here] = img tag to image smile here; $faces[:)] = IMG SRC=\emoticons/smile.gif\; $faces[:P] = IMG SRC=\emoticons/tongue.gif\; $faces[:D] = IMG SRC=\emoticons/happy.gif\; $faces[:(] = IMG SRC=\emoticons/mad.gif\; $faces[;)] = IMG SRC=\emoticons/wink.gif\; while(list($text,$image) = each($faces)) { $comment = str_replace($text,$image,$comment); } return $comment; } this function replaces faces to smilies images then in a separete file i use this function and another one to replace urls... the url replacement is ok but it doesn't change the text to smilies.. any guesses?? :) Thnx in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Replace text
What if pass some parameters to function - i mean not use global $comment but do like function replace_text_smiley($comment) - Original Message - From: Daniel Harik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, October 28, 2001 12:20 AM Subject: [PHP] Replace text Hello guys function replace_text_smiley(){ global $comment; // To add a relation between a text smiley a an image smiley do this: // $faces[text smiley here] = img tag to image smile here; $faces[:)] = IMG SRC=\emoticons/smile.gif\; $faces[:P] = IMG SRC=\emoticons/tongue.gif\; $faces[:D] = IMG SRC=\emoticons/happy.gif\; $faces[:(] = IMG SRC=\emoticons/mad.gif\; $faces[;)] = IMG SRC=\emoticons/wink.gif\; while(list($text,$image) = each($faces)) { $comment = str_replace($text,$image,$comment); } return $comment; } this function replaces faces to smilies images then in a separete file i use this function and another one to replace urls... the url replacement is ok but it doesn't change the text to smilies.. any guesses?? :) Thnx in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Multi-dimensional nested arrays in Smarty
I've asked a few questions before on Smarty here and I've worked through them but this one really has me. I checked the Smarty lists for answers and couldn't find a clear answer. Here is my problem. i want to do something to this effect {section name=loop_index loop=$DATA_ARRAY} {$DATA_ARRAY[loop_index].somevalue} {section name=loop_index2 loop=$INNER_ARRAY[loop_index]} {$INNER_ARRAY[loop_index][loop_index2].SOMEVALUE} {/section} {/section} I basically have an associative array $DATA_ARRAY and I want a second two dimensional array where the first array index is the subscript of the first so I basically iterate through the second array within a specific row. but for the life of me I can't get this properly. how would I set this up properly during assignment and output? I believe the above is right for output but what about assignment? $templ_var-append(INNER_ARRAY, ?); I've tried a lot of things but none seem to work... If anyone of you have any insight it would be greatly appreciated. [EMAIL PROTECTED]
[PHP] HELP PLEASE!! Get query error when inserting into MySql
Hi There, I have a query whenever I try to insert something into a mysql table. This is the code I am using: ? $host1 = gethostbyaddr($REMOTE_ADDR); $date = date(Y-m-d h:i:s); $link = mysql_connect($host, $user, $passwd); mysql_select_db($database, $link); $sql = INSERT INTO vcstats VALUES('', $SCRIPT_NAME, $date, $HTTP_USER_AGENT, $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1); $result = mysql_query($sql) or die(query errorBr . mysql_error()); mysql_close(); ? Thanks, Robby - This message was sent using Endymion MailMan. http://www.endymion.com/products/mailman/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HELP PLEASE!! Get query error when inserting into MySql
What if you single quotes like this: '$REMOTE_ADDR' ??? - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, October 27, 2001 3:20 PM Subject: [PHP] HELP PLEASE!! Get query error when inserting into MySql Hi There, I have a query whenever I try to insert something into a mysql table. This is the code I am using: ? $host1 = gethostbyaddr($REMOTE_ADDR); $date = date(Y-m-d h:i:s); $link = mysql_connect($host, $user, $passwd); mysql_select_db($database, $link); $sql = INSERT INTO vcstats VALUES('', $SCRIPT_NAME, $date, $HTTP_USER_AGENT, $BName, $BVersion, $BPlatform, $REMOTE_ADDR, $host1); $result = mysql_query($sql) or die(query errorBr . mysql_error()); mysql_close(); ? Thanks, Robby - This message was sent using Endymion MailMan. http://www.endymion.com/products/mailman/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] I'm not username, log me out....
Hello All, I'm trying to use php sessions to logout a user that may be sharing a computer with another user. In other words. I don't want user1 to access my site and then user2 be able to access user1's account with an auto login because the session was saved. I've seen a few sites that have a URL or button that a user can click on such as: I'm not Joe Smith, please log me out. This is what I am trying to accomplish. Can someone point me in the right direction? I have sessions implemented using username and password but, on my login page since those vars are saved in the session the user automatically gets logged in. I also would like to have a checkbox on the login page that, if checked, doesn't cache the username and password. So if they logout they must enter a username and password, instead of getting automatically logged in. Any help will be highly appreciated. Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Excel to MySQL
Hello guys Thank You very much for your previous replies, could u help me with 1 more thing? You see i have huge(for me) 100 000 record access table, i wanted to convert it to mysql, i thought of making php convertor that uses odbc and mysql, but maybe there is faster way? And other thought was also read in RAW format excel file with perl, and take advantage of DBI? Anyways how would u do it? Thank You very much -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Excel to MySQL
At 04:11 PM 10/27/01 -0800, Daniel Harik wrote: You see i have huge(for me) 100 000 record access table, i wanted to convert it to mysql, i thought of making php convertor that uses odbc and mysql, but maybe there is faster way? Daniel, You're making it too hard on yourself. 1. CREATE TABLES in MySQL that match up to your Access tables. 2. In MICROSOFT ACCESS, go to the Export... command (I believe it's under the File menu.) 3. You'll save it as a .txt file with NO TEXT QUALIFIERS, TAB DELIMITED, without having column names on the first row. 4. FTP the .txt file to your server. I always use ASCII mode for it because I remember one time having some problem which I think was due to Binary transfer (I could've been wrong about that, though). 5. Go into MySQL an use the LOAD DATA INFILE command. ie: LOAD DATA INFILE '/home/virtual/yoursite/home/html/filename.txt' REPLACE INTO tablename; The first few times it can be kind of sticky, but after you do it a couple fo times, it will be as easy as breathing. There is 1 compatibility issue that I ran into. If a field in MS ACCESS has data on 2 lines For instance... ++---+ | ID | Address | ++---+ | 1 | 123 Evergreen Terrace | -- This is GOOD ++---+ | 2 | 321 Pine Street | -- This is BAD || Apartment A | ++---+ You see, when MySQL runs the LOAD DATA, new records are indicated by a NEW LINE. You'll want to check your ACCESS table for new lines before creating the export file. Later, Jeff Gannaway ___ Save 15% on 2002 Calendars and Holiday Cards! http://www.AvantGifts.com Discount Code: hopper22ct Offer Good Through October 31, 2001 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Feauture request/proposal: import
Hi All, What do you guys think of a import feauture for php. This allows developers to use packages and a package trees for including files. We're using a php written import for the binarycloud app framework with grat success. It's extremly handy, easy to use, clear and straight forward. We currently have the following syntax if we want to include a file. import(binarycloud.core.Request); The import method now does the following: Look up global import map, if package already included return else include(PACKAGE_BASE./binarycloud/core/Request.php); Set binarycloud.core.Request = true in the global import map. The benefits are outstanding. You don't have to mess around with path names and the package-path's can be logically structured. Ok, you can achive this with include too, but import seems more flexibe and abstracted from the filesystem. So somehting like binarycloud.db.Template could be something within a database or ldap or whatever in the future. I don't know the interna of php but I think a native and basic implementation in C will be a matter of some hours because this is based on include. I thought of also having a php.ini setting like: import_bases=./:/path/to/base1:/path/to/base/2 or something like that. The syntax itself should be the same as with include: import package.File; and import(package.File); This might also be interesting for PEAR to have a more clear structure: import php.pear.PEAR import php.pear.Cache ... The only drawback I currently see is that you can't use dots in filenames. But that's also useful for people who love it clear ;-) For the binarycloud implementation of import see: http://binarycloud.tigris.org/source/browse/binarycloud/r2/binarycloud/base/ init/prepend.php?rev=1.6content-type=text/x-cvsweb-markup What do you think? Andi -- www.thyrell.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Feauture request/proposal: import
Hi All, What do you guys think of a import feauture for php. This allows developers to use packages and a package trees for including files. We're using a php written import for the binarycloud app framework with grat success. It's extremly handy, easy to use, clear and straight forward. We currently have the following syntax if we want to include a file. import(binarycloud.core.Request); The import method now does the following: Look up global import map, if package already included return else include(PACKAGE_BASE./binarycloud/core/Request.php); Set binarycloud.core.Request = true in the global import map. The benefits are outstanding. You don't have to mess around with path names and the package-path's can be logically structured. Ok, you can achive this with include too, but import seems more flexibe and abstracted from the filesystem. So somehting like binarycloud.db.Template could be something within a database or ldap or whatever in the future. I don't know the interna of php but I think a native and basic implementation in C will be a matter of some hours because this is based on include. I thought of also having a php.ini setting like: import_bases=./:/path/to/base1:/path/to/base/2 or something like that. The syntax itself should be the same as with include: import package.File; and import(package.File); This might also be interesting for PEAR to have a more clear structure: import php.pear.PEAR import php.pear.Cache ... The only drawback I currently see is that you can't use dots in filenames. But that's also useful for people who love it clear ;-) For the binarycloud implementation of import see: http://binarycloud.tigris.org/source/browse/binarycloud/r2/binarycloud/base/ init/prepend.php?rev=1.6content-type=text/x-cvsweb-markup What do you think? Andi -- www.thyrell.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] FTP or Telnet files/directories with PHP?
Here's the problem: I want a PHP scrip ton my shared server to be able to create some directories and files. I don't want to make a directory with 777 permissions. Also, I'm going to distribute this script, so I don't want to do set web or nobody as having write access in my system. Solution? Can PHP run some FTP or TELNET commands? If so, couldn't I have PHP log into the server under the actual username and password, then create the directories and write the files??? The files would have the correct ownership and read/write/execute permissions too. Would this work? Where do I start? Thanks! -Jeff Gannaway ___ Save 15% on 2002 Calendars and Holiday Cards! http://www.AvantGifts.com Discount Code: hopper22ct Offer Good Through October 31, 2001 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How do I check if apache processes php?
I try the simplest script and it just shows in Netscape 6.0 and it just shows the php code, it does not process the information. How do I check to see it apache processes the information? Thanks, Evan P. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Excel to MySQL
Another idea that may work... and I say may because I have never done it myself. Is to use MyODBC drivers and do the import code native to Access. I would be interested to hear if others have done this. Gerard -Original Message- From: Jeff Gannaway [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 27, 2001 10:30 AM To: Daniel Harik; [EMAIL PROTECTED] Subject: Re: [PHP] Excel to MySQL At 04:11 PM 10/27/01 -0800, Daniel Harik wrote: You see i have huge(for me) 100 000 record access table, i wanted to convert it to mysql, i thought of making php convertor that uses odbc and mysql, but maybe there is faster way? Daniel, You're making it too hard on yourself. 1. CREATE TABLES in MySQL that match up to your Access tables. 2. In MICROSOFT ACCESS, go to the Export... command (I believe it's under the File menu.) 3. You'll save it as a .txt file with NO TEXT QUALIFIERS, TAB DELIMITED, without having column names on the first row. 4. FTP the .txt file to your server. I always use ASCII mode for it because I remember one time having some problem which I think was due to Binary transfer (I could've been wrong about that, though). 5. Go into MySQL an use the LOAD DATA INFILE command. ie: LOAD DATA INFILE '/home/virtual/yoursite/home/html/filename.txt' REPLACE INTO tablename; The first few times it can be kind of sticky, but after you do it a couple fo times, it will be as easy as breathing. There is 1 compatibility issue that I ran into. If a field in MS ACCESS has data on 2 lines For instance... ++---+ | ID | Address | ++---+ | 1 | 123 Evergreen Terrace | -- This is GOOD ++---+ | 2 | 321 Pine Street | -- This is BAD || Apartment A | ++---+ You see, when MySQL runs the LOAD DATA, new records are indicated by a NEW LINE. You'll want to check your ACCESS table for new lines before creating the export file. Later, Jeff Gannaway ___ Save 15% on 2002 Calendars and Holiday Cards! http://www.AvantGifts.com Discount Code: hopper22ct Offer Good Through October 31, 2001 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Excel to MySQL
Yet another good way (if you have Windows) is to grab a copy of the MSDE (comes with most distros of Office, on the CD.. you'll hafta search for it), which is essentially a stripped down version of Microsoft SQL Server. Install that, and on your start menu somewhere (it'll say like MSDE or something), there will be the Import and Export Wizard. It supports tonnes of database formats, and allows you to map fields to other fields. Use that in conjunction with a MySQL ODBC driver, and you're cooking with gravy. Mike Gerard Onorato wrote: Another idea that may work... and I say may because I have never done it myself. Is to use MyODBC drivers and do the import code native to Access. I would be interested to hear if others have done this. Gerard -Original Message- From: Jeff Gannaway [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 27, 2001 10:30 AM To: Daniel Harik; [EMAIL PROTECTED] Subject: Re: [PHP] Excel to MySQL At 04:11 PM 10/27/01 -0800, Daniel Harik wrote: You see i have huge(for me) 100 000 record access table, i wanted to convert it to mysql, i thought of making php convertor that uses odbc and mysql, but maybe there is faster way? Daniel, You're making it too hard on yourself. 1. CREATE TABLES in MySQL that match up to your Access tables. 2. In MICROSOFT ACCESS, go to the Export... command (I believe it's under the File menu.) 3. You'll save it as a .txt file with NO TEXT QUALIFIERS, TAB DELIMITED, without having column names on the first row. 4. FTP the .txt file to your server. I always use ASCII mode for it because I remember one time having some problem which I think was due to Binary transfer (I could've been wrong about that, though). 5. Go into MySQL an use the LOAD DATA INFILE command. ie: LOAD DATA INFILE '/home/virtual/yoursite/home/html/filename.txt' REPLACE INTO tablename; The first few times it can be kind of sticky, but after you do it a couple fo times, it will be as easy as breathing. There is 1 compatibility issue that I ran into. If a field in MS ACCESS has data on 2 lines For instance... ++---+ | ID | Address | ++---+ | 1 | 123 Evergreen Terrace | -- This is GOOD ++---+ | 2 | 321 Pine Street | -- This is BAD || Apartment A | ++---+ You see, when MySQL runs the LOAD DATA, new records are indicated by a NEW LINE. You'll want to check your ACCESS table for new lines before creating the export file. Later, Jeff Gannaway ___ Save 15% on 2002 Calendars and Holiday Cards! http://www.AvantGifts.com Discount Code: hopper22ct Offer Good Through October 31, 2001 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Error: Can't redeclare already declared function (PHP 3.0.15)
On Sat, 27 Oct 2001 13:21:58 +0200 impersonator of [EMAIL PROTECTED] (Tamas Arpad) planted I saw in php.general: Unfortunately, you can't include FUNCTION() conditionaly (well, you can, but then you can't use it out of this if():). Why only such dumn restriction, PHP developers? I think it's only true for php3 I use many many class definitions in php4 that are inluded conditionally in another classes' functions, and of course it works fine. Arpi Hmm. Thats becoming interesting. Are you using 4.06 ? Becouse, i have this version, and it doesn't give me such a chance. I thought it should, but when tryed it proved otherwise.. Pss. I double-checked now on a simple example, and it worked as you say, it should.. But i re-member well that then i too checked several times.. Weird. (i must have missed s/t then or..) Anyway, 'll have in mind, that it should work, for the futer. Sorry 4 missleding TnX. i. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fsockopen and https
From: Brad Hubbard [EMAIL PROTECTED] I am using fsockopen to post data to a dll on a SSL server. I setup the socket data and successfully posted the data to port 80 but as soon as I switch to port 443 I received no errors or text. Does this help? I use this on web servers to test whether a transaction server is available or not. Only works on *nix of course (sorry Bill :-) ?php $ph = popen( /usr/bin/openssl s_client -connect secure.geicp.com:443 -quiet 2/dev/null EOM\nGET / HTTP/1.0\n\nEOM\n, r ); $response = fgets( $ph, 1024 ); if( stristr( $response, 200 OK ) ) { header( Location: https://a.secure.server.com; ); exit; } ? Excellent! This is exactly what I needed. I now have a class interfacing with my gateway and do not need cURL! Thanks a bunch! -John- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Excel to MySQL
I used Jeff's method http://adsl20066.estpak.ee/emt here is it working live Thank You Jeff so much -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] can't seem to compile 4.0
Hi Ray, @ 1:56:29 PM on 10/27/2001, Ray Todd Stevens wrote: I have been trying to get the php code to compile and can't seem to make this work. I keep getting an error In file included from /usr/include/errno.h:36, from zend_language_scanner.c:2718: /usr/include/bits/errno.h:25: linux/errno.h: No such file or directory If you already know this, just ignore my babbling. Sounds like you need the kernel-headers RPM that matches your kernel version (uname -r) if you're running RedHat/Mandrake/SuSE/? -- assuming you're using RPM. Install that and try building it again (remove config.cache before you ./configure PHP again). If that doesn't work.. You can *try* creating a symlink: % cd /usr/include/bits % ln -s ../linux linux To *test* and see if it work OK. I have absolutely NO idea if that will fsck anything up, so remove the symlink if you start seeing weird stuff. -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Excel to MySQL
On Saturday 27 October 2001 17:11, Daniel Harik wrote: You see i have huge(for me) 100 000 record access table, i wanted to convert it to mysql, i thought of making php convertor that uses odbc and mysql, but maybe there is faster way? Your subject says excel but above, you say access. If, in fact, you want to convert from access to mySQL, then forget about importing/exporting. Just grab this access module: http://www.rot13.org/~dpavlin/projects/sql/exportSQL3.txt It exports a native mySQL script that creates all your tables, indexes, primary keys and then imports your data. It absolutely kicks butt. I've used it several times and have never had a problem with it. It's a very slick solution. --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] problems with sessions (not working)
I have a file called miec.php that does quite a lot of processing and then include()s user_track.inc.php... miec.php: ? a lot of db processing (NO OUTPUT whatsoever) include(user_track.inc.php); UserTrack($products); the output starts here... ? user_track.inc.php: -- ? session_start(); function UserTrack($products) { global $prod_views; if( !session_is_registered(prod_views) ) { fill the $prod_views array, serialize it... session_register(prod_views); // I've tested the code above... and session_register returns TRUE and I saw the session file... } else { do other stuff with the prod_views array } } ? the problem is why does it NEVER go into the 'else'... it seems that the session is registered... but as soon as I refresh the page the session is lost... why? _ . Christian Dechery . . Gaita-L Owner / Web Developer . . http://www.webstyle.com.br . . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] overloading variables in child classes
Hi all, I am a bit puzzled by the way PHP treates variables that have the same name in a base class and a child class. It seems to me that if a child class and its parent both have a variable with the same name, then they should be different variables. Instead, the example below indicates that they is only one variable : class base { var $shared; function base() {$this-shared = base;} function test() {echo(\$shared in base : . $this-shared . br\n);} } class child extends base { var $shared; function child(){$this-base(); $this-shared = child;} function test() { echo (\$shared in child : . $this-shared . br\n); parent::test(); } } $the_child = new child(); $the_child-test(); I would have expected the output to be $shared in child : child $shared in base : base instead I have $shared in child : child $shared in base : child Is there something I don't understand ? Regards, Alain Dresse [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Getting arrays out of HTTP_POST_VARS
My mind is going blank here and I feel like I'm missing something basic. I have an insert form for movie profiles that takes cast members, writers and directors and inserts them into the tables for the correct movieid. In the old version of the script I would repeat the inserting section of the code three times, once for casts, once for directors and once for writers. The script checks if the person's first/middle/last name exists in the people table. If it does it grabs the id number, if it doesn't it doesn't it inserts it and gets the id number. The peopleid and titleid are then inserted into the appropriate table. (casts, writers, directors) I decided to streamline the code with a function so that calling peopleinserter($table,$titleid) would loop through the form variables and insert into the appropriate table. I can easily grab the results of the $HTTP_POST_VARS but I'm going blank trying to get the array out of the array. Here's a snippet: function peopleinserter ($table,$titleid) { //$titleid = the titleid from the titles table //$table = the job table e.g. casts, directors, writers global $HTTP_POST_VARS; $firstvar = first$table; //if $table = casts it would grab the firstcasts variables from the form $middlevar = middle$table; $lastvar = last$table; while (list ($key, $val) = each ($HTTP_POST_VARS[$lastvar])) { //in this example $lastvar=lastcasts, so it's calling each ($HTTP_POST_VARS[lastcasts]) // if I echo $key $val for this I would get for example 0 Thornton 1 Jolie //end snippet How do I call the key of the firstcasts, middlecasts, lastcasts arrays so I can do stuff like: $lastcasts[$key] = trim($lastcasts[$key]); and $sql = SELECT peopleid, first, middle, last FROM people WHERE first='$firstcasts[$key]' and middle='$middlecasts[$key]' AND last='$lastcasts[$key]]'; In other words, how do I get those three arrays out of the HTTP_POST_VARS array? Banging head on desk... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting arrays out of HTTP_POST_VARS
$HTTP_POST_VARS['middlecasts']['key']['subkey']['wecould']['go_on']['forver']; ;) Mike Ian Evans wrote: My mind is going blank here and I feel like I'm missing something basic. I have an insert form for movie profiles that takes cast members, writers and directors and inserts them into the tables for the correct movieid. In the old version of the script I would repeat the inserting section of the code three times, once for casts, once for directors and once for writers. The script checks if the person's first/middle/last name exists in the people table. If it does it grabs the id number, if it doesn't it doesn't it inserts it and gets the id number. The peopleid and titleid are then inserted into the appropriate table. (casts, writers, directors) I decided to streamline the code with a function so that calling peopleinserter($table,$titleid) would loop through the form variables and insert into the appropriate table. I can easily grab the results of the $HTTP_POST_VARS but I'm going blank trying to get the array out of the array. Here's a snippet: function peopleinserter ($table,$titleid) { //$titleid = the titleid from the titles table //$table = the job table e.g. casts, directors, writers global $HTTP_POST_VARS; $firstvar = first$table; //if $table = casts it would grab the firstcasts variables from the form $middlevar = middle$table; $lastvar = last$table; while (list ($key, $val) = each ($HTTP_POST_VARS[$lastvar])) { //in this example $lastvar=lastcasts, so it's calling each ($HTTP_POST_VARS[lastcasts]) // if I echo $key $val for this I would get for example 0 Thornton 1 Jolie //end snippet How do I call the key of the firstcasts, middlecasts, lastcasts arrays so I can do stuff like: $lastcasts[$key] = trim($lastcasts[$key]); and $sql = SELECT peopleid, first, middle, last FROM people WHERE first='$firstcasts[$key]' and middle='$middlecasts[$key]' AND last='$lastcasts[$key]]'; In other words, how do I get those three arrays out of the HTTP_POST_VARS array? Banging head on desk... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] help needed for multimania.com
Hi, Thanks for the info. about free web hosting www.multimania.com , i will be greateful if any one help in the steps of config. mysql and php on this web hosting, the problem is that site is in non-english language (i think its in french which i dont understand). if any one let me know briefly the steps to upload my website on that web hosting provider i will be very much greateful. i registered a web space at http://khamid.multimania.com hoping for reply and thanks in advance. Kamran H. Hassan _ U wrote | www.multimania.com (php + mysql) | | If you find better ones, please let me know :o) | | See you |
Re: [PHP] Getting arrays out of HTTP_POST_VARS
Onething I should note.. this doesn't work within a string. For example: let's say: $HTTP_POST_VARS['key']['subkey'] = 'Hello World!'; $HTTP_POST_VARS['key2'] = 'World #2!'; if we do: echo key2: $HTTP_POST_VARS[key2]; The output will be: key2: World #2! However, if we do: echo key1/subkey: $HTTP_POST_VARS[key1][subkey]; The output should be: key1/subkey: Array[subkey] So what you want to do is: echo 'key1/subkey: ' . $HTTP_POST_VARS['key1']['subkey']; Which will get you the desired output of: key1/subkey: Hello World! Mike Mike Eheler wrote: $HTTP_POST_VARS['middlecasts']['key']['subkey']['wecould']['go_on']['forver']; ;) Mike Ian Evans wrote: My mind is going blank here and I feel like I'm missing something basic. I have an insert form for movie profiles that takes cast members, writers and directors and inserts them into the tables for the correct movieid. In the old version of the script I would repeat the inserting section of the code three times, once for casts, once for directors and once for writers. The script checks if the person's first/middle/last name exists in the people table. If it does it grabs the id number, if it doesn't it doesn't it inserts it and gets the id number. The peopleid and titleid are then inserted into the appropriate table. (casts, writers, directors) I decided to streamline the code with a function so that calling peopleinserter($table,$titleid) would loop through the form variables and insert into the appropriate table. I can easily grab the results of the $HTTP_POST_VARS but I'm going blank trying to get the array out of the array. Here's a snippet: function peopleinserter ($table,$titleid) { //$titleid = the titleid from the titles table //$table = the job table e.g. casts, directors, writers global $HTTP_POST_VARS; $firstvar = first$table; //if $table = casts it would grab the firstcasts variables from the form $middlevar = middle$table; $lastvar = last$table; while (list ($key, $val) = each ($HTTP_POST_VARS[$lastvar])) { //in this example $lastvar=lastcasts, so it's calling each ($HTTP_POST_VARS[lastcasts]) // if I echo $key $val for this I would get for example 0 Thornton 1 Jolie //end snippet How do I call the key of the firstcasts, middlecasts, lastcasts arrays so I can do stuff like: $lastcasts[$key] = trim($lastcasts[$key]); and $sql = SELECT peopleid, first, middle, last FROM people WHERE first='$firstcasts[$key]' and middle='$middlecasts[$key]' AND last='$lastcasts[$key]]'; In other words, how do I get those three arrays out of the HTTP_POST_VARS array? Banging head on desk... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] HELP: Re: Table comments
In my phpadmin, I have something called: Table comments. Can I acccess this somehow? Can't find it in the function database. I've tried this since, but can't get syntax right: ?php $myconnection = mysql_pconnect(localhost,,); mysql_select_db(,$myconnection); $rows = mysql_query(SHOW TABLE STATUS from MyTable LIKE Comment); echo $rows; ? I'm still new to this. A post reply would be appreciated, Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HELP: Re: Table comments
?php $db = mysql_connect('localhost','user','password'); mysql_select_db('database', $db); $sql = 'SHOW TABLE STATUS LIKE table_name'; $result = mysql_query($sql); // Only returning 1 row, but I put it in a while() loop in case the result is empty // Then I don't get any errors. while ($data = mysql_fetch_array($result)) { $table_comment = $data['Comment']; } mysql_free_result($result); mysql_close($db); echo $table_comment; ? Mike jtjohnston wrote: In my phpadmin, I have something called: Table comments. Can I acccess this somehow? Can't find it in the function database. I've tried this since, but can't get syntax right: ?php $myconnection = mysql_pconnect(localhost,,); mysql_select_db(,$myconnection); $rows = mysql_query(SHOW TABLE STATUS from MyTable LIKE Comment); echo $rows; ? I'm still new to this. A post reply would be appreciated, Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting arrays out of HTTP_POST_VARS
Wow, that holds the land speed record for a reply. Thanks for your help! Mike Eheler wrote: $HTTP_POST_VARS['middlecasts']['key']['subkey']['wecould']['go_on']['forver']; -- Ian Evans Digital Hit Entertainment - News and Information http://www.digitalhit.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] RE: overloading variables in child classes
Hello! Is there something I don't understand ? Yes. According OOP concepts, derived class inherits all functionality and data from the base. So, if you have $shared variable in the base class, your derived class will have it automatically. But PHP allows you to declare this variable once again in the derived class. In C++ you will get comilation error in this case. Best regards, Andrew Kirilenko. -Original Message- From: Alain Dresse [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 27, 2001 10:12 PM To: [EMAIL PROTECTED] Subject: [PHP] overloading variables in child classes Hi all, I am a bit puzzled by the way PHP treates variables that have the same name in a base class and a child class. It seems to me that if a child class and its parent both have a variable with the same name, then they should be different variables. Instead, the example below indicates that they is only one variable : class base { var $shared; function base() {$this-shared = base;} function test() {echo(\$shared in base : . $this-shared . br\n);} } class child extends base { var $shared; function child(){$this-base(); $this-shared = child;} function test() { echo (\$shared in child : . $this-shared . br\n); parent::test(); } } $the_child = new child(); $the_child-test(); I would have expected the output to be $shared in child : child $shared in base : base instead I have $shared in child : child $shared in base : child Is there something I don't understand ? Regards, Alain Dresse [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
NOPE: [PHP] HELP: Re: Table comments
I'm still getting Supplied argument is not a valid MySQL result resource for: while ($data = mysql_fetch_array($result)) { mysql_free_result($result); presumably $result ?php $myconnection = mysql_pconnect(localhost,,); mysql_select_db(,$myconnection); $sql = 'SHOW TABLE STATUS LIKE bookmark_unit4'; $result = mysql_query($sql); // Only returning 1 row, but I put it in a while() loop in case the result is empty // Then I don't get any errors. while ($data = mysql_fetch_array($result)) { $table_comment = $data['Comment']; } mysql_free_result($result); mysql_close($myconnection); echo $table_comment; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] RE: can't seem to compile 4.0
Hello! Yiu must have linux includes installed. Best regards, Andrew Kirilenko. -Original Message- From: Ray Todd Stevens [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 27, 2001 8:56 PM To: [EMAIL PROTECTED] Subject: [PHP] can't seem to compile 4.0 I have been trying to get the php code to compile and can't seem to make this work. I keep getting an error In file included from /usr/include/errno.h:36, from zend_language_scanner.c:2718: /usr/include/bits/errno.h:25: linux/errno.h: No such file or directory Ray Todd Stevens Specialists in Network and Security Consulting Senior ConsultantSoftware audit service available Stevens Services Suite 21 3754 Old State Rd 37 N Bedford, IN 47421 (812) 279-9394 [EMAIL PROTECTED] Thought for the day: Kids do what we do not what we say For PGP public key send message with subject please send PGP key If this message refers to an attachment the attachment may arrive as a seperate mail message depending on the type of mail client and gateway software you are using. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] command line option f -- how do i get the name of the file?
Hello, I am writing a script using php's command line ability and I am lost on how to work with a file when I don't kow what the file's name is. Example: script.php -f file In my script, how do I reference the file when I have no idea what it's name is going to be? The scrip will get called by another application: the other application will pipe a file to my scrip and then the scrip has to work with the file and output an altered file with a new filename. I have no idea what the name of the file is going to be beforehand. Many thanks in advance. -lucas -- Lucas Rockwell mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mail and eregi problem
Hi, I'm having some trouble with this formToEmail script. It shuld take variables from html form, send them to me, and then send auto reply to the person who filed the form. But the problem is that, if the person dont enter e-mail, or enter "sjhdfzg" or leave empty, i receieve internal server error. I've looked for some functions, and found some eregi, that can cehck e-mail before sending. I just dont know how ti aply it. here is the code: first mail @mail($toemail, $subject, $linetot1, "From: $name $email\nContent-Type: text/plain; charset=windows-1250"); second mail The problem one with this function function validEmail($email) { if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4} ", $email)) @mail($email, $subject, $linetot2, "From: $toname $toemail\nContent-Type: text/plain; charset=windows-1250"); } Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: NOPE: [PHP] HELP: Re: Table comments
That's because you're not selecting a database. You need to either put the database name in mysql_select_db, or change the query to: SHOW TABLE STATUS FROM databasename LIKE 'table_name'; so change the line to: $sql = SHOW TABLE STATUS FROM db_name LIKE 'bookmark_unit4'; Mike jtjohnston wrote: I'm still getting Supplied argument is not a valid MySQL result resource for: while ($data = mysql_fetch_array($result)) { mysql_free_result($result); presumably $result ?php $myconnection = mysql_pconnect(localhost,,); mysql_select_db(,$myconnection); $sql = 'SHOW TABLE STATUS LIKE bookmark_unit4'; $result = mysql_query($sql); // Only returning 1 row, but I put it in a while() loop in case the result is empty // Then I don't get any errors. while ($data = mysql_fetch_array($result)) { $table_comment = $data['Comment']; } mysql_free_result($result); mysql_close($myconnection); echo $table_comment; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] function for hashing URL strings to check integrity?
Does anyone know of a function that assists with checking URL strings to make sure they haven't been monkeyed with? Ideally something that calculates the md5 hash of a string and then automatically verifies it when a user clicks a link. I've checked the usual places (hotscripts, devshed, etc) and didn't see anything, but I wanted to check with the group before rolling my own. Thanks. --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Excel to MySQL
Guys getting more serious here now, 3 500 000 records, foxPro i'll try Jeff's method -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] include-ing results in variable?
This is what I'm trying to do, and I think I'm just missing some logic in how to think like PHP. I have a global included file (global.inc) where I set up variables, open the database, etc, and I include it in the header of every HTML file on the site. One thing I would like to set as a variable is the result of php code in another file (banner.inc) -- this result is pulled up several times per page, and it seems that it would be more efficient to have it processed once, and then just plug that result into a variable which I can call every time I need that result data. The problem is that it spits out the result as soon as the variable is set! So at the top of every page, it just prints out all the data results immediately rather than waiting for me to echo or print the variable. I have this at the top of the page: ?php $banner = include (banner.inc); ? (which immediately spits out the result of the include!) But I want to print the results several times a page with this: ?=$banner? I feel certain I'm missing something obvious, but haven't been able to clarify it in my head despite google searching and browsing through a couple of books. thanks for any help! Nathaniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: include-ing results in variable?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Nathaniel Merriam) wrote: I have this at the top of the page: ?php $banner = include (banner.inc); ? (which immediately spits out the result of the include!) But I want to print the results several times a page with this: ?=$banner? What's in banner.inc? Because, as noted in the manual, an included file can have a return value *if you give it one*. If you have code there that's echoing/printing, that will indeed spit out immediately. The trick is to instead capture that output into a variable and return it. //simpleinclude.inc ?php $ret=somefunct(foo); $ret.=anotherfunct(bar); return $ret; ? //otherpage.php ?php $banner=include(simpleinclude.inc); ... echo $banner; ? -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] I'm not username, log me out....
I found sessions to be kind of fussy to get working, perhaps that's just because I didn't have any experience with them until the last site I did... A simple call to session_unset() won't erase the session, but should clear whatever username/passkey (I say passkey, assuming/hoping it's encrypted) is stored in the session. -Original Message- From: Andy Lewis [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 27, 2001 9:45 AM To: [EMAIL PROTECTED] Subject: [PHP] I'm not username, log me out Hello All, I'm trying to use php sessions to logout a user that may be sharing a computer with another user. In other words. I don't want user1 to access my site and then user2 be able to access user1's account with an auto login because the session was saved. I've seen a few sites that have a URL or button that a user can click on such as: I'm not Joe Smith, please log me out. This is what I am trying to accomplish. Can someone point me in the right direction? I have sessions implemented using username and password but, on my login page since those vars are saved in the session the user automatically gets logged in. I also would like to have a checkbox on the login page that, if checked, doesn't cache the username and password. So if they logout they must enter a username and password, instead of getting automatically logged in. Any help will be highly appreciated. Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: FTP or Telnet files/directories with PHP?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jeff Gannaway) wrote: Can PHP run some FTP or TELNET commands? http://php.net/ftp http://php.net/fsockopen -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Replace text
Hello guys function replace_text_smiley(){ global $comment; // To add a relation between a text smiley a an image smiley do this: // $faces[text smiley here] = img tag to image smile here; $faces[:)] = IMG SRC=\emoticons/smile.gif\; $faces[:P] = IMG SRC=\emoticons/tongue.gif\; $faces[:D] = IMG SRC=\emoticons/happy.gif\; $faces[:(] = IMG SRC=\emoticons/mad.gif\; $faces[;)] = IMG SRC=\emoticons/wink.gif\; while(list($text,$image) = each($faces)) { $comment = str_replace($text,$image,$comment); } return $comment; } this function replaces faces to smilies images then in a separete file i use this function and another one to replace urls... the url replacement is ok but it doesn't change the text to smilies.. any guesses?? :) =do you really want those quotation marks in the str_replace function call? =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] command line option f -- how do i get the name of the file?
I am writing a script using php's command line ability and I am lost on how to work with a file when I don't kow what the file's name is. Example: script.php -f file In my script, how do I reference the file when I have no idea what it's name is going to be? The scrip will get called by another application: the other application will pipe a file to my scrip and then the scrip has to work with the file and output an altered file with a new filename. I have no idea what the name of the file is going to be beforehand. lucas Take a look at environment variables (etc). =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Q: System user and password
Hi! I plan to build a web page which will use my system user. So what function should I use to check the system password. FYI I'm using Linux RedHat. Thanks in advance. -TaiPan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] array_search()
I'm trying to figure out how am I supposed to write this snippet properly: if (($index = array_search($search, array_keys($pages))) !== false) { echo index: $index\n; } else { echo Not found\n; } When I search for something that I know exists, it returns the $index just fine. However, when I search for something that does not exist, it never tells me 'Not found', instead it just displays a blank index (it looks like $index = , not false). Should I be checking it against 'false', or against ? Using PHP 4.0.7-dev. -- W | I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help needed for multimania.com
http://babelfish.altavista.com That URL may help you translate the page... Andrew - Original Message - From: Kamran H. Hassan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, October 27, 2001 7:22 PM Subject: [PHP] help needed for multimania.com Hi, Thanks for the info. about free web hosting www.multimania.com , i will be greateful if any one help in the steps of config. mysql and php on this web hosting, the problem is that site is in non-english language (i think its in french which i dont understand). if any one let me know briefly the steps to upload my website on that web hosting provider i will be very much greateful. i registered a web space at http://khamid.multimania.com hoping for reply and thanks in advance. Kamran H. Hassan _ U wrote | www.multimania.com (php + mysql) | | If you find better ones, please let me know :o) | | See you | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: include-ing results in variable?
Thanks for your help, I've got it working now (I think!). You're right, I had an echo at the bottom of the included script and I think was loathe to mess with it since I spent about 12 hours getting that one to work! I had read the man page for include -- even the example with the return! -- about a hundred times today, but it just didn't make sense in my head even though I suspected it was related to my problem. This is my first foray into any kind of programming since I played with Turbo Pascal about 10 years ago, so I'm fumbling around a bit :) thanks again, nathaniel What's in banner.inc? Because, as noted in the manual, an included file can have a return value *if you give it one*. If you have code there that's echoing/printing, that will indeed spit out immediately. The trick is to instead capture that output into a variable and return it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Multi-dimensional nested arrays in Smarty
I've asked a few questions before on Smarty here and I've worked through them but this one really has me. I checked the Smarty lists for answers and couldn't find a clear answer. Here is my problem. i want to do something to this effect {section name=loop_index loop=$DATA_ARRAY} {$DATA_ARRAY[loop_index].somevalue} {section name=loop_index2 loop=$INNER_ARRAY[loop_index]} {$INNER_ARRAY[loop_index][loop_index2].SOMEVALUE} {/section} {/section} I basically have an associative array $DATA_ARRAY and I want a second two dimensional array where the first array index is the subscript of the first so I basically iterate through the second array within a specific row. but for the life of me I can't get this properly. how would I set this up properly during assignment and output? I believe the above is right for output but what about assignment? $templ_var-append(INNER_ARRAY, ?); I've tried a lot of things but none seem to work... If anyone of you have any insight it would be greatly appreciated. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how to recognize local or server execution?
Dl Neil [EMAIL PROTECTED] wrote in message 0a4e01c15e72$c47db560$a516100a@jrbrown">news:0a4e01c15e72$c47db560$a516100a@jrbrown... Thanks for the idea. I have just resurrected and had another play with my 'testbench.php', running it from both IE/Apache and in a DOS box. It includes the following code: [...] Thanks (also thanks to the others for the useful comments ideas). I don't have $HTTP_SERVER_VARS[SERVER_NAME] or $GLOBALS[SERVER_ADDR] or $SERVER_SOFTWARE probably because my server is netscape (nsapi?). They are all blank. Yes I declared them 'global'. I ended up with these functions which seem to do the trick, at least for my server and NT. function isonserver() { global $PHP_SELF,$argc; return $argc==0 isset($PHP_SELF) $PHP_SELF; } function getpagename() { global $PHP_SELF,$argv; return basename(isonserver() ? $PHP_SELF : $argv[0]); } function getlinedelimiter() { return isonserver() ? \n : \r\n; } The pagename is critical to my site, because the code needs the page name to recognize certain suffixes and 'special page names. Perhaps it is only sufficient to test for $PHP_SELF and not $argc, but I threw in $argc==0 anyway. -- John A. Grant * I speak only for myself * (remove 'z' to reply) Radiation Geophysics, Geological Survey of Canada, Ottawa If you followup, please do NOT e-mail me a copy: I will read it here -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problem redirecting
Hi, I have a form which when submitted, calls an html page which contains PHP code. Within that code, I wish to redirect my users to another page under certain conditions. So, in my code, I have the following lines: Header( Location:http://www.mydomain.com/mypage.html;); exit; However, when the above is run, I get the following error generated: Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/vhosts/mydomain.com/htdocs/mypage.html:7) in ../phpscript/general/formmail.php on line 100 Does anyone know what this error means? hanks, Don
[PHP] Re: Problem redirecting
From the manual: Remember that the header() function must be called before any actual output is sent, either by normal HTML tags blank lines in a file, or from PHP. This is the cause of your error. Something is sending output before your call to header(); -- Justin Garrett Don [EMAIL PROTECTED] wrote in message 000c01c15f67$1a06ad80$[EMAIL PROTECTED]">news:000c01c15f67$1a06ad80$[EMAIL PROTECTED]... Hi, I have a form which when submitted, calls an html page which contains PHP code. Within that code, I wish to redirect my users to another page under certain conditions. So, in my code, I have the following lines: Header( Location:http://www.mydomain.com/mypage.html;); exit; However, when the above is run, I get the following error generated: Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/vhosts/mydomain.com/htdocs/mypage.html:7) in ../phpscript/general/formmail.php on line 100 Does anyone know what this error means? hanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] some.php/value - on win32
hi, I can make an URL like www.some.com/index.php/value1/value2/ on Linux+Apache but I can't do it on my win2k+apache 1.3.22 machine. Why? How could I do it? (I want to get values with explode ('/',$PATH_INFO) ) Thanx a lot! c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: problems with sessions (not working)
Christian Dechery wrote: I have a file called miec.php that does quite a lot of processing and then include()s user_track.inc.php... Where did you register the session variable? If you are registering local variable as session variable, it may not work... I suggest to use $HTTP_SESSION_VARS, if it is possible... -- Yasuo Ohgaki miec.php: ? a lot of db processing (NO OUTPUT whatsoever) include(user_track.inc.php); UserTrack($products); the output starts here... ? user_track.inc.php: -- ? session_start(); function UserTrack($products) { global $prod_views; if( !session_is_registered(prod_views) ) { fill the $prod_views array, serialize it... session_register(prod_views); // I've tested the code above... and session_register returns TRUE and I saw the session file... } else { do other stuff with the prod_views array } } ? the problem is why does it NEVER go into the 'else'... it seems that the session is registered... but as soon as I refresh the page the session is lost... why? _ . Christian Dechery . . Gaita-L Owner / Web Developer . . http://www.webstyle.com.br . . http://www.tanamesa.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]