[PHP-DB] csv without line feed
Hi, I have text file with CSV like format (use # sign separate each field) but there did not have any end of line character. This file could open in m$ excel but if I opened it in any text editor it will display in 1 line. How could I handle this file in PHP code? let see the example it attach file. Sommai Fongnamthip. 28-03-2002# #TR DEP##794,299.09#6,288,278.76#043 28-03-2002# #CASH DEP# #34,107.00#6,322,385.76#076 28-03-2002# #CASH DEP##341,410.84#6,663,796.60#005 28-03-2002#6779642 #TR WTD CHQ#62,332.81# #6,601,463.79#047 28-03-2002# #CASH DEP##120,313.13#6,721,776.92#084 28-03-2002# #ELC TR-BOA# #33,464.98#6,755,241.90#127#REFER TO : ASIA1272053867#REFER TO : ASIA0911006286# # # # 28-03-2002# #CASH DEP##260,695.50#7,015,937.40#067 28-03-2002# #CASH DEP# #253,175.44#7,269,112.84#067 28-03-2002# #TR DEP##45,431.00#7,314,543.84#091 28-03-2002#6779645 #TR WTD CHQ#6,664.81# #7,307,879.03#091 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL/PHP Update
i think the problem is bad syntax: you should try: mysql_query(update prod_list set prod_manu=$prod_man where sku='.$prod.'); that is because when you have single quotes you will not evaluate the expression so your querry will do the update only for sku equally with the string '$prod'... hope this help, cristi radulescu MU Jason a écrit : I'm trying to update my MySQL database, but it doesn't seem to be taking. my code is: mysql_query(update prod_list set prod_manu=$prod_man where sku='$prod'); where prod_manu is an int $prod_man is an int sku is a varchar $prod is text mysql_query() comes back successful, and just to be sure I echoed mysql_error() and nothing came back. What am I doing wrong? MU if you already have an row with that data, mysql doesn't update the db... MU do an echo $query to see what exactly is executed. MU ($query = update prod_list set prod_manu=$prod_man where sku='$prod') _ Do You Yahoo!? Get your free yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] csv without line feed
Something I used to do about 17-18 years ago to analyse typeseting code was to use DOS's 'Debug'. It gave a hex value for each character in one panel while scrolling thru the file. Compare this against the Excel printout and you should find what code is being used for lf. Hoping that debug is still available from the C: prompt? George - Original Message - From: Sommai Fongnamthip [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 8:53 AM Subject: [PHP-DB] csv without line feed Hi, I have text file with CSV like format (use # sign separate each field) but there did not have any end of line character. This file could open in m$ excel but if I opened it in any text editor it will display in 1 line. How could I handle this file in PHP code? let see the example it attach file. Sommai Fongnamthip. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] csv without line feed
I have hex text editor which could display hex value for each character. I fould that this text file has only carriage-return (0D) in end of record but other text file had carriage-return with line feed (0D 0A). So, when I open this file with fget or fgetcsv; PHP treat for 1 record or 1 line. If someone known how to handle only carriage-return character, please tell me. Sommai At 09:06 28/3/2002 +, George Pitcher wrote: Something I used to do about 17-18 years ago to analyse typeseting code was to use DOS's 'Debug'. It gave a hex value for each character in one panel while scrolling thru the file. Compare this against the Excel printout and you should find what code is being used for lf. Hoping that debug is still available from the C: prompt? George - Original Message - From: Sommai Fongnamthip [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 8:53 AM Subject: [PHP-DB] csv without line feed Hi, I have text file with CSV like format (use # sign separate each field) but there did not have any end of line character. This file could open in m$ excel but if I opened it in any text editor it will display in 1 line. How could I handle this file in PHP code? let see the example it attach file. Sommai Fongnamthip. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215
PHP 4.1.2 Apache 1.3.23 Slackware 7.1 Sybase: Adaptive Server Anywhere 8 iODBC - libiodbc-3.0.5 database created with 1251CYR collation work fine with cyrillic strings trough windows app (ODBC) but with PHP on linux trough iODBC Adaptive Server Anywhere ODBC driver 8.0.x not ODBC.INI- [ODBC Data Sources] aaa=Adaptive Server Anywhere ODBC driver 8.0.x [aaa] Driver=/usr/local/sybase/SYBSsa8/lib/dbodbc8.so ServerName=alpha CommLinks=tcpip CS=cp1251 tried also CS=1251CYR CS=Charset=cp1251;CollationLabel=1251CYR Charset=cp1251 CollationLabel=1251CYR Any help be welcome 10x
Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215
Do you receive ???s ? Regards, Andrey - Original Message - From: Igor Georgiev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 7:11 PM Subject: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215 PHP 4.1.2 Apache 1.3.23 Slackware 7.1 Sybase: Adaptive Server Anywhere 8 iODBC - libiodbc-3.0.5 database created with 1251CYR collation work fine with cyrillic strings trough windows app (ODBC) but with PHP on linux trough iODBC Adaptive Server Anywhere ODBC driver 8.0.x not ODBC.INI- [ODBC Data Sources] aaa=Adaptive Server Anywhere ODBC driver 8.0.x [aaa] Driver=/usr/local/sybase/SYBSsa8/lib/dbodbc8.so ServerName=alpha CommLinks=tcpip CS=cp1251 tried also CS=1251CYR CS=Charset=cp1251;CollationLabel=1251CYR Charset=cp1251 CollationLabel=1251CYR Any help be welcome 10x -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Reading a file and inserting into Access
Is it possible Access to load a bunch of SQLs and execute them? If it is possible it is better than CSV. Mysql has a command-line tool for table database dump into SQLs. Another solution is to look at PHPMyAdmin's code to view how it dumps tables. Best regards, Andrey Hristov - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 1:06 PM Subject: [PHP-DB] Reading a file and inserting into Access I'm currently working on a solution to distribute to my users. I will be sending them updates of tab-separated records to import into their Access databases. the distributed solution is php-based and I would like to be able to build in an admin utility to allow them to select the file and iupload it into a particular table. Just to save starting from scratch, does anyone have something like this, that they are prepared to share? Regards George in Edinburgh BTW my users are all university staff. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Compiling PHP4 with Informix on Red Hat 7.2
Hi all, I am trying to compile PHP4 with Informix support on Red Hat Linux 7.2. I am using the latest Red Hat source RPM package: php-4.0.6-12.i386.rpm I am using the latest Informix Client Software Development Kit, which I downloaded from IBM's Informix web site: [root@skynet SPECS]# rpm -qa | grep csdk csdk-2.70.UC3-1 The csdk is installed in /opt/informix. $INFORMIXDIR is set to /opt/informix. User informix and group informix exist on the system. I used the serial number and key supplied during download to install the csdk. I checked that ising any other serial number and key does not allow the installation to proceed. The installation did not return any errors. I have edited the rpm spec file to include the PHP compile-time informix option: --with-informix=/opt/informix The configuration part of the build process works fine. Compilation begins and then exits with: --- Begin relevant screen output --- Making all in informix make[2]: Entering directory `/usr/src/redhat/BUILD/php-4.0.6/build-cgi/ext/informix' make[3]: Entering directory `/usr/src/redhat/BUILD/php-4.0.6/build-cgi/ext/informix' (if test -d /opt/informix; then \ /opt/informix/bin/esql -e -EDHAVE_IFX_IUS /usr/src/redhat/BUILD/php-4.0.6/ext/informix/ifx.ec; \ else \ touch ifx.c; \ fi) Invalid serial number. Please consult your installation instructions. make[3]: *** [ifx.c] Error 255 make[3]: Leaving directory `/usr/src/redhat/BUILD/php-4.0.6/build-cgi/ext/informix' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/usr/src/redhat/BUILD/php-4.0.6/build-cgi/ext/informix' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/src/redhat/BUILD/php-4.0.6/build-cgi/ext' make: *** [all-recursive] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.8748 (%build) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.8748 (%build) --- Ebd relevant screen output --- I have contacted IBM's support desk and they're at a complete loss. If anyone here can help, I'd be more than grateful. Best regards, | George Karaolides Linustech Advanced Solutions, | | tel: +357 22 55 61 29 86 Ifigenias Street, 3rd Floor, | | web: www.linustech.com.cy Strovolos, Nicosia CY 2003, | | email: [EMAIL PROTECTED] Republic of Cyprus. | -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215
This seems a unicode problem to me. Here we have similar problem when PHP connects to Access 2000 and receives ???s. No problems with Access 97. Are you sure that the data is 1 byte not unicode format? Andrey - Original Message - From: Igor Georgiev [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 2:20 PM Subject: Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215 I recive this PHP - in DB - Нормативна уредба - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Igor Georgiev [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 12:09 PM Subject: Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215 Do you receive ???s ? Regards, Andrey - Original Message - From: Igor Georgiev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 7:11 PM Subject: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215 PHP 4.1.2 Apache 1.3.23 Slackware 7.1 Sybase: Adaptive Server Anywhere 8 iODBC - libiodbc-3.0.5 database created with 1251CYR collation work fine with cyrillic strings trough windows app (ODBC) but with PHP on linux trough iODBC Adaptive Server Anywhere ODBC driver 8.0.x not ODBC.INI- [ODBC Data Sources] aaa=Adaptive Server Anywhere ODBC driver 8.0.x [aaa] Driver=/usr/local/sybase/SYBSsa8/lib/dbodbc8.so ServerName=alpha CommLinks=tcpip CS=cp1251 tried also CS=1251CYR CS=Charset=cp1251;CollationLabel=1251CYR Charset=cp1251 CollationLabel=1251CYR Any help be welcome 10x -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215
SQL Anywhere docs says : Collation label Type Description 1251CYR ANSI Code Page 1251, Windows Cyrillic - Original Message - From: Andrey Hristov [EMAIL PROTECTED] To: Igor Georgiev [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 1:07 PM Subject: Re: [PHP-DB] Sybase: Adaptive Server Anywhere 8 on Linux: problem with cp1215 This seems a unicode problem to me. Here we have similar problem when PHP connects to Access 2000 and receives ???s. No problems with Access 97. Are you sure that the data is 1 byte not unicode format? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MS SQL connect
I'm trying to connect to an MS SQL Server but I'll receive permanetly this message: Warning: MS SQL message: Login failed for user 'mirela'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in d:\inetpub\wwwroot\roslocal\registrums.php on line 24 Warning: MS SQL: Unable to connect to server: aserver in d:\inetpub\wwwroot\roslocal\registrums.php on line 24 Nu am reusit sa ma conectez If I run an ASP code it works fine. Can anyone help me. The cod is: .. ?php $nume1=ereg_replace(,,;,$HTTP_POST_VARS['nume']); $prenume1=ereg_replace(,,;,$HTTP_POST_VARS['prenume']); $orasp1=ereg_replace(,,;,$HTTP_POST_VARS['orasp']); $dataa=getdate(); $zi = $dataa['mday']; if (strlen($zi)2) { $zi=0.$zi; } $luna = $dataa['mon']; if (strlen($luna)2) { $luna=0.$luna; } $an = $dataa['year']; $datar1=$zi./.$luna./.$an; $conex=mssql_connect(aserver,mirela,mirela); if (!$conex) { die(Nu am reusit sa ma conectez); } $baza=mssql_select_db(registru); if (!$baza) { die(Nu am reusit sa ma conecte la baza registru); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle INSERT
Hi, This is probably more of a topic for the Oracle groups - however: This gives me an error: $c1 = ocilogon(chris,chris01); $sql = INSERT INTO tblTest VALUES(1,'Test One'),(2,'Test Two'); $stat= ociparse($c1,$sql); It would appear my INSERT syntax is illegal under Oracle. Qu: How can I INSERT multiple rows with ONE statement? Thanks in advance. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Ingres Resultsets
Hi All ! I need to keep two resultsets opened at the same time... on Ingres. The records of the outter recordset are used to execute the inner query. I will explain in more detail... Example 1 *** $sql = select * from dummy ; $db = ingres_connect (guitar::rulez); ingres_query($sql,$db); while ($outter_resultset = ingres_fetch_array(INGRES_BOTH,$db)) { echo 'hello...'; } *** In example 1, the query is returning 2 rows... and writing 'hello' twice... It's Ok... but Example 2 *** $sql = select * from dummy ; $db = ingres_connect (guitar::rulez); ingres_query($sql,$db); while ($outter_resultset = ingres_fetch_array(INGRES_BOTH,$db)) { $sql = select * from son_of_dummy where cod= . $outter_resultset [cod]; $db1 = ingres_connect (guitar::rulez); ingres_query($sql,$db1); $inner_resultset = ingres_fetch_array(INGRES_BOTH,$db); echo 'hello'; } *** In the example 2, the outter query returns the first row (of 2)... and then runs the inner query... The inner query returns only 1 row... ok... But now, the while loop should run once more to get the second row (the outter query should return 2 rows).. but it stops... !!! The execution of the inner query prevents the outter query to get more rows... The solution I found for a while is to run the outter query, and put all the rows in an array... and then run over this array, and then run the inner query for eache row of the array (it sucks!!!) Does PHP have support for multiple opened connections to the Ingres database Or does it have support for resultsets Thanks in advance!! Christian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: MS SQL connect
On Thu, 28 Mar 2002 14:44:23 +0200, Cid [EMAIL PROTECTED] wrote: I'm trying to connect to an MS SQL Server but I'll receive permanetly this message: Warning: MS SQL message: Login failed for user 'mirela'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in d:\inetpub\wwwroot\roslocal\registrums.php on line 24 Warning: MS SQL: Unable to connect to server: aserver in d:\inetpub\wwwroot\roslocal\registrums.php on line 24 Nu am reusit sa ma conectez If I run an ASP code it works fine. seems your SQL Server accepts only trusted login requests (the 'Windows authentication'). It's not quite perfectly works in PHP. You would either set up your MSSQL on 'SQL authentication' too or try to get the FreeTDS (if your PHP MSSQL extension compiled with it) connect via this authentication. As far as I read their mailing list it is not impossible, I didn't try myself though. Seems your ASP web server able to connect via those trusted sockets What the database interface of your choice for them? ODBC? ADO? else? perhaps PHP can handle them? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL/PHP Update
Jason, this is intriguing. Please show us a bit more code before the mysql_query() call. -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 1:54 AM To: Php-Db Subject: [PHP-DB] MySQL/PHP Update I'm trying to update my MySQL database, but it doesn't seem to be taking. my code is: mysql_query(update prod_list set prod_manu=$prod_man where sku='$prod'); where prod_manu is an int $prod_man is an int sku is a varchar $prod is text mysql_query() comes back successful, and just to be sure I echoed mysql_error() and nothing came back. What am I doing wrong? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] https post using php
on 3/27/02 11:45 PM, mailing list at [EMAIL PROTECTED] appended the following bits to my mbox: I am attempting to POST to a https://whatever.url.com server and return the result from the server into the script without the user knowing using a php script. I can not use CURL becuase the shared server I have hosting this site was not compiled -with-curl. I downloaded HTTP_POST PHP script from: http://px.sklar.com/code.html?code_id=313. Here is my code that I am using to call the functions: Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. 1) Since this post is non-database related, it should be posted to the PHP-General list. 2) That said, I don't think it's possible to do what you want without curl. There's much more to an SSL/HTTPS connection that talking on a different port. Paul ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] https post via php
Hello, I am attempting to POST to a https://whatever.url.com server and return the result from the server into the script without the user knowing using a php script. I can not use CURL becuase the shared server I have hosting this site was not compiled -with-curl. I downloaded HTTP_POST PHP script from: http://px.sklar.com/code.html?code_id=313. Here is my code that I am using to call the functions: ?php require('classes2.php'); //instantiate class http_post $a = new http_post; //define variables $a-set_server(onlinechecks.interceptcorporation.com); $a-set_port(443); $a-set_file(/icolc/short.cgi); $a-set_action(https://onlinechecks.interceptcorporation.com/icolc/short.cgi;); $a-set_enctype(application/x-www-form-urlencoded); $a-set_element(array(MEN = 789,MPA = 456, MID = 7015,CRO = 123456780,CAC = 123123123, CPH = 17015551212,PAM = 12.34)); $a-set_timeout(20); $a-show_post(); $a-send($display=1); ? Here is the result returned from the browser: Bad Request Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. Hint: https://206.11.164.21/ Apache/1.3.20 Server at 206.11.164.21 Port 80 Does anyone have any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL/PHP Update
On Thursday 28 March 2002 17:04, cristi radulescu wrote: i think the problem is bad syntax: you should try: mysql_query(update prod_list set prod_manu=$prod_man where sku='.$prod.'); that is because when you have single quotes you will not evaluate the expression so your querry will do the update only for sku equally with the string '$prod'... I'm afraid that is incorrect. Try it for yourself: ? $doo = 'dah'; echo Doo is '$doo'; ? His problem lies elsewhere. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Nature abhors a virgin -- a frozen asset. -- Clare Booth Luce */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL/PHP Update
Actually... this turned out to be something totally unrelated. Thanks for all the interest tho. Missing little things like variable spelling is why you shouldn't code for 18 hours straight. Jason Cathcart Check Out My Site: http://www.biohazardous.org -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: March 28, 2002 7:20 AM To: 'Jason'; Php-Db Subject: RE: [PHP-DB] MySQL/PHP Update Jason, this is intriguing. Please show us a bit more code before the mysql_query() call. -Original Message- From: Jason [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 1:54 AM To: Php-Db Subject: [PHP-DB] MySQL/PHP Update I'm trying to update my MySQL database, but it doesn't seem to be taking. my code is: mysql_query(update prod_list set prod_manu=$prod_man where sku='$prod'); where prod_manu is an int $prod_man is an int sku is a varchar $prod is text mysql_query() comes back successful, and just to be sure I echoed mysql_error() and nothing came back. What am I doing wrong? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Oracle INSERT
I'm not sure.. but try the folowing statements: $sql = INSERT INTO tblTest VALUES(1,'Test One') INSERT INTO tblTest VALUES(2,'Test Two') INSERT INTO tblTest VALUES(3,'Test Three') ; (just repeating the insert statement... ) or (repeating the insert statement, separated by semicolon...) $sql = INSERT INTO tblTest VALUES(1,'Test One'); INSERT INTO tblTest VALUES(2,'Test Two'); INSERT INTO tblTest VALUES(3,'Test Three'); ; Chris Andrew wrote: Hi, This is probably more of a topic for the Oracle groups - however: This gives me an error: $c1 = ocilogon(chris,chris01); $sql = INSERT INTO tblTest VALUES(1,'Test One'),(2,'Test Two'); $stat= ociparse($c1,$sql); It would appear my INSERT syntax is illegal under Oracle. Qu: How can I INSERT multiple rows with ONE statement? Thanks in advance. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] include() statement hell!
So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has functions that do connections and queries to a mysql database. Even stranger yet, is that I have one other include file called userlib.inc that has authentication related session functions. Well, that hasn't worked at all no matter what, unless I put the functions in /includes/userlib.inc directly into the file /main/page.php. Once there, all the functions work fine. Otherwise, the only error messages I get are regarding unknown functions being referenced, yet, I never get an error that the include files can't be found. It's all crazy to me. Currently, both of my include files are called directly with two lines like: include(dblib.inc); include(userlib.inc); They are both located in /main/ along side page.php which is calling them. They both seem to work this way, but as soon as I place them in /includes/ and try to call them using: include(includes/dblib.inc); include(includes/userlib.inc); I get errors saying that the functions can't be found, however, no errors saying it can't find the include files?? Lastly, even with both include files in /main/ I still have some strange problem with my userlib.inc file because the single function that is in there won't work unless the function is pasted directly into /main/page.php. I think I've made this message way too long but I appreciate your help. I've got the page working reliably with the functions all pasted into page.php but not while including those functions. I just can't think of what could be making it difference. The functions are all the same, just running from an include file is a problem. Thanks again, just writing this up has helped to make more sense to me. I think the crux of the whole thing is the path. I'm using to including files in ASP and those can be relative so something like ../includes/dblib.inc works great. ...Brad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] include() statement hell!
I have found the best way for me is always include with the fullpath ie, include(/usr/httpd/mysite/include.inc); or: include($_SERVER['DOCUMENT_ROOT']/include.inc); Then you can include files that are elswhere: include(/usr/httpd/virtual-domain-includes/multi-user-include.inc); these will work no matter what dir or sub dir the page calling the include is in... (I haven't Followed This entire thread.. so sorry if I missed something) JD -Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 10:10 AM To: 'Brad Melendy'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] include() statement hell! So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has functions that do connections and queries to a mysql database. Even stranger yet, is that I have one other include file called userlib.inc that has authentication related session functions. Well, that hasn't worked at all no matter what, unless I put the functions in /includes/userlib.inc directly into the file /main/page.php. Once there, all the functions work fine. Otherwise, the only error messages I get are regarding unknown functions being referenced, yet, I never get an error that the include files can't be found. It's all crazy to me. Currently, both of my include files are called directly with two lines like: include(dblib.inc); include(userlib.inc); They are both located in /main/ along side page.php which is calling them. They both seem to work this way, but as soon as I place them in /includes/ and try to call them using: include(includes/dblib.inc); include(includes/userlib.inc); I get errors saying that the functions can't be found, however, no errors saying it can't find the include files?? Lastly, even with both include files in /main/ I still have some strange problem with my userlib.inc file because the single function that is in there won't work unless the function is pasted directly into /main/page.php. I think I've made this message way too long but I appreciate your help. I've got the page working reliably with the functions all pasted into page.php but not while including those functions. I just can't think of what could be making it difference. The functions are all the same, just running from an include file is a problem. Thanks again, just writing this up has helped to make more sense to me. I think the crux of the whole thing is the path. I'm using to including files in ASP and those can be relative so something like ../includes/dblib.inc works great. ...Brad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL, PHPand cron
Hi all, Wondering if anyone might know how to empty a table with a php script and cron job? Would someone point me to a tutorial or help with this? TIA Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL, PHPand cron
First create the PHP script to connect to the database and empty the table (DELETE FROM table;) as if you were going to visit the page manually every time you wanted to empty the table. This shouldn't be too hard: ? // EmptyTable.php $dbLink = mysql_connect(host,user,pass); mysql_select_db(database_with_table_in_it); mysql_query(DELETE FROM table); ? Once you have that working (test it by visiting the page and then checking to see if it emptied the table), now you want to get cron to run that script on a certain schedule. There are two ways to do this. #1 --- If your host has the command-line/CGI version of PHP installed, you can simply have cron run: /path/to/php /path/to/EmptyTable.php. It would more realistically look like: /usr/local/bin/php /home/myaccount/EmptyTable.php -- #2 --- If #1 doesn't work (you don't have the CGI version installed), you can have another 3rd-party program request the page. For instance, most Linux systems have a utility called wget which retrieves web pages and files by running: wget http://www.domain.com/somepage.html You can have cron run that command to simulate a visit to that page, which effectively runs the script and the table gets emptied: wget http://www.yourdomain.com/EmptyTable.php -- - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 11:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL, PHPand cron Hi all, Wondering if anyone might know how to empty a table with a php script and cron job? Would someone point me to a tutorial or help with this? TIA Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Oracle INSERT
I don't know if you can do in one INSERT INTO statements per se in Oracle, try to separate insert into statements with semicolon(;) .. Or if you will insert the data that is already in another table you can use INSERT INTO ... SELECT ... FROM ... syntax. Gurhan -Original Message- From: Chris Andrew [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 8:15 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle INSERT Hi, This is probably more of a topic for the Oracle groups - however: This gives me an error: $c1 = ocilogon(chris,chris01); $sql = INSERT INTO tblTest VALUES(1,'Test One'),(2,'Test Two'); $stat= ociparse($c1,$sql); It would appear my INSERT syntax is illegal under Oracle. Qu: How can I INSERT multiple rows with ONE statement? Thanks in advance. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL, PHPand cron
Hi Jenn, There are a couple ways you can do this. You can write a unix shell script and run it periodically at the cron. Here: #!/bin/mysql query=DELETE FROM tablename /usr/bin/mysql -u USER -pPASSWORD -D database -e $query And then you can just put this script into cron, see: http://www.faqts.com/knowledge_base/view.phtml/aid/1005/fid/436 Or you can do the same in the PHP script and call PHP script in command line.. See the below links for this: http://www.php.net/manual/en/commandline.php http://www.phpbuilder.com/columns/darrell2319.php3 Gurhan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 2:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL, PHPand cron Hi all, Wondering if anyone might know how to empty a table with a php script and cron job? Would someone point me to a tutorial or help with this? TIA Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] include() statement hell!
Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include(../include/dblib.inc); include(../include/userlib.inc); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: php? session_start(); session_register( session ); function cleanSession( $id, $login, $pass ) { global $session; $session[id] = $id; $session[login] = $login; $session[password] = $pass; $session[logged_in] = true; } ? Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of Include Statement Hell. ;-) ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has functions that do connections and queries to a mysql database. Even stranger yet, is that I have one other include file called userlib.inc that has authentication related session functions. Well, that hasn't worked at all no matter what, unless I put the functions in /includes/userlib.inc directly into the file /main/page.php. Once there, all the functions work fine. Otherwise, the only error messages I get are regarding unknown functions being referenced, yet, I never get an error that the include files can't be found. It's all crazy to me. Currently, both of my include files are called directly with two lines like: include(dblib.inc); include(userlib.inc); They are both located in /main/ along side page.php which is calling them. They both seem to work this way, but as soon as I place them in /includes/ and try to call them using: include(includes/dblib.inc); include(includes/userlib.inc); I get errors saying that the functions can't be
RE: [PHP-DB] include() statement hell!
This might be your problem: php? Try: ?php :) - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include(../include/dblib.inc); include(../include/userlib.inc); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: php? session_start(); session_register( session ); function cleanSession( $id, $login, $pass ) { global $session; $session[id] = $id; $session[login] = $login; $session[password] = $pass; $session[logged_in] = true; } ? Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of Include Statement Hell. ;-) ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has functions that do connections and queries to a mysql database. Even stranger yet, is that I have one other include file called userlib.inc that has authentication related session functions. Well, that hasn't worked at all no matter what, unless I put the functions in /includes/userlib.inc directly into the file /main/page.php. Once there, all the functions work fine. Otherwise, the only error messages I get are regarding unknown functions being referenced, yet, I never get an error that the include files can't be found. It's all crazy to me. Currently, both of my include files are called directly with two lines like: include(dblib.inc); include(userlib.inc); They are both located in /main/ along side
RE: [PHP-DB] include() statement hell!
You should also put quotes around your keys in your arrays if they're non-numeric. For instance: $session[logged_in] instead of $session[logged_in] It's good coding habit, and it sometimes will save you from some constant headaches (pun intended for everyone who has run into this problem before). - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include(../include/dblib.inc); include(../include/userlib.inc); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: php? session_start(); session_register( session ); function cleanSession( $id, $login, $pass ) { global $session; $session[id] = $id; $session[login] = $login; $session[password] = $pass; $session[logged_in] = true; } ? Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of Include Statement Hell. ;-) ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has functions that do connections and queries to a mysql database. Even stranger yet, is that I have one other include file called userlib.inc that has authentication related session functions. Well, that hasn't worked at all no matter what, unless I put the functions in /includes/userlib.inc directly into the file /main/page.php. Once there, all the functions work fine. Otherwise, the only error messages I get are regarding unknown functions being referenced, yet, I
Re: [PHP-DB] include() statement hell!
Man, this means I have to walk around the block with a sign on my back saying, I'm a %*$-ASS for letting that one get by. ;-) Thanks a ton Jonathan. It of course, works now. I think it will be a while before I make that mistake again. ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... This might be your problem: php? Try: ?php :) - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include(../include/dblib.inc); include(../include/userlib.inc); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: php? session_start(); session_register( session ); function cleanSession( $id, $login, $pass ) { global $session; $session[id] = $id; $session[login] = $login; $session[password] = $pass; $session[logged_in] = true; } ? Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of Include Statement Hell. ;-) ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has functions that do connections and queries to a mysql database. Even stranger yet, is that I have one other include file called userlib.inc that has authentication related session functions. Well, that hasn't worked at all no matter what, unless I put the
RE: [PHP-DB] include() statement hell!
No problem. I wonder if there's a web-based syntax checker for PHP... - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:23 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Man, this means I have to walk around the block with a sign on my back saying, I'm a %*$-ASS for letting that one get by. ;-) Thanks a ton Jonathan. It of course, works now. I think it will be a while before I make that mistake again. ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... This might be your problem: php? Try: ?php :) - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include(../include/dblib.inc); include(../include/userlib.inc); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: php? session_start(); session_register( session ); function cleanSession( $id, $login, $pass ) { global $session; $session[id] = $id; $session[login] = $login; $session[password] = $pass; $session[logged_in] = true; } ? Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of Include Statement Hell. ;-) ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc
Re: [PHP-DB] include() statement hell!
I'll do that Jonathan. I want to thank you again, and everyone else that gave me suggestions. I think I finally understand all the 'rules' about the include statement AND that I've got to keep a close eye on my typos. Thanks once again! ...Brad :-) Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You should also put quotes around your keys in your arrays if they're non-numeric. For instance: $session[logged_in] instead of $session[logged_in] It's good coding habit, and it sometimes will save you from some constant headaches (pun intended for everyone who has run into this problem before). - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include(../include/dblib.inc); include(../include/userlib.inc); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: php? session_start(); session_register( session ); function cleanSession( $id, $login, $pass ) { global $session; $session[id] = $id; $session[login] = $login; $session[password] = $pass; $session[logged_in] = true; } ? Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of Include Statement Hell. ;-) ...Brad Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can see the whole filesystem, not just the area that is limited to your account. So, when you try to include /includes/dblib.inc it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include(dblib.inc); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include(../includes/dblib.inc); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include(includes/dblib.inc);. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has
RE: [PHP-DB] https post via php
The only way I can think of doing this is via cURL, so you'll need to either have the hosting company recompile their PHP with cURL (something any decent hosting company should do - it's not a difficult process), or have them provide an external curl module (like an .so file) so you can use the dl() function load it, which is basically the same as having curl compiled, but a tiny bit slower. Or you could also install the command-line version of cURL or any other https posting 3rd-party programs and have PHP use the command-line tools to post to https, but there's no other way that I know of. - Jonathan -Original Message- From: mailing list [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 6:39 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] https post via php Hello, I am attempting to POST to a https://whatever.url.com server and return the result from the server into the script without the user knowing using a php script. I can not use CURL becuase the shared server I have hosting this site was not compiled -with-curl. I downloaded HTTP_POST PHP script from: http://px.sklar.com/code.html?code_id=313. Here is my code that I am using to call the functions: ?php require('classes2.php'); //instantiate class http_post $a = new http_post; //define variables $a-set_server(onlinechecks.interceptcorporation.com); $a-set_port(443); $a-set_file(/icolc/short.cgi); $a-set_action(https://onlinechecks.interceptcorporation.com/icolc/short.cg i); $a-set_enctype(application/x-www-form-urlencoded); $a-set_element(array(MEN = 789,MPA = 456, MID = 7015,CRO = 123456780,CAC = 123123123, CPH = 17015551212,PAM = 12.34)); $a-set_timeout(20); $a-show_post(); $a-send($display=1); ? Here is the result returned from the browser: Bad Request Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. Hint: https://206.11.164.21/ Apache/1.3.20 Server at 206.11.164.21 Port 80 Does anyone have any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] parsing 2 results per row in different td's
why not simply call $row = mysql_fetch_array($result) again inside the loop? Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -Original Message- From: valentino [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 1:43 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] parsing 2 results per row in different td's i'm having trouble telling php to format the output of a mysql query correctly. i not only want to loop the output in simple table rows (meaning that php parses one result per row), instead i want php to parse two results per row in different td's. no clue what i'm talking about? take my following simplyfied code: $result = @mysql_query(SELECT * FROM news); ... while ( $row = mysql_fetch_array($result) ): ... tr td?=$row[newsBODY]?/td /tr endwhile; --- the output would look like: html tr tdblabla/td /tr tr tdlalala/td /tr tr tddoowaadee/td /tr tr tdyipeeiyo/td /tr --and so on-- what i want is the following output tr tdblablabla/td tdlalala/td /tr tr tddoowaadee/td tdyipeeiyo/td /tr --and so on-- got the point? i really do appreciate your help! thx, val -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unknown column 'Test' in 'field list'
Hi All! Hope I'm not bothering you nice people too much. I have a account called Test, when I click the submit button I get this error Unknown column 'Test' in 'field list' My table only has two fields id and user_name I am not trying to insert the data into the field Test but into usre_name. I had this problem once before but I can't remember how I fixed it or if I ever did. Any ideas? ?php if($action == Submit my entry){ if (!empty($name)){ $enter = insert into entry (id, user_name) values (' ',$name); mysql_query($enter) or die(mysql_error()); } exit; } $query=SELECT name FROM users WHERE uid=.$session[uid]; $ret = mysql_query($query) or die(myasql_error()); list($name) = mysql_fetch_array($ret); ? CENTERtable ALIGN=center WIDTH=80%tr tdform ACTION=?php echo($PHP_SELF);? METHOD=post ?php print tdbrUsername: input type=\text\ value=\$name\ name=\u_name\ size=30/td/tr\ntrtd; print input TYPE=\submit\ name=\action\ VALUE=\Submit my entry\BRBR; ? /form/td/tr /table/CENTER -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unknown column 'Test' in 'field list'
Never mind I forgot to put ' ' around $u_name in my insert. Jen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unknown column 'Test' in 'field list'
Change your query to this and make sure your ID field is set to auto_increment INSERT INTO entry (user_name) values ('$name') That'll work for sure! ;-) Jennifer Downey wrote: Hi All! Hope I'm not bothering you nice people too much. I have a account called Test, when I click the submit button I get this error Unknown column 'Test' in 'field list' My table only has two fields id and user_name I am not trying to insert the data into the field Test but into usre_name. I had this problem once before but I can't remember how I fixed it or if I ever did. Any ideas? ?php if($action == Submit my entry){ if (!empty($name)){ $enter = insert into entry (id, user_name) values (' ',$name); mysql_query($enter) or die(mysql_error()); } exit; } $query=SELECT name FROM users WHERE uid=.$session[uid]; $ret = mysql_query($query) or die(myasql_error()); list($name) = mysql_fetch_array($ret); ? CENTERtable ALIGN=center WIDTH=80%tr tdform ACTION=?php echo($PHP_SELF);? METHOD=post ?php print tdbrUsername: input type=\text\ value=\$name\ name=\u_name\ size=30/td/tr\ntrtd; print input TYPE=\submit\ name=\action\ VALUE=\Submit my entry\BRBR; ? /form/td/tr /table/CENTER -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php