[PHP-DB] MySQL latin1 to utf8 conversion
(Previous sending failed for some reaseon!) Hello, I suppose i am not the only one who has got that problem about transferring site database to MySQL 4.1x and to utf8 charset. Before it was MySQL 3.23 and latin1. I have read this article Turning MySQL data in latin1 to utf-8 on http://www.oreillynet.com/lpt/wlg/9022, but it is way to long and complicated to me (it took Mr. Derek Sivers 60 hours over 5 days). And besides that, i have problems because i dont have control over my web server or db server and db is pretty large for export and re-import it. On the top of all, i have dial-up connection and phpMyAdmin scripts interrupt after 30 seconds (server is in safe mode so i cant increase execution time) I tried to do some conversion using generic php script (convert field values with utf8_decode). Problem is that conversion from latin1 to utf8 doesnt work correctly (some characters are lost, others are badly converted to some non characters). My text in the db was input in utf-8 cyrilic (PHP-Nuke as CMS), but it seems mysql stored it in latin1 and php somehow managed to show correctly encoded text. There is also some amount of my confusion and ignorance about how php handles mysql latin1 encoding and shows correctly encoded text. When i do this header(Content-Type: text/html; charset=utf-8); // pseudo code connect_mysql($my_params); mysql_query(SET NAMES 'utf8', $link) or die(Error setting names to utf); mysql_query(SET CHARACTER SET 'utf8', $link) or die(Error setting connection charset); select_row($my_query); echo $row[column]; i got jumbled output text if i do this mysql_query(SET NAMES 'latin1', $link) or die(Error setting names to utf); mysql_query(SET CHARACTER SET 'latin1', $link) or die(Error setting connection charset); or just omit these lines (php is connecting default in latin1) - my texts are correctly encoded on html output. So, i would like somehow to export my tables to real utf8 file and then try to use LOAD INFILE for importing the contents of the tables. If php can show correct contents in html using latin1, i think it is possible to export it to plain utf file. This is my question - does anyone know how to do it in php? -- Pozdrav, Radovan Radic -- Pozdrav, Radovan Radic -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Oracle and PHP
Hi Roger, There is Oracle Commander , but it is not very good as phpMyAdmin. Try it: http://www.bitesser.de/downloads/download.php?filename=oraclecommander Oracle is similar to other databases used from PHP, only difference is calling stored procedures that return resultset. Dont use oracle functions, but oracle8 (oci) extension for Oracle, they are better documented and easier to use. There is PHP manual that can help you learn oracle+php. If u have some questions you can ask here. For example, there are couple of functions i wrote to myself: Some ppl say you should put environment variables, before connecting: putenv( ORACLE_HOME=/usr/oracle/product/9.2.0 ); putenv(TWO_TASK=/usr/oracle/product/9.2.0/network/admin/tnsnames.ora); putenv(TNS_ADMIN=/usr/oracle/product/9.2.0/network/admin); putenv(ORACLE_SID=test); $connection = OCIPlogon($user,$pass,$dbname); function query($sql) { $query=OCIParse($connection,$sql); if ($query) OCIExecute($query); return $query; } function query_fetch_array($query) { if (OCIFetchInto($query,$result,OCI_ASSOC+OCI_NUM+OCI_RETURN_NULLS)) { return $result; } else { return 0; } } $sql=select * from emp; $query=query($connection,$sql); while ($row=query_fetch_array($query)) { // You can user $row[EMPNO] or $row[0]... } Radovan Roger Spears [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I was wondering if there are any PHP people out there that are really into using Oracle databases? I've always used mysql but now I find myself in a situation that requires the use of an Oracle database. I've printed out the information posted by Thies C. Arntzen titled Making Efficient use of Oracle8i thru Apache and PHP 4 but I was wondering if I may see some other code examples. Very basic examples dealing with connections, queries and the such. Also, is there an application for Oracle databases that is similar to PHPMyAdmin for mysql databases? Thanks, Roger -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP Oci8 segmntation fault
Hello Lang Sharpe, It seems this line #undef HAVE_OCI8_SHARED_MODE did the trick. Maybe it can help other ppl too. Thanks a lot, i cant say how much you helped me with this. Radovan Lang Sharpe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Radovan Here are some suggestions Make sure $ORACLE_HOME is set in your environment. There may be other environment variables that the environment needs as well that are set for the webserver process, but not when you run the command line version. PHP 4.3.2 has a bug in it that causes php to crash with oracle support. Try adding #undef HAVE_OCI8_SHARED_MODE near the top of ext/oci8/oci8.c If your getting a core dump, then you can compile php with --enable-debug as a configure option. run the script again and use gdb to get a backtrace. There are instructions for doing this are at http://bugs.php.net/bugs-generating-backtrace.php This probably wont solve your problem, but is fun to do anyway. Lang Radovan Radic wrote: Hello I have php 4.3.2 installed as apache 2.0.45 module on RH Linux (7.3) with oci8 support. Things work fine when php scripts are accessed via web, but when i try to start them from command line using /usr/local/php4.3.2/bin/php test.php i get an error Segmentation fault. test.php has only 4-5 lines, for connecting to oracle, and printing data from one table, using same class as pages on the web. Anyone can help? Thanks, Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP Oci8 segmntation fault
Hi, Thanks for the help. I will try this, althought i compiled php with-oracle and Oracle functions work ok with php even in command line. Now, only i have problem with calling oracle stored procedures that return resultset in cursor. I knew how to do it in oci functions, but i dont know how to make it in php+oracle functions. Anybody can help me about it? Radovan Lang Sharpe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Radovan Here are some suggestions Make sure $ORACLE_HOME is set in your environment. There may be other environment variables that the environment needs as well that are set for the webserver process, but not when you run the command line version. PHP 4.3.2 has a bug in it that causes php to crash with oracle support. Try adding #undef HAVE_OCI8_SHARED_MODE near the top of ext/oci8/oci8.c If your getting a core dump, then you can compile php with --enable-debug as a configure option. run the script again and use gdb to get a backtrace. There are instructions for doing this are at http://bugs.php.net/bugs-generating-backtrace.php This probably wont solve your problem, but is fun to do anyway. Lang Radovan Radic wrote: Hello I have php 4.3.2 installed as apache 2.0.45 module on RH Linux (7.3) with oci8 support. Things work fine when php scripts are accessed via web, but when i try to start them from command line using /usr/local/php4.3.2/bin/php test.php i get an error Segmentation fault. test.php has only 4-5 lines, for connecting to oracle, and printing data from one table, using same class as pages on the web. Anyone can help? Thanks, Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Oci8 segmntation fault
Hello I have php 4.3.2 installed as apache 2.0.45 module on RH Linux (7.3) with oci8 support. Things work fine when php scripts are accessed via web, but when i try to start them from command line using /usr/local/php4.3.2/bin/php test.php i get an error Segmentation fault. test.php has only 4-5 lines, for connecting to oracle, and printing data from one table, using same class as pages on the web. Anyone can help? Thanks, Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: undefined function: mssql_connect()
Do you have php_mssql.dll extension loaded? Check better with phpinfo(); Radovan [EMAIL PROTECTED] [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there, Hope someone can help me with this. I need to connect to a MS SQL database but my attemps fail once and again. This is the error message I get when try to connect: Fatal error: Call to undefined function: mssql_connect() in /var/www/htdocs/DB_conn.php on line 8 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Drawing chart
Check these: http://www.aditus.nu/jpgraph/ http://www.phplot.com/ Matthias Steiner [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'd like to have PHP drawing a chart based on temperature data in a mySQL database. Before I start inventing the wheel: does anybody know about finished code which produces a *.png-Chart from a table of values in a database? Gruss, Matthias -- Steiner Matthias Student of Telematics University of Technology, Graz, Austria http://web.utanet.at/steiner/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: how to call a stored procedure in SQL Server 2000
I have sp like this in MSSQL CREATE procedure dsp_ani_usage_period @from_date datetime, @to_date datetime, @max_usage money which does join select from some tables using these params for where And i execute it from PHP if(!isset($date_from)) { $date_from=date(m/d/Y,strtotime(-1 month)); $date_to=date(m/d/Y); } if (!isset($amount)) $amount=20; $sql=exec dsp_ani_usage_period '$date_from','$date_to',$amount; $sql_result=mssql_query($sql); HTH, Radovan Ha Duy Thien [EMAIL PROTECTED] wrote in message 008d01c2ad60$d1caa6e0$311f483d@thien">news:008d01c2ad60$d1caa6e0$311f483d@thien... Hi gurus, I am new user to PHP. Does anyone here work with SQL server with PHP, please show me some codes about how to call a stored procedure in a SQL Server Database. how to add paramaters also Thanks a lot Thien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: problem with PHP+flash programming
Hermanto Kurniawan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i have a problem with this flash actionscript : loadVariablesNum (GuestBook.php?NumLow=+NumLow+NumHigh=+NumHigh+R=+random(999), 0); when i run this script i got an error message like this : error opening URL file:///C|/path/GuestBook.php?NumLow=0NumHigh=10R=470 does anyone know what is the problem with this script? Maybe you should do this loadVariablesNum(http://localhost/GuestBook.php?...;) or when open html doc with embedded flash , open it via http://file.html HTH, Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: flytte bsd harddisk til anden pc
Dutch, swedish...? Martin Allan Jensen [EMAIL PROTECTED] wrote in message 002501c2a1e2$092e8640$020a@asus">news:002501c2a1e2$092e8640$020a@asus... Hej Allesammen, har et strt problem, jeg skal IDAG skifte server, men kan jeg bare tage mine harddiske med FreeBSD på og smide over i den nye maskine og så vil det køre eller -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: adding in array
Bastian Vogt [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I'ld suggest this: // inside your loop $array[$year] += $value; HTH, Bastian Lets say $year is 2000 There is not defined index 2000 at $array. It is going to be undefined offset. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: adding in array
Bastian Vogt [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Lets say $year is 2000 There is not defined index 2000 at $array. It is going to be undefined offset. Hm... I think it's gonna work, but if it's one of the don'ts in progamming style, could you tell me why you shouldn't do this and how to make it better (and nice)? Regards, Bastian I would write it if i knew it, but i have problems myself about it :( Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Max execution time
Hi all (I post questions although i dont get answers, but i am trying. I must say i dont give answers because i dont know much about php yet) I have problems with script exceedded time. Script is executing mssql stored procedure which executes about 5-6 mins. I need to execute it and then get results in the file, but i allways get error about max execution time. Customers wouldnt complain if script is executing too long if they could get the results. I know i can set max.execution.time from php with ini_set(). But, i think i have read in the manual, that this directive doesnt affect script execution time if script is running query. So even if i set max_execution_time to 6mins could the script break? Could someone explain it to me. Radovan PS. What means PHP? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Max execution time
Thx for the quick response, i ll see if that helps me Ryan Jameson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'd use this: set_time_limit (3600); Ryan -Original Message- From: Radovan Radic [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 8:42 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Max execution time Hi all (I post questions although i dont get answers, but i am trying. I must say i dont give answers because i dont know much about php yet) I have problems with script exceedded time. Script is executing mssql stored procedure which executes about 5-6 mins. I need to execute it and then get results in the file, but i allways get error about max execution time. Customers wouldnt complain if script is executing too long if they could get the results. I know i can set max.execution.time from php with ini_set(). But, i think i have read in the manual, that this directive doesnt affect script execution time if script is running query. So even if i set max_execution_time to 6mins could the script break? Could someone explain it to me. Radovan PS. What means 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] Max execution time
another one: Is there some kind of explorer timeout for scripts that execute too long? Radovan Ryan Jameson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'd use this: set_time_limit (3600); Ryan -Original Message- From: Radovan Radic [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 8:42 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Max execution time Hi all (I post questions although i dont get answers, but i am trying. I must say i dont give answers because i dont know much about php yet) I have problems with script exceedded time. Script is executing mssql stored procedure which executes about 5-6 mins. I need to execute it and then get results in the file, but i allways get error about max execution time. Customers wouldnt complain if script is executing too long if they could get the results. I know i can set max.execution.time from php with ini_set(). But, i think i have read in the manual, that this directive doesnt affect script execution time if script is running query. So even if i set max_execution_time to 6mins could the script break? Could someone explain it to me. Radovan PS. What means 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
[PHP-DB] MySQL: charset
Hi How can i change default charset for mysql database. I want to change default charset on cp1251 just for one database 'dblibrary'. I have seen something like mysql --default-character-set=cp1251, but i dont know does it work? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: MySQL: charset
Radovan Radic [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi How can i change default charset for mysql database. I want to change default charset on cp1251 just for one database 'dblibrary'. I have seen something like mysql --default-character-set=cp1251, but i dont know does it work? Thanks I thought i could do this somehow when connecting from PHP because i need other databases to be in latin charset. MySQL 3.23.41 -nt PHP 4.2.3 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySql security
Hi, Since i dont know any mysql group, i will try here - it is anyway related to php. When i want to make php/mysql application i have mysql on the server and i connect to it with mysql_pconnect(localhost,root,) and it works. I assume that any user or hacker could connect to mysql database like this. So, i want to create my database and i want to limit access to this database for some usernames and passwords. I know MSSQL or Interbase can do it - but how i do this in mysql. If this is offtopic can someone point me to any mysql newsgroup. Other question is: if i need to make application which uses credit cards, how can i increase security for it. I have heard about https protocol, but dont know much about it. Any link would be appreciated. Thanks, Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySql security
how i do this in mysql. If this is offtopic can someone point me to any mysql newsgroup. I would say this is very offtopic, but this query should do the trick: GRANT select, update, insert ON your_db_name.* TO your_username@localhost IDENTIFIED BY 'your_password' Take a look in the MySQL manual for more details on GRANT. Thank you for the answers, i will explore little bit more about this. Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mssql.datetimeconvert bug ?
What format do you want? You can use select convert(char(10),date_field,101) and you will get mm/dd/, or look at the convert function in the SQL Server Books Online, or u can use php function date and format whatever you want. Radovan Matt Brown [EMAIL PROTECTED] wrote in message news:MOEHKANCAIEPPJENOOJOOEDOCGAA.matt;ispsolutions.co.uk... Hi All, We have MS Sql Server 7 running backend and are running our reports via PHP 4.2.3 (compiled with freetds), we have the flag mssql.datetimeconvert = 0 set in the php.ini, but yet all date/time(s) are returned as 'Nov 13 2002 02:26PM'... This is driving us mad, everywhere we search for a solution says that the flag mssql.datetimeconvert = 0 or Off fixes this problem, however in our config it does not ... Anyone have any suggestions ? Regards Matt Brown --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php.exe Application Error
Hi all, I have tried this in php.windows, no answers there and since this is kind of db question i will try here. IIS Win2000, MSSQL 7, PHP 4.2.3 I have script that reads about 100-200 rows in the SELECT list and it is ok. After that, i have robust sql query for select some data from 4-5 tables, so i have to use joins. It returns about 600 rows (in the SQL Query Analyzer it works) - but in php i get this error: The instruction at 0x77fcb007 referenced memory at '0x000. The memory could not be written. Click on OK to terminate the program Click on CANCEL to debug the program Does anyone know what this could be? On the other server, which has php 4.0.6 this script works without problems!? Also, when i have where clause in the query, which reduces number of retreived rows, mssql_query will work. Thanks in advance, Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php.exe Application Error
Radovan Radic [EMAIL PROTECTED] wrote in message news:20021112093111.53801.qmail;pb1.pair.com... Hi all, I have tried this in php.windows, no answers there and since this is kind of db question i will try here. IIS Win2000, MSSQL 7, PHP 4.2.3 I have script that reads about 100-200 rows in the SELECT list and it is ok. ... Hi, answering to myself. After browsing on http://bugs.php.net i have found that i need to convert smallmoney fields cast(tbl.field_name as decimal(9,2)) and it worked. Radovan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php