[PHP] unicode
Hi to all, we completed one module of our project in English language.but our client asked to do it in chinesse language also.I dont have any idea regarding this.whether we have to download any chinesse fonts or is there any tutorials available for this purpose.or project is in PHP 4 with linux platform.i am waiting for ur reply A.suresh - Jiyo cricket on Yahoo! India cricket Yahoo! Messenger Mobile Stay in touch with your buddies all the time.
Re: [PHP] unicode
go away and RTFM, STFW, anything but ask another question here until you can show even the slightest inclination to do you're own research and that you'll bother to response to people when then do actually give answers (like maybe a thank you if someone does actually help you, for instance). this is the 26th lame ass question you have posted - not once was there any indication you had even bothered to open a browser to search for possible clues/answers and not once have you ever replied to all the people that tried to help you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unicode
And they wonder why labor is so cheap in India and they keep sending jobs and opening call centers and such over there... They read scripts all day, you would think that they would know how to Google. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how should MS Access DATETIME be handled in PHP?
While all the data-munging in PHP is very interesting... Might I suggest that you just use MySQL's date_format() function to ask MySQL to give you the data you want in the first place? Some purists would claim that the database is not the place to put presentation logic, of course. And for a large-scale library where other users might want to skin a different format, I couldn't agree more. But, really, for a small project, K.I.S.S. wins out, and having MySQL just hand you what you want instead of cluttering up your code with several lines (or a long multi-operation line) of PHP, seems like a cleaner solution. Not to mention that you'll have a lot less headaches like this one. http://mysql.com and search for date_format Thanks, Richard. I agree with you. Is date_format() a MySQL specific funtion? If so, we're out of luck because our backend DB is MS Access. Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] httpd: PHP Notice: Undefined index: autoplay
Hi there, I just upgraded to apache2.2.0 and reinstalled php4-4.4.2_1 on a FreeBSD 4.11 machine. I am trying to make sure that my PHP is properly installed and configured. I am seeing the following PHP Notice about 10 entries a day in my /var/log/messages in regards to: --- snip -- httpd: PHP Notice: Undefined index: autoplay in /a/www/data/filname/garbled/radio.blog/index.php on line 9 --- snip --- I am not quite sure what to do to make sure things are operating properly. Might someone lend a hand here? cheers, Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] httpd: PHP Notice: Undefined index: autoplay
Hi there, I just upgraded to apache2.2.0 and reinstalled php4-4.4.2_1 on a FreeBSD 4.11 machine. I am trying to make sure that my PHP is properly installed and configured. I am seeing the following PHP Notice about 10 entries a day in my /var/log/messages in regards to: --- snip -- httpd: PHP Notice: Undefined index: autoplay in /a/www/data/filname/garbled/radio.blog/index.php on line 9 --- snip --- I am not quite sure what to do to make sure things are operating properly. Might someone lend a hand here? cheers, Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] httpd: PHP Notice: Undefined index: autoplay
Hi there, I just upgraded to apache2.2.0 and reinstalled php4-4.4.2_1 on a FreeBSD 4.11 machine. I am trying to make sure that my PHP is properly installed and configured. I am seeing the following PHP Notice about 10 entries a day in my /var/log/messages in regards to: --- snip -- httpd: PHP Notice: Undefined index: autoplay in /a/www/data/filname/garbled/radio.blog/index.php on line 9 --- snip --- I am not quite sure what to do to make sure things are operating properly. Might someone lend a hand here? cheers, Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] httpd: PHP Notice: Undefined index: autoplay
Thanks for the duplicate posts. Perhaps read the error message? Look at line 9 of /a/www/data/filname/garbled/radio.blog/index.php The variable is being set incorrectly. Regards, Peter Hoskin Noah wrote: Hi there, I just upgraded to apache2.2.0 and reinstalled php4-4.4.2_1 on a FreeBSD 4.11 machine. I am trying to make sure that my PHP is properly installed and configured. I am seeing the following PHP Notice about 10 entries a day in my /var/log/messages in regards to: --- snip -- httpd: PHP Notice: Undefined index: autoplay in /a/www/data/filname/garbled/radio.blog/index.php on line 9 --- snip --- I am not quite sure what to do to make sure things are operating properly. Might someone lend a hand here? cheers, Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Post forms
On Thursday 13 April 2006 8:44 pm, Stephen Johnson wrote: On 4/13/06 7:40 PM, Gary E. Terry [EMAIL PROTECTED] wrote: Quite possibly a stupid question, but here goes. I have a form that is a list of jobs. On that list is a checkbox. The form field is named 'changedate'. I also have a hidden field called 'JobID'. What I am trying to accomplish is if a checkbox is checked, when the form is submitted, I want all of the JobID's to be updated by an SQL query. But it seems to me that $_POST will only contain the last JobID in the form, no matter what. Am I correct on this? Is what I am trying to accomplish not possible with a form post? I think I remember doing something similar with Cold Fusion years ago, but I have never attempted this with PHP. Any suggestions? You need to pass the checkboxes as an array value with the JobID as the identifier. Then on the other side, you can run through the list of JobID's and see which ones need to be updated. If I'm understanding what you're asking, you have an array of checkboxes whose values you want passed to you PHP via the $_POST array. The HTML form syntax would be something like: input type=checkbox name=array[] value=... / input type=checkbox name=array[] value=... / input type=checkbox name=array[] value=... / etc. Then in your PHP script, $_POST['array'] will hold an array of the checkbox values. HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to reload a PHP page via PHP code
Hi, I would like to know if it exist a method to reload a PHP page via PHP code ? the topic behind is that i do not want to specify the PHP page to reload. It must reload the actual page only. for example, if use views the page : test.php and click on US flag image. PHP should reload this page with US language...but i do not want to write in hardcoding the page name, because this function should be usefull for all pages. thanks a lot Alain
RE: [PHP] how to reload a PHP page via PHP code
[snip] I would like to know if it exist a method to reload a PHP page via PHP code ? the topic behind is that i do not want to specify the PHP page to reload. It must reload the actual page only. for example, if use views the page : test.php and click on US flag image. PHP should reload this page with US language...but i do not want to write in hardcoding the page name, because this function should be usefull for all pages. [/snip] Just how much time do people spend reading the manual? There is a pre-defined variable called $_SERVER['PHP_SELF'] you may also want to look at things like basepath etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unicode
At 9:25 AM -0400 4/14/06, Wolf wrote: And they wonder why labor is so cheap in India and they keep sending jobs and opening call centers and such over there... They read scripts all day, you would think that they would know how to Google. Maybe we could open a call center here for answers to questions they don't have scripts for. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to reload a PHP page via PHP code
Alain Roger wrote: Hi, I would like to know if it exist a method to reload a PHP page via PHP code ? the topic behind is that i do not want to specify the PHP page to reload. It must reload the actual page only. for example, if use views the page : test.php and click on US flag image. PHP should reload this page with US language...but i do not want to write in hardcoding the page name, because this function should be usefull for all pages. Although the question is vague here I go. I would use sessions to determine what language is displayed. When the user clicks the flag then the php page it goes to sets a language var in the session and redirects back to the original page that the user was on. Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Post forms
Sorry, should have posted lastnight.. Stephen Johnson helped out a lot, it's working great now. Thanks for the relpy though -Original Message- From: Joe Henry [mailto:[EMAIL PROTECTED] Sent: Friday, April 14, 2006 11:44 AM To: php-general@lists.php.net Cc: Stephen Johnson; Gary E. Terry Subject: Re: [PHP] PHP Post forms On Thursday 13 April 2006 8:44 pm, Stephen Johnson wrote: On 4/13/06 7:40 PM, Gary E. Terry [EMAIL PROTECTED] wrote: Quite possibly a stupid question, but here goes. I have a form that is a list of jobs. On that list is a checkbox. The form field is named 'changedate'. I also have a hidden field called 'JobID'. What I am trying to accomplish is if a checkbox is checked, when the form is submitted, I want all of the JobID's to be updated by an SQL query. But it seems to me that $_POST will only contain the last JobID in the form, no matter what. Am I correct on this? Is what I am trying to accomplish not possible with a form post? I think I remember doing something similar with Cold Fusion years ago, but I have never attempted this with PHP. Any suggestions? You need to pass the checkboxes as an array value with the JobID as the identifier. Then on the other side, you can run through the list of JobID's and see which ones need to be updated. If I'm understanding what you're asking, you have an array of checkboxes whose values you want passed to you PHP via the $_POST array. The HTML form syntax would be something like: input type=checkbox name=array[] value=... / input type=checkbox name=array[] value=... / input type=checkbox name=array[] value=... / etc. Then in your PHP script, $_POST['array'] will hold an array of the checkbox values. HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql and php
i was wondering what is the most secure way to use mysql in php. is there a certain way it should be done or a way that is more secure than another? iv'e seen it done many ways and was wondering if it was just preference or a if there was a reason behind it. if you guys could post some examples of how you do it and why maybe you could help me understand or know of an article or tutorial on the subjecti would appreciate it.
RE: [PHP] how to reload a PHP page via PHP code
[snip] Sorry, but i do not find it in my PHP manual :-( [/snip] http://www.php.net/manual/en/reserved.variables.php It is actually the first one mentioned on the page. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql and php
Display the different ways in which you've seen php using mysql, and we'll see if any one of them is any more secure than another. Most Security issues can be left to MySQL and the MySQL API. A few pointers - Store parameters(username/password) outside the DocuementRoot. Put your server on local host - or create an ssh/ssl tunnel between the PHP machine, and the DB. Cast any numbers, and escape any strings. ( mysql_escape_string ) Configure mysql securely - this is outside the scope of an email. On 4/14/06, benifactor [EMAIL PROTECTED] wrote: i was wondering what is the most secure way to use mysql in php. is there a certain way it should be done or a way that is more secure than another? iv'e seen it done many ways and was wondering if it was just preference or a if there was a reason behind it. if you guys could post some examples of how you do it and why maybe you could help me understand or know of an article or tutorial on the subjecti would appreciate it.
Re: [PHP] unicode
And Maybe get all that government subsidized money for bringing in jobs to a location that lost them due to a call center closing... yeah, that's the ticket!! tedd wrote: At 9:25 AM -0400 4/14/06, Wolf wrote: And they wonder why labor is so cheap in India and they keep sending jobs and opening call centers and such over there... They read scripts all day, you would think that they would know how to Google. Maybe we could open a call center here for answers to questions they don't have scripts for. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 2 questions: Search in array and detect JS
Hi, Like the subject says; I have two questions: 1) Is it possible to detect JavaScript via php... and yes I do know that JS is client side while PHP is server...but how else to do it? The reason I ask is before serving an AJAX page I would like to make sure JS is enabled, if not, serve the other normal page... I am sure I am not the first person to come accross this little problem, how did you solve it? I have seen some suggestions on google like having a hidden form field and using js to put a value in it, if it exists when the form is sent then JS is on..if not, its not... but that method is not the best in an AJAX situation...right? 2) How can I search in an array for a particular word? eg: in an array movie I have this kind of data: movie_name= some movie cast= Jim Carrey, Richard Pryor, Eddie Murphy I want to search on either Richard or Richard Pryor (must be case insensitive too) something like a SELECT with a LIKE %% statement I have been fooling around with in_array() but not getting anywhere fast. am I on the right track? Links, code examples or advise would be as alwaysappreciated. Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to reload a PHP page via PHP code
i reload my pages with a function using a meta tag... ?php // $sec is the amount of seconds you want to wait before it redirects //$url id the pace you want it to redirect to function redirect ($sec, $url) { ? meta http-equiv=refresh content=?=$sec;?;URL=?=$url;? ?php } //to use to refresh a page $url = $_SERVER['PHP_SELF']; redirect(0, $url); ? - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Alain Roger [EMAIL PROTECTED] Cc: PHP General List php-general@lists.php.net Sent: Friday, April 14, 2006 9:45 AM Subject: RE: [PHP] how to reload a PHP page via PHP code [snip] Sorry, but i do not find it in my PHP manual :-( [/snip] http://www.php.net/manual/en/reserved.variables.php It is actually the first one mentioned on the page. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 questions: Search in array and detect JS
Ryan: First question. Technically no, you can't detect js from php. However, I read where one can detect if a user has cookies on by sending a cookie and then reading it back. And considering that you can send a cookie via js, you could do that. However, that would mean that the user had to have both js and cookies on. Second question. Unless I don't understand the problem, simply use a loop and stristr(). See; http://www.weberdev.com/stristr HTH's tedd --- At 7:24 PM +0200 4/14/06, Ryan A wrote: Hi, Like the subject says; I have two questions: 1) Is it possible to detect JavaScript via php... and yes I do know that JS is client side while PHP is server...but how else to do it? The reason I ask is before serving an AJAX page I would like to make sure JS is enabled, if not, serve the other normal page... I am sure I am not the first person to come accross this little problem, how did you solve it? I have seen some suggestions on google like having a hidden form field and using js to put a value in it, if it exists when the form is sent then JS is on..if not, its not... but that method is not the best in an AJAX situation...right? 2) How can I search in an array for a particular word? eg: in an array movie I have this kind of data: movie_name= some movie cast= Jim Carrey, Richard Pryor, Eddie Murphy I want to search on either Richard or Richard Pryor (must be case insensitive too) something like a SELECT with a LIKE %% statement I have been fooling around with in_array() but not getting anywhere fast. am I on the right track? Links, code examples or advise would be as alwaysappreciated. Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php - mysql problem
[snip] $sql = SELECT * FROM `table1` LEFT JOIN `table2` USING `id` WHERE ... GROUP BY `table1`.`id`; mysql_query($sql); the problem is, that, when in table2 is not matching data using that id, i lose that id from output array. but i don`t want to.. is there any posibility to keep that id? [/snip] More of a mysql question but do a left outer join with no group by statement. SELECT table2.* FROM table1 LEFT OUTER JOIN table2 ON(table1.id = table2.id) WHERE table1.id IS NULL Returns all of table2 id's where there is no id in table1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] serialize() function
Jochem: $_SESSION has another advantage - everything you stick in it is automagically serialized and unserialized at end/start of the request. I didn't know that. Thanks, now I have to figure out a way to store a $_SESSION in a cookie and read it back without inferring with what the user is currently doing in both post and get selections. I have myself overly confused at the moment with too much user activity. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 questions: Search in array and detect JS
On Fri, 2006-04-14 at 13:34, tedd wrote: Ryan: First question. Technically no, you can't detect js from php. However, I read where one can detect if a user has cookies on by sending a cookie and then reading it back. And considering that you can send a cookie via js, you could do that. However, that would mean that the user had to have both js and cookies on. It is probably a better to approach this backwards. So load the non JS page, and within it detect if javascript is enabled, in which case perform a javascript based redirect to the Ajax enabled page. Second question. Unless I don't understand the problem, simply use a loop and stristr(). stripos() is a better candidate since you are only looking for the string and it skips the extra processing of stristr(). Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php - mysql problem
thanks for your posting, but I have: table1 id name value table2 id x y i want to id name value x y but there is no id from table 2 that is in table2.id and i want the resource to bu something like this: id(from table 1) name value (empty) (empty) Jay Blanchard wrote: [snip] $sql = SELECT * FROM `table1` LEFT JOIN `table2` USING `id` WHERE ... GROUP BY `table1`.`id`; mysql_query($sql); the problem is, that, when in table2 is not matching data using that id, i lose that id from output array. but i don`t want to.. is there any posibility to keep that id? [/snip] More of a mysql question but do a left outer join with no group by statement. SELECT table2.* FROM table1 LEFT OUTER JOIN table2 ON(table1.id = table2.id) WHERE table1.id IS NULL Returns all of table2 id's where there is no id in table1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php - mysql problem
[snip] table1 id name value table2 id x y i want to id name value x y but there is no id from table 2 that is in table2.id and i want the resource to bu something like this: id(from table 1) name value (empty) (empty) SELECT table2.* FROM table1 LEFT OUTER JOIN table2 ON(table1.id = table2.id) WHERE table1.id IS NULL [/snip] SELECT table1., *table2.* FROM table1 LEFT OUTER JOIN table2 ON(table1.id = table2.id) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php - mysql problem
[snip] SELECT table1., *table2.* FROM table1 LEFT OUTER JOIN table2 ON(table1.id = table2.id) [/snip] Oops, typo. SELECT table1.*, table2.* FROM table1 LEFT OUTER JOIN table2 ON(table1.id = table2.id) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php - mysql problem
thanks a lot for your posting, [cut] Posted by Fred Mitchell on December 11 2004 2:47pm [Delete] [Edit] Let's say you are doing a LEFT JOIN with a table that shares a column name in common with another table, and that you are selecting for instances where the join is missing, that is IS NULL. Normally, the common column name is wiped out by the null record, but here is a workaround for it: You simply alias that common column name in the select. For instance, CREATE TABLE t1 (INT id NOT NULL, ); CREATE TABLE t2 (INT id NOT NULL, ); ... SELECT * FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id IS NULL; would result in the column 'id' being null on each selected row. Instead, you can do: SELECT *, t1.id AS id FROM t1 LEFT JOIN t2 ON t1.id = t2.id WHERE t2.id IS NULL; And now the 'id' column will be preserved since the alias is evaluated *after* the LEFT JOIN. [/cut] pay attention to: - *, t1.id - cheers, cajbecu Jay Blanchard wrote: [snip] $sql = SELECT * FROM `table1` LEFT JOIN `table2` USING `id` WHERE ... GROUP BY `table1`.`id`; mysql_query($sql); the problem is, that, when in table2 is not matching data using that id, i lose that id from output array. but i don`t want to.. is there any posibility to keep that id? [/snip] More of a mysql question but do a left outer join with no group by statement. SELECT table2.* FROM table1 LEFT OUTER JOIN table2 ON(table1.id = table2.id) WHERE table1.id IS NULL Returns all of table2 id's where there is no id in table1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] return a formatted difference between two dates
[snip] is there a function to take a second count and return it as a formatted difference? like a date_diff('H hours i',6133) that uses date()'s formatting. [/snip] http://www.php.net/mktime -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 questions: Search in array and detect JS
Hey Tedd / Robert, Thanks for replying. -- Tedd: However, I read where one can detect if a user has cookies on by sending a cookie and then reading it back. And considering that you can send a cookie via js, you could do that. However, that would mean that the user had to have both js and cookies on.- Yep, two things to worry about instead of one. Tedd: Second question. Unless I don't understand the problem, simply use a loop and stristr().-stristr() is a bit expensive, was not too sure if I wanted to use that because I will be lookingin a array of hundreds of movies (maybe even thousands)-- Robert:It is probably a better to approach this backwards. So load the non JS page, and within it detect if javascript is enabled, in which case perform a javascript based redirect to the Ajax enabled page.-Hmmm, makes sense and I have not used this method beforewill def check it out.-- stripos() is a better candidate since you are only looking for the string and it skips the extra processing of stristr().--I am more familier with strstr and stristr but will give stripos a look-see too..Thanks,Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] serialize() function
tedd wrote: Jochem: $_SESSION has another advantage - everything you stick in it is automagically serialized and unserialized at end/start of the request. I didn't know that. Thanks, now I have to figure out a way to store a $_SESSION in a cookie and read it back without inferring with what the user is currently doing in both post and get selections. I have myself overly confused at the moment with too much user activity. no shit! (regarding the confusion). $_SESSION is populated when you call session_start(), it's contents are stored on the server. calling session_start() implicitly make php emit a cookie which contains not much other than the session id - it's this id (that the browser sends back in the form of a cookie again) that tell's php which chunk of serialized data that it saved onto disk (usually onto disk) at the end a previous request it should load up when you call session_start(). by default the session cookie is 'dropped' by the browser once you close it [the browser] try this, it might to help you see what's happening a bit (oh and don't forget the manual ;-): ?php session_start(); if (!isset($_SESSION['myObj'])) { echo INIT!br /; $_SESSION['myObj'] = new stdObject; $_SESSION['myObj']-counter = 1; } echo $_SESSION['myObj']-counter++; tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compacting multiple spaces...
Hi, I am running a self-compiled PHP version 4.4.2 on Apache 1.3.34 on White Box Enterprise Linux 3. I found a problem in my database access code (Oracle 9.2.0.4 if it matters) and have determined that spaces in string variables are being compacted on output in PHP. This PHP extract, when run, illustrates the problem: ?php $name = Space 9; print pLength: .strlen($name); printf(pVariable: %s,$name); print pVariable: '.$name.'; echo pVariable: .$name; for($i=0; $i strlen($name); $i++) print pCharacter: .$i.\$name[$i]\; ? even though the string does contain 9 consecutive spaces, only one is ever printed to the screen with echo, print or printf. There is nothing in the documentation for these functions that I've found that says this is the expected behavior, or how to override if one really wants those spaces honored. Why is this important? Well, the application this is in allows users to define text strings that are inserted into the database with multiple consecutive spaces, however, when constructing select lists in PHP using these same entries the spaces are compacted, so the SELECT now doesn't match what is in the database. Is there a way to override this behavior? Thanks, Geoff Quelch -- Geoff Quelch Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compacting multiple spaces...
On Friday 14 April 2006 12:15, Geoffrey E. Quelch wrote: Hi, I am running a self-compiled PHP version 4.4.2 on Apache 1.3.34 on White Box Enterprise Linux 3. I found a problem in my database access code (Oracle 9.2.0.4 if it matters) and have determined that spaces in string variables are being compacted on output in PHP. This PHP extract, when run, illustrates the problem: ?php $name = Space 9; print pLength: .strlen($name); printf(pVariable: %s,$name); print pVariable: '.$name.'; echo pVariable: .$name; for($i=0; $i strlen($name); $i++) print pCharacter: .$i.\$name[$i]\; ? even though the string does contain 9 consecutive spaces, only one is ever printed to the screen with echo, print or printf. There is nothing in the documentation for these functions that I've found that says this is the expected behavior, or how to override if one really wants those spaces honored. Why is this important? Well, the application this is in allows users to define text strings that are inserted into the database with multiple consecutive spaces, however, when constructing select lists in PHP using these same entries the spaces are compacted, so the SELECT now doesn't match what is in the database. Is there a way to override this behavior? Thanks, Geoff Quelch -- Geoff Quelch Email: [EMAIL PROTECTED] I would suggest replacing spaces with their HTML equivalent (nbsp;). You could either store it that way, or change it when you output. Then when you go to run the query change all nbsp; instances back to space. HTH -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] make keys of a associative array DB field names?
Hi, Would anybody remind me how this should be achieved? This returns all the names of the fields. while( ($f = odbtp_fetch_field( $qry )) ) { echo $f-name . \n; } This returns the query results: while( ($rec = odbtp_fetch_array($qry)) ) { foreach ($rec as $var) { echo $var\n; } } How should I connect them together? Say, the fields are 'name', 'age', 'score'. I want to print out $rec['name'], $rec['age'] and $rec['score'] rather than using $rec[0], $rec[1] and $rec[2]. Thanks in advance for any ideas, Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] make keys of a associative array DB field names?
At 12:54 PM 4/14/2006, Bing Du wrote: Would anybody remind me how this should be achieved? This returns all the names of the fields. while( ($f = odbtp_fetch_field( $qry )) ) { echo $f-name . \n; } This returns the query results: while( ($rec = odbtp_fetch_array($qry)) ) { foreach ($rec as $var) { echo $var\n; } } How should I connect them together? Say, the fields are 'name', 'age', 'score'. I want to print out $rec['name'], $rec['age'] and $rec['score'] rather than using $rec[0], $rec[1] and $rec[2]. Here's one way: $oHandle = mysql_query($sSQL); if (!$oHandle) { // error trapping goes here } // cycle through the records: while ($aDataRow = mysql_fetch_array($oHandle, MYSQL_ASSOC)) { // cycle through the fields in each record: foreach ($aDataRow as $sField = $sValue) { // $sField is the field name // $sValue is the field value } } Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compacting multiple spaces...
It is not PHP but HTML. In HTML any 'whitespace character', that is space, tab or new line, is taken as a single whitespace character. It has nothing to do with PHP. You can either replace them with nbsp; which prints as a space but doesn't fall into the category of 'whitespace character' and is thus respected or you can use the pre tag, which will produce a mono-spaced output with all blanks and new lines as they come. Satyam - Original Message - From: Geoffrey E. Quelch [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, April 14, 2006 9:15 PM Subject: [PHP] Compacting multiple spaces... Hi, I am running a self-compiled PHP version 4.4.2 on Apache 1.3.34 on White Box Enterprise Linux 3. I found a problem in my database access code (Oracle 9.2.0.4 if it matters) and have determined that spaces in string variables are being compacted on output in PHP. This PHP extract, when run, illustrates the problem: ?php $name = Space 9; print pLength: .strlen($name); printf(pVariable: %s,$name); print pVariable: '.$name.'; echo pVariable: .$name; for($i=0; $i strlen($name); $i++) print pCharacter: .$i.\$name[$i]\; ? even though the string does contain 9 consecutive spaces, only one is ever printed to the screen with echo, print or printf. There is nothing in the documentation for these functions that I've found that says this is the expected behavior, or how to override if one really wants those spaces honored. Why is this important? Well, the application this is in allows users to define text strings that are inserted into the database with multiple consecutive spaces, however, when constructing select lists in PHP using these same entries the spaces are compacted, so the SELECT now doesn't match what is in the database. Is there a way to override this behavior? Thanks, Geoff Quelch -- Geoff Quelch Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compacting multiple spaces...
At 12:15 PM 4/14/2006, Geoffrey E. Quelch wrote: even though the string does contain 9 consecutive spaces, only one is ever printed to the screen with echo, print or printf. At 01:19 PM 4/14/2006, Satyam wrote: It is not PHP but HTML. In HTML any 'whitespace character', that is space, tab or new line, is taken as a single whitespace character. It has nothing to do with PHP. Geoffrey, another way of saying this is that it's only the SCREEN RENDERING that makes multiple whitespace characters APPEAR to be a single space. If you view the source of your page I think you'll see all your spaces intact. Since the multiple spaces are really there in your string, you should be able to operate on all of them, for example using string-array functions. In your script: $name = Space 9; * print pLength: .strlen($name); printf(pVariable: %s,$name); print pVariable: '.$name.'; echo pVariable: .$name; * for($i=0; $i strlen($name); $i++) * print pCharacter: .$i.\$name[$i]\; ...the lines I've marked with an asterisk should reveal the true length of the string, including all nine spaces, even though the screen-print functions make it look like they've been consolidated into one space. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL result
Mohsen Pahlevanzadeh wrote: Dear all, I remember that i use a func that it return an array what it consist of result of my sql query. Please name me that. Yours,Mohsen Was it mysql_fetch_array()? Which SQL was it? Also, are you aware that even entering an incorrect function name at php.net will get you some free pointers ? H.A.N.D.! Kevin Kinsey -- There is nothing more exhilarating than to be shot at without result. -- Churchill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compacting multiple spaces...
On Friday 14 April 2006 10:07 pm, you wrote: I don't have any further suggestions to make; it sounds like you're looking at all the right things. I hope you find the problem by stripping it down to the bare bones. Please post your findings to the list whether you figure it out or not. Thanks again. I have finally tracked down the root cause to my original problem. I was using the select HTML construct a little too glibly. I was using it in the form: ?php $name .= Space 9; echo form action='submit.php' enctype='text/plain'\n; echo select name='stationName' \n; echo option\n; echo $name\n; echo /select\n; echo pinput type='submit' name='submit' value='Submit'\n; echo input type='reset' name='reset' value='Reset'\n; echo /form; ? i.e not providing a value attribute on the option construct to be passed to the submitted form, and so the stationName contained the *rendered* string, not the string that was input. Thanks again to all who sent suggestions. I guess one still has things to learn after 10+ years using HTML. Regards, GEQ -- Geoff Quelch Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MS SQL extension not loading
I have experience with loading mysql.dll and other module which unable to load, even the module is exist on the path. In my problem, it was solved by put php directory (c:/php) on windows system variables (Environment Variables), please check Instalation FAQ(5.14) of PHP Manual. It look like, required re-start the computer too. Just try it, hopefully it will help -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 12, 2006 4:24 AM To: Laszlo Nagy Cc: php-general@lists.php.net Subject: Re: [PHP] MS SQL extension not loading On Tue, April 11, 2006 11:45 am, Laszlo Nagy wrote: I have a problem with a Win2003 server, IIS6 and PHP 5.1.2. I have Microsoft SQL Server tools installed. C:\PHP is on the path. Extension dirs are configured correctly. The php_mssql.dll is present there. Everything looks okay, except that the server does not load the extension. If I do var_dump(get_loaded_extensions()) then I get this: array(23) { [0]= string(6) bcmath [1]= string(8) calendar [2]= string(10) com_dotnet [3]= string(5) ctype [4]= string(4) date [5]= string(3) ftp [6]= string(5) iconv [7]= string(4) odbc [8]= string(4) pcre [9]= string(10) Reflection [10]= string(7) session [11]= string(6) libxml [12]= string(8) standard [13]= string(9) tokenizer [14]= string(4) zlib [15]= string(9) SimpleXML [16]= string(3) dom [17]= string(3) SPL [18]= string(4) wddx [19]= string(3) xml [20]= string(9) xmlreader [21]= string(9) xmlwriter [22]= string(5) ISAPI } What am I doing wrong? Please help me. I was trying for a week and nobody could help me on the hungarian PHP list. I'm lost. Step #1: Create and surf to a phpinfo() file: ?php phpinfo();? Check the php.ini setting in the top portion to see where php.ini MUST BE for it to be read. This directory was set at compile-time, by whomever happened to compile the php.exe (and dll) that day. You can't change it ; You have to live with it. [Actually, in recent Apache versions, you can use an httpd.conf setting to alter it, but let's not confuse things that are version-specific] Step #2: Find your php.ini file, and MOVE it to where phpinfo() wants it to be. If you have no php.ini file, find the php.ini-dist file, copy it, and rename it. Step #3 In php.ini look at the extensions_dir setting. Fix it. One thing is clear from your output: You've GOT a lot of extensions working, so you probably already have all of this correct. Nevertheless, you follow the first 3 steps because that's just the way you make SURE you have things set up like you think you have them set up, even if it all looks good... Step #4. Compare version numbers of your mssql_php.dll and the version of PHP you are running. You CANNOT mix-n-match old DLLs with new PHP and vice versa. It will sometimes work until you happen to use the one function that CHANGED between versions. If you just went out and found some random mssql_php.dll to throw in the directory, it is NOT going to work. In recent PHP versions, I think it won't even let you screw this up, as each module is, I think, tagged with an internal version reference number and PHP will reject invalid DLLs. I think... But in the old days, it was a common mistake for folks to install mis-matched DLL versions and have all kinds of trouble. Step #4a Check your log files. I'm assuming ISS actually HAS logfiles... It must have, right? Might be in system events log. Might be in an error_log file next to your IIS web traffic logs. Knowing Microsoft, it might be *ANYWHERE*... But, wherever it is, find it, and read it. If all else fails, you can surf to PHP, and then use Explorer to search for files changed in the past five minutes. Or, at least, I think it will let you search in the past five minutes. Yesterday I went looking to do that and could only find files changed in the past day. Ugh. I'm guessing that you might find an error message about the mssql_php.dll being the wrong version... Step #5. Switch to a superior web server: Apache :-) Step #6. Switch to a superior OS like Linux or FreeBSD :-) :-) :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php