[PHP] regexp to substitute incremental strings
Hello, I have a form whith a TEXTAREA FIELD to retrieve the html text of a message, and up to 10 file upload fields for images that may be linked from in that text. Now the text is uploaded fine, and so are all the images. Text is saved in UNIQUE_CODE.txt, and images in files UNIQUE_CODE_01.gif, UNIQUE_CODE_02.jpg, etc etc. All this is OK too. The problem is to convert all the SRC strings of the IMG tags in the original text to relative URLS. i.e. from: blah blah blah some text, html markup... blah blah again to: blah blah blah some text, html markup... blah blah again What is the right regexp to handle this, either in a while loop (how?) or all by itself? The closer I've come to the solution is: blah blah blah some text, html markup... blah blah again Meaning OK if there is only one image, only the last loaded image is pointed to otherwise, because I keep rewriting the previous tags. Sorry for not posting my code here, I'm out of town and have just been told of this problem by phone by the site owner... Any help is appreciated, mweb -- 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] strtoupper and HTML entities
It works! thanks a lot, Michael!! mweb On Sunday 23 December 2001 00:41, Michael Sims wrote: > At 11:32 PM 12/22/2001 +0100, mweb wrote: > >Hello, > > > >I know I can convert a string to all uppercases with the strtoupper() > >function. However, what if the original string contains HTML entities? > > > >EXAMPLE: > > > >original string = "funkstörung" > > Try this: > > function htmltoupper($str) { > $trans = get_html_translation_table (HTML_ENTITIES); > $trans = array_flip ($trans); > $str = strtr ($str, $trans); > $str = strtoupper($str); > $str = htmlentities($str); > return $str; > } > > $string = "funkstörung"; > > $string = htmltoupper($string); > > echo $string; > ?> -- 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] strtoupper and HTML entities
Hello, I know I can convert a string to all uppercases with the strtoupper() function. However, what if the original string contains HTML entities? EXAMPLE: original string = "funkstörung" contains lowercase o with dieresis (ö) properly displayed by browsers after strtoupper becomes: "FUNKSTÖRUNG" which is displayed by browsers literally, because capital O with dieresis is Ö The uppercase version correctly displayable in a browser should be: "FUNKSTÖRUNG How can I convert to uppercase everything except these entities? Is there a straightforward solution, or do I really put together a regex that puts in lowercase everything from the second letter after an ampersand to the first colon? Thanks, mweb -- 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: max # of characters for links to work in emails?
> The maximum allowed of characters in a domain name is 3 (www) + 64 > (domainname) + 3 (tld) = 70 chars. So if you try to limit it within the 70 > chars you should be safe. Uh? First of all it should be 73 (what listed plus three dots). In the second place, do you mean "allowed" as in " what *I* arbitrarily set as a limit in my code" or "allowed" as in " Standard so and so dictates this"? If so, which standard? OK for the tld part, but domains like: mywww.subnet.domain.com (leftmost substring > 3char, more than three substrings) do exist. mweb -- 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] Comparison between string failing
Hello, I can't understand why the piece of test code below produces the output : OK HERE VALUE 0:image/pjpeg; UPLOAD FAILED = ; VALUE =1:image/pjpeg; Basically I use or print several times the value $MYFILES['file_recensione']['tmp_name'][1] and it looks like it changes values from line to line (it's not a scope thing, I'm almost sure in this case: what is below is the whole file). Look at the line below with the string "ESTENSIONE", it should be printed instead of UPLOAD FAILED, right? Why doesn't it happen? mweb // global $MYFILES; $MYFILES['file_recensione']['tmp_name'][1] = 'image/pjpeg'; if ($MYFILES['file_recensione']['tmp_name'][1] == 'image/pjpeg') {print "OK HERE";} print "VALUE 0:".$MYFILES['file_recensione']['tmp_name'][1].";"; if (/*is_uploaded_file($MYFILES['file_recensione']['tmp_name'][1])*/ //($VAL == 1) && ( ($MYFILES['file_recensione']['type'][1] == 'image/jpeg') || ($MYFILES['file_recensione']['type'][1] == 'image/pjpeg') || ($MYFILES['file_recensione']['type'][1] == 'image/gif') // ) ) { $EXTGIF = 'jpg'; if (substr($MYFILES['file_recensione']['type'][1], -3) =='peg') { $EXTGIF = 'jpg';} if (substr($MYFILES['file_recensione']['type'][1], -3) =='gif') { $EXTGIF = 'gif';} print "ESTENSIONE = $EXTGIF;"; } else {print "UPLOAD FAILED".$MYFILES['file_recensione']['type'][1].";";} print "VALUE =1:".$MYFILES['file_recensione']['tmp_name'][1].";"; -- 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] Answer to: UPDATE Query works in odbc/Mysql, but fails in odbc/MS Access
Hello everybody This time I can answer to myself. I made it work changing the SQL statement from: UPDATE rec SET Aut = 1 WHERE Un = 2927230327; (works in MySQL) to UPDATE rec SET Aut = 1 WHERE Un in ('2927230327'); (works in Access) Now I'd like to know if the difference is due to the type of the "Un" column being different between the databases, MySQL and Access having actually different syntax, or any combination of the above. Comments? mweb On Thursday 06 December 2001 13:30, mweb wrote: > Hello, > > I have one MS Access DB on the server, and an exact (theoretically) copy of > it in MySQL on my machine, so I can test PHP pages on Linux and install > them on an NT server (using odbc of course). > > I can insert and select just fine, thankl to all your help. The problem is > that this UPDATE query: > UPDATE rec SET Aut = 1 WHERE Un = 2927230327; > > works perfectly on PHP/ODBC/MySQL on Linux, while on PHP/ODBC/ACCESS/ > it gives this error: > > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type > mismatch in criteria expression., SQL state 22005 in SQLExecDirect in > C:\domini\m.net\update_db.php on line 54 > No cursor > > Initially I though well, maybe I'm trying to write a string into a number, > or something like that, but I can SELECT from that same table using the > same format, so what is the trick? Different UPDATE syntax between MySQL > and ACCESS? If so, where is an online ACCESS syntax reference? > > TIA, > mweb -- 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] UPDATE Query works in odbc/Mysql, but fails in odbc/MS Access
Hello, I have one MS Access DB on the server, and an exact (theoretically) copy of it in MySQL on my machine, so I can test PHP pages on Linux and install them on an NT server (using odbc of course). I can insert and select just fine, thankl to all your help. The problem is that this UPDATE query: UPDATE rec SET Aut = 1 WHERE Un = 2927230327; works perfectly on PHP/ODBC/MySQL on Linux, while on PHP/ODBC/ACCESS/ it gives this error: Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in C:\domini\m.net\update_db.php on line 54 No cursor Initially I though well, maybe I'm trying to write a string into a number, or something like that, but I can SELECT from that same table using the same format, so what is the trick? Different UPDATE syntax between MySQL and ACCESS? If so, where is an online ACCESS syntax reference? TIA, mweb -- 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] What is causing duplicate keys?
Hello, Always struggling on my php-odbc-MS access project, I managed to successfully add a record to a table. Now, no matter what I write in the first field (random numbers, AUTO, AUTO_INCREMENT...) I get this: Insert Into recensioni VALUES (300, 'riee', 'reworew', 'wer', 2001,'IT', 2.5, 'dond to it, 'rew', 'uno',1, 'Caro', 3, 'stuff', 20011205201040, 'writeurl, 1, '5/12/2001 20.10.40', '1', '1','enter keyword') Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again., SQL state 23000 in SQLExecDirect in C:\domini\mnet\inser_rec.php on line 109 Error in odbc_exec( no cursor returned ) How can I find out what I am duplicating? The first field is the unique key, but what should I send to Access to tell it just auto increment and go? If I put 0 or NULL it complains. Also, Andrew Hill siggested the use of odbc_tables and odbc_columns to get info about the structure of each column which I don't know in detail because the DB was written by the guy who quit, not me) What is the exact syntax of those instructions? I have tried to apply the manual, but without success on the second one. TIA, mweb -- 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: FOLLOW UP on "column names not liked by odbc/php/access"
On Wednesday 05 December 2001 12:21, Dr. Michael Wittmann wrote: > - you dont need apostrophes for numeric fields. you get the table > definition using sql command 'DESC tablename' Thanks to Michael and all the others who pointed out my errors. The query works now. The real problem however, which is REALLY slowing me down, is that in this project I have to live with php+odbc+MS access, all on a remote server. I know the DESC instruction above, but access won't take it via odbc. It gave me this error: Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'., SQL state 37000 in SQLExecDirect in C/ etcetera.. This is the reason for all my questions in these days: is there really so little knowledge/documentation on how to handle this particular combination? If it were all mysql+apache+php I would perfectly manage everything by myself. I have also posted to comp.databases.ms.access without luck so far. Again, any pointer to such resources is appreciated. In the meantime, let me thank you all once more for your quick and kind suggestions. regards, mweb -- 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] Partial answer to "FOLLOW UP on "column names not liked by odbc/php/access"
OOPS... of couse the query below doesn't work, it doesn't have the table name (see below however) > ISQL_exec_String = "Insert Into (Artista, Opera, Label, Anno, Nazione, > CDNow, Autore, AutoreNome, Genere, GenereCustom, SulWeb, Autorizzato, > Unico, VALUES ('prova2', 'inedita', 'ignota', > '2001','IT', 'nonesiste', 'io', 'lui','3', 'ulteriori dettagli sul genere > musicale', 'http://www.no.it', '1', '20011205111456', 'asdas erfver', 'ciao > ni', '2.5', 'Non andare a capo!');" > > > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error > in INSERT INTO statement., SQL state 37000 in SQLExecDirect in > C:\domini\m.net\inserzione3.php on line 115 > Error in odbc_exec( no cursor returned ) Adding the table name, I "simply" get: Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in C:\domini\m.net\inserzione3.php on line 116 Error in odbc_exec( no cursor returned ) This is clear, but, since I just take over the database, no docs exists about it, and I only have Linux running right now at home, how do I fins out quickly which columns are type mismatch? the 2.5 value almost sure doesn't go into quotes, right? but what about the others? TIA, Mweb -- 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] FOLLOW UP on "column names not liked by odbc/php/access"
Hello, On the same database, this query works: $SQL_Exec_String = "INSERT INTO Multimedia (Titolo,Descrizione,Logo,Link) VALUES ('prova titolo','prova descrizione','.gif','prova link');"; $cur= odbc_exec( $cnx, $SQL_Exec_String ); This one gives this error: ISQL_exec_String = "Insert Into (Artista, Opera, Label, Anno, Nazione, CDNow, Autore, AutoreNome, Genere, GenereCustom, SulWeb, Autorizzato, Unico, VALUES ('prova2', 'inedita', 'ignota', '2001','IT', 'nonesiste', 'io', 'lui','3', 'ulteriori dettagli sul genere musicale', 'http://www.no.it', '1', '20011205111456', 'asdas erfver', 'ciao ni', '2.5', 'Non andare a capo!');" Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement., SQL state 37000 in SQLExecDirect in C:\domini\m.net\inserzione3.php on line 115 Error in odbc_exec( no cursor returned ) Does the second qyury look syntactically wrong to you? May it be that some column name or quoting is wrong, or some value I try insert is not matching the column type? If so, why would this be a *syntax* error? Is it possible to query access via Php so that it will tell the internal strucure of the table? (this database was developed and left online by somebody else, that's why I don't have all this info) Any help is greatly appreciated, as are working sql statements for similar (php+odbc+access) cases. regards, mweb -- 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] Column name not liked by PHP/ODBC and Access
On Tuesday 04 December 2001 23:25, Jim wrote: > I've searched high and low for _good_ PHP/MSACCESS info, but the fact > is not that many people use it. I know. It's not my choice, believe me.. :-(( > What I've found very helpful is to use MS ACCESS' SQL builder to test > out my queries. Fairly reliably, if it works there, it'll work in PHP. Fine, but I guess it won't run on my Linux PC, will it? I'll search the web for examples of its usage, anyway. Any pointer is appreciated. Thanks, mweb -- 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] Column name not liked by PHP/ODBC and Access
On Tuesday 04 December 2001 22:47, Andrew Hill wrote: > mweb, > > Just a guess - is Note a reserved word? you might want to quote/escape it. Excellent idea. Actually, putting Note between double quotes gives: INSERT INTO Red (ID, Nome, Nickname, Username, password, pict, "Note", admin, playlist, email, ruolo, web) VALUES (NULL , "mweb", "webfm", "webfm1", "12321", "0", "", "on", "on", "e2e2e", "222e", "www.ni.it"); Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] '' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long., SQL state 37000 in SQLExecDirect in C:\domini\musicboom.net\cng_red.php on line 71 Error(no cursor odbc_exec) How else could I escape Note, and what this last message means? In general do you know about *detailed* tutorial for MS access via odbc? TIA, mweb P.S.: special thanks to Andrew Hill who is always very fast and patient in his answers -- 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] Column name not liked by PHP/ODBC and Access
Hello, still fighting to drive MS access from PHP, I have come into an error when I feed odbc_exec with this statement (db connection is fine now): INSERT INTO Redazione (ID, Name, Nickname, Username, password, From, Note, amministratore, playlist, email, role, web) VALUES (NULL , "me", "webmin", "webber", "12321", "0", "", "on", "on", "e2e2e", "222e", "www.test.com"); Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement., SQL state 37000 in SQLExecDirect in C:\domini\m.net\cng_red.php on line 71 Error(no cursor odbc_exec) The weird thing is that I this syntax error ONLY if I write "Note in the columns list. If I omit it, or even change to not existing column name (like "note_fake" for example, no errors are reported. If I omit it I get just complaints that there are not enough fields, but no errors. Also, it couldn't care less what I put as the Note field value ("" in the case above). Ideas? Mweb -- 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] URGENT: IIS server now OK, but MS access DB not reachab le
On Tuesday 04 December 2001 13:29, Jon Haworth wrote: > Scope problem? > > Try this: > > function Output_Entries() { > global $DB_PATH, $DSN; > // rest of function > } YESS! (and an excellent demonstration that one should not code too many hours in a row :-(( ) Thanks to Jon and all the others, you were really precious. mweb -- 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] URGENT: IIS server now OK, but MS access DB not reachable
Still me. Thank you all, you were right!! The sysadmin did find out that the server config was wrong. Now php is OK. However, I have to access an MS access database with those pages. The sysadmin says relevant data are: DSN: domain Absolute path: c:\domini\domain_name.net\domaindata.mdb To give you an idea of the environment, a previous working ASP version was like this: Set conn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & Server.MapPath(".") & "\domain.mdb; Persist Security Info = False" The following snippet of code (copied from phpbuilder) fails as pasted at the end of the message. Now this must be even stupider than the other problem, but again any help is appreciated mweb ### MY CODE: $DB_PATH="c:\domini\domain_name.net\domaindata.mdb"; $DSN="domain"; / function Output_Entries() { //Make the connection to the database. The syntax is odbc_connect( 'SYSTEM_DSN' , 'USER', 'PASSWORD' ); //$cnx will hold the //pconnect is used to establish a persistent database connection to the Database //until the procedure is completed. $cnx = odbc_connect( $DSN , '', '' ); ## ERROR MESSAGE: Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\domini\domain_name.net\test.php on line 20 Error in odbc_connect Warning: Supplied argument is not a valid ODBC-Link resource in C:\domini\domain_name.net\test.php on line 52 Warning: Supplied argument is not a valid ODBC-Link resource in C:\domini\domain_name.net\test.php on line 52 -- 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] URGENT: IIS server doesn't recognize PHP pages
First of all, thanks to John, Emek and Phil. Glad to see unanimity about it being a server config problem. However: I have tried .php and .php4 extension without any luck. Didn't try .php3 because was giving for granted their setup is newer than two years ;-)) OK, I'll try that too >have you tried it with a > PERL-style shebang line at the top of your scripts? Give something like: > > #!/usr/bin/php -q On a WinNT/IIS box? I'll try, but never read anything like this... Anyway, the sysadmin just emailed that he is going to check: we'll see. In the meantime, anybody with a working php.ini file for IIS please send it (to me of course, not the list) TIA, mweb -- 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] : IIS server doesn't recognize PHP pages
On Tuesday 04 December 2001 12:04, Emek TUZUN wrote: > Hello, > > Unfortunately, your ISP doesn't support PHP. They should install PHP Win32 > but I think they don't want to install PHP for only your customer's > site Emek, I have a message in my mailbox from the sysadmin (CC'd to the customer) saying that they *DO* support PHP (otherwise I would not have accepted the job..) I am almost sure that the problem is simply that the guy is very expert with NT/IIS/ASP/VBScript, and at a basic level on other topics, included this one. So, it must be a config issue, but which one? What should I tell him? Unless, of course, there is something really screwed in my code, (but for Heaven's sake, I just put a phpinfo() statement, in there) or in the way I uploaded it, its permissions, whatever. Any suggestion is HIGLY appreciated!! mweb -- 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] URGENT: IIS server doesn't recognize PHP pages
Hello, I am working for a customer whose ISP uses WinNT/IIS. To test the server environment available I have just uploaded the classic test php page with only phpinfo() inside. When I point to that URL (http://mycustomerdomain.com/test.php), netscape just opens the "Save as (type application/octet stream)" window. This means that the *server* is not set up to fire up the PHP interpreter on files ending with .php, right? What could the reason be? Is it possible that the fault is in the file, for example the CR/LF mess when moving files from Linux to Win**. If it *is* a server problem, what should I suggest to the ISP sysadmin (which is responsive, but knows almost exclusively IIS/ASP/VBScript)? Please help: the customer is starting to scream, and it is really embarassing to be stuck like this when I have a bunch of pages perfectly workiing under Linux just waiting inside my PC. TIA, mweb -- 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: SQL state S1090: Almost connected to mysql via PHP/odbc
On Sunday 02 December 2001 23:18, Venu wrote: > > in themysql monitor. It *shows* when I run isql -v m97. > > I have modified /etc/odbc.ini and /etc/odbcinst.ini and /etc/odbc.ini as > The problem is that, unixODBC is not able to find your MyODBC > DSN entry. This is probably due to the fact that it is not picking > the right odbc.ini file. > Did you tried by using isql -v m97 to check whether it is > really picking the .ini or not. Venu, I tried, as posted in the original message. Also, I put the complete path to the odbc.ini file listing that DSN (see again original post). There is certainly something wrong with my config files, but I'm checking them aginst all the documentation I found so far, and nothing appears. Any help is appreciated. mweb -- 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] SQL state S1090: Almost connected to mysql via PHP/odbc
Hello, thanks to the precious suggestions I had on this list some day ago, I have made some progresses, or at least have something new to report. I would like to ask now above the error mentioned in the subject, because I have not found it inside www.,mysql.com I have a database called m97. It *is* listed when I run "show databases" in themysql monitor. It *shows* when I run isql -v m97. I have modified /etc/odbc.ini and /etc/odbcinst.ini and /etc/odbc.ini as follows: /etc/odbc.ini [m97] Trace= On TraceFile= stderr Driver = /usr/lib/libmyodbc.so DSN = m97 SERVER = localhost USER = test PASSWORD = gee PORT = 3306 OPTIONS = 1 DATABASE= m97 SOCKET = /tmp/mysql.sock # /etc/odbcinst.ini # From the MyODBC package [MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc.so FileUsage = 1 In the PHP file I have: putenv("LD_LIBRARY_PATH=/usr/lib/"); putenv("ODBCINSTINI=/etc/odbcinst.ini"); putenv("ODBCINI=/etc/odbc.ini"); $DSN="m97"; $cnx = odbc_connect( $DSN , 'test', 'gee' ); The result in netscape is still: Warning: SQL error: [unixODBC][TCX][MyODBC]Invalid DSN specified, SQL state S1090 in SQLConnect in /home/mweb/public_html/test.php on line 360 -- 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: HTTP_POST_VARS truncated
> One or more options in each select field are selected, right? Fields > having no values (such as unchecked radio buttons, etc.) don't get passed. Yes, I know empty values are not passed, and, yes, the options were selected (I tried with different values because I started thinking I was having some browser cache problem: other variable were always printed with the latest value, except the select ones) mweb -- 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] HTTP_POST_VARS truncated
> reset($HTTP_POST_VARS); > > at the begining of the code. if that doesn't work verify your html again. > make sure the 's are between the form tag. php doesn't ignore > certain form fields. =) > > i'm the habit of reading arrays like... > while(list($k,$v) = each($HTTP_POST_VARS)) { > echo "key is $k - val is $v \n"; Thanks Jason I'll try it tonight, I'm not at my desk now. However, I would like to highlight that: 1) the select tags *are* inside the forms ones. I know php accepts all form fields, that's why I'm so puzzled... 2) I know that the code I posted here is wrong. In fact I said "something like..."; The code I put in the real PHP page however is correct, identical to what you write above, copied straight from a manual: the proof is that otherwise it would not have printed the other form fields as reported, right? Again, I'll try the reset instructino tonight and report. In the meantime any other hypothesis is welcome Thanks, mweb -- 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] HTTP_POST_VARS truncated
Hello, To test the http/php setup on one of my computers I wrote a very simple html form, with two select fields, two text fields, and the submit field. Pushing submit the data are sent via POST method to an extremely simple PHP page which only contains something like: foreach (var, key) in HTTP_POST_VARS { print "VAR: $var KEY = $key } It works, (meaning that php code is correct, html output is displayed, and no error are reported) but only prints three lines, i.e. the two select fields are missing. Both the php and the html code are syntactically correct: I double checked that on the books, just to be sure. It looks like the select fields, and them only, are not passed to the form by the server, or that in some other way they never make it into HTTP_POST_VARS. Any ideas? Setup is plain Red Hat 7.2 with its default apache/php packages. TIA, mweb -- 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 connecting to mysql via odbc
Hello, I have a page whoch should connect to a mysql database via odbc, on a RH 7.2 PC with the relevant rpm listed below. I know what to do when the db is reachable, but can't start: the instruction: $conn=odbc_connect("db9,"",""); just yelds this result: Warning: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in one.php on line 20 Warning: Supplied argument is not a valid ODBC-Link resource in one.php on line 22 THis is certainly something wrong with my odbc setup, but can't figure it out. I saw a thread couple of days ago about myodbc dsn creation, but can't relate it to my problem. Actually, I only have odbcinst, not the commands mentioned in that message. Any help is appreciated! Thanks, mweb RPM list php-ldap-4.0.6-7 unixODBC-devel-2.0.7-3 mod_auth_mysql-1.11-1 mysqlclient9-3.23.22-6 php-mysql-4.0.6-7 unixODBC-2.0.7-3 asp2php-0.75.17-1 php-imap-4.0.6-7 php-pgsql-4.0.6-7 mysql-3.23.41-1 MyODBC-2.50.37-2 mysql-server-3.23.41-1 php-manual-4.0.6-7 php-odbc-4.0.6-7 libodbc++-0.2.2pre4-12 php-4.0.6-7 mysql-devel-3.23.41-1 perl-DBD-MySQL-1.2216-4 -- 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] Setting up PHP and ODBC on Linux
Hello, as you may remember, some day ago, I asked how to develop on linux PHP pages accessing Mysql via ODBC (The reasons why I *have* to cope with this exact sub optimal set up are in the original message, no reason to repeat them here). I have installed all the UnixODBC rpms I could find ( I have RH 7.1); the iodbc packages on the openlinksw were not accessible. Now I have the following packages installed: [root@ari mweb] rpm -qa|egrep -i 'php|odbc|sql' php-4.0.4pl1-9 php-manual-4.0.4pl1-9 mysql-server-3.23.36-1 MyODBC-2.50.39-1 unixODBC-devel-2.0.7-1 asp2php-0.75.11-1 mysql-3.23.36-1 mysql-devel-3.23.36-1 php-mysql-4.0.4pl1-9 unixODBC-2.0.7-1 unixODBC-generic-2.0.7-1 mysqlclient9-3.23.22-4 unixODBC-mysql-2.0.7-1 However, I currently have PHP set up as pasted below (from phpinfo): that means I have to recompile it from scratch, doesn't it? If so, with which options? Is it enough to change --without-mysql to --with-mysql and add --with-odbc? Also, is it safer/worst/irrelevant/mandatory to erase the php rpm package before building it again from source? TIA, mweb './configure' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--enable-shared' '--enable-inline-optimization' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system' '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib' '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-mysql' '--without-oracle' '--without-oci8' '--with-xml' -- If you have the right attitude, interesting problems will find you Eric S. Raymond, "The Cathedral and the bazaar", chapter 2 -- 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] keeping my code! Why?
> In general, if you think your old code is an "asset" and you're just > protecting it, think again. All code is obsolete before it's > finished. It's only your skills/experience that really matter > and the best way to protect them is to share your work and learn > from others. PERFECT ANSWER, George. Both this last paragraph and all the rest before it. I was going to make the same comments, but it's not needed now. An all your message should be tattoed on the faces of the idiots that, instead of posting job offers for "webmasters able to set up highly dynamic sites with the lowest expenses in HW and SW tools" specify that "they will only accept candidates with knowledge of this or that proprietary, expensive and generally screwed tool/IDE". mweb -- 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] Solution for testing PHP/MS Access on Linux
Hello, some days ago I asked help on this list because I have to develop and test on Linux/Apache some PHP pages that will have to run on on an IIS/NT box. On the real server the pages must manage a MS Access database via ODBC (this mixed setup cannot be changed: explanations in the original message). Now, first of all I would like to thank everybody for their help, and ask about the following solutions. I know they're awkward, but I must make it work ASAP (and performance is not a problem, even the real server is a relatively low traffic site) 1) I could convert the Access DB to Mysql and then write PHP pages which use a wrapper layer for all standard db management calls (as explained in the PHP Developer's Cookbook, chapter 6). Then the only change needed before uploading on the server would be the include of the file with the wrapper functions. In this way I could test all the DB management part of PHP on Linux/MySQL and be sure that it will work on NT/Access also. 2) I could recreate a Mysql database with the same tables on Linux, and access it indirectly from PHP using the ODBC/MySQL interface. In this way the I would be using ODBC in both cases. I guess this would give bet ter performance, as the wrapper layer is not needed anymore, right? What do you think about: which solution is easier to set up? which gives more guarantees that the PHP code will work transparently? did anybody do it before? any other issue (performance, stability, whatever) TIA, mweb -- 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: Faking MS Access on MySQL linux box
John, thanks for the link, but isn't it a bit of overkill in my case? What I need is to write PHP pages which manipulate a MS Access DB via ODBC, because this is what the hosting company makes available (and it's not going to change because of several reasons) So, I am looking for explanation on how to do ONLY the testing of suche pages on a STAND-ALONE Linux box. I want to run some DB engine on it which is accessible through ODBC, so that I can say "if my ODBC call was OK here, it will work also when I upload on the NT/IIS server, because the interface is the same". Keep in mind that performance is not an issue here. On the linux PC I would only do testing, and the site on the real server currently has ~4000 visits/month querying a DB with some hundreds of entries. What do you think? mweb On Sat, Nov 10, 2001 13:02:14 at 01:02:14PM +0800, John Lim wrote: > See http://php.weblogs.com/adodb_csv > > "ADODB also supports SQL communications through HTTP as a database proxy. In > plain English, if you have a FoxPro or Access database that you need to > connect to from Unix, you can do so via HTTP (eg. Apache talking to IIS, > which talks to a small PHP program [the proxy] that queries the database, > packs it into serialized text and sends it back to Apache). > > PHP client -- Apache IIS -- PHP server -- Database > > Or if you have to go through a firewall to access your database, this > solution allows you to stream SQL queries as HTTP through the firewall." > > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote in message > GMJD1G$[EMAIL PROTECTED]">news:GMJD1G$[EMAIL PROTECTED]... > Hello, > > For reasons not worth discussing here, I have to develop and test on > Linux/Apache some PHP pages that will have to access via ODBC a MS Access > database on an NT/IIS/PHP server. > > I would like to do it by writing PHP pages that access via ODBC > some mysql or other database on my linux box, in such a way that, > if it works there, I just change some general setting, upload the pages > and they work for sure on the MS Access thing (something like: > ifdef LINUX then ODBC_ACCESSES_MYSQL > ifdef NTthen ODBC_ACCESSES_MS_Access) > > I am sure that this must be possible, but would really appreciate some > examples/pointers to specific tutorial/similar stories/etc. > > TIA, > mweb > > > > > -- > 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] -- Never let your sense of morals prevent you from doing what is right Salvor Hardin , "Foundation" -- 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]