[PHP] is there a number translation function?

2005-10-29 Thread Linda H

Hi,

Does anyone know of a function for translating a decimal number into an 
English number. In other words, if you pass it 1 it will return 'one', if 
you pass it 127 it will return  'one hundred twenty seven', and etc.


Thanks,
Linda

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] curious (and frustrating) php/apache behavior

2005-10-29 Thread Linda H


We wish to include multiple PHP scripts into our pages but are only 
succeeding in having the first included PHP script executed; the rest are 
ignored or misinterpreted as HTML...


I don't know if this is part of your problem, but when you do an include, 
it throws you out of php. So, if there is any php code in the include, you 
can't rely on the include being inside a php block. You must put a php 
block inside the include as well. This is true no matter how you name the 
include file (.php, .inc, .htm).


Linda H 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Retrieve Data Formated from Text field

2005-10-29 Thread Linda H



 The data is inserted into db in this way:
 Hello,
 This is a sample of first line.
 This is another paragraph, blah
blah blah
Bye
 But the result is in one paragraph:
  Hello, This is a sample of first line.
This is another paragraph, blah
blah blah Bye


It sounds as if your database record includes a carriage return or new line 
character (\n), which is not recognized in html (except using the pre tag.


You need to replace the new line with an html p tag. You might want to 
store each paragraph in a different database record (make a table for the 
text. It will include a key that connects it to the main record, the text, 
and a sequence number that tells you the order in which the paragraphs 
should be displayed).


Linda H 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Date confusion

2005-07-27 Thread Linda H

Hi,

I must admit I am surprised at the paucity of date and time functions in PHP.

I have a date stored in a MySQL database in field of datatype date. PHP 
doesn't seem to have a function I can use to format it for print. I tried 
the following but regardless of the value in the date field, it displays as 
'Wednesday December 31, 1969'  (I know this is the day before the UNIX 
epoch.).


echo 'p'.date('l F j, Y',$start_date).'/p';

I tried casting the field to datetime, but it didn't pass the parser. 
Finally I did the following, which seems to work, but is awfully convoluted:


echo 'pDate: '.date('l F j, Y',strtotime($start_date).'/p';

The other thing I'm concerned about is that strtotime takes the locale into 
consideration. I don't want it adjusting the date - I just want it printed out.


Is there a better way to do this?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP and Perl

2005-07-23 Thread Linda H
I am needing to write a front end for an online application written in 
Perl. Is there a way for PHP to call a module or function written in Perl?


Thanks,
Linda 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] problems with self referential sticky forms

2005-07-19 Thread Linda H

Hi,

I'm trying to code a form that will call itself. The first time it is 
called (by a link), it should display the empty form. If it was called by a 
submit to itself, it will validate and then process or re-display the form 
if it didn't pass validation.


In Programing PHP I found a technique (example 7-4.):

?
$fahr = $_GET['fahrenheit'];
if (is_null($fahr)){ echo 'fahr is null';}
$

The text says we copy the form parameter value into $fahr. If we aren't 
given that parameter, $fahr contains NULL.


I thought this could be used to create a value that would then be displayed 
in the form field. If the parameter wasn't passed, the form field would be 
empty. If the paramenter was passed, the value would be displayed. Like so:


input name=temp type=text  value=?php echo $fahr; ? /

But when execute the code above I get an error: Notice: Undefined index: 
fahrenheit in C:\Program Files\Apache Group\Apache2\htdocs\.


Yet, the line 'fahr is null does print', so $fahr was successfully created. 
Because I'm in debug mode, my error reporting is set to E_ALL. Are these 
sorts of errors ones that will disappear when the error reporting threshold 
is set lower. Should they be accepted in a development environment.  Or is 
there a better way of accomplishing what I want to do.


Thanks,
Linda  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problems with self referential sticky forms

2005-07-19 Thread Linda H



Where is fahrenheit? change the input name...


fahreheit is here:

?
$fahr = $_GET['fahrenheit'];
if (is_null($fahr)){ echo 'fahr is null';}
$

The error was on the line: $fahr = $_GET['fahrenheit'];

Linda

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problems with self referential sticky forms

2005-07-19 Thread Linda H



Where is fahrenheit? change the input name...


fahreheit is here:

?
$fahr = $_GET['fahrenheit'];
if (is_null($fahr)){ echo 'fahr is null';}
$

The error was on the line: $fahr = $_GET['fahrenheit'];

Linda

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread Linda H
For those who didn't join this thread at the beginning, I'm running MySQL 
4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system.


I installed in the sequence - MySQL, then Apache, then PHP. MySQL was 
running when the others were installed (which is what the book I am using 
seemed to indicate). Apache was not running when PHP was installed.



What does php.ini have for this line
display_errors = On


Now we are getting somewhere. Even though error_reporting was set to E_ALL, 
display_errors was Off. I set it On and now I'm getting an error.


Fatal error: Call to undefined function mysql_connect() in C:\Program 
Files\Apache Group\Apache2\htdocs\example\test_connect.php on line 15


the phpinfo() display doesn't reference MySQL at all. It does reference 
SQLite with the following info:


SQLite supportenabled:
PECL Module version 2.0-dev $Id: sqlite.c,v 1.146.2.2 2004/08/02 22:43:42 
iliaa Exp $

SQLite Library: 2.8.14
SQLite Encoding: iso8859

Directive: sqlite_assoc_case, Local Value: 0, Master Value: 0

So it looks like MySQL didn't get configured with PHP.

In the PHP FAQ on database issues, I found the following:


4. PHP 5 no longer bundles MySQL client libraries, what does this mean to 
me? Can I still use MySQL with PHP? I try to use MySQL and get function 
undefined errors, what gives?


Yes. There will always be MySQL support in PHP of one kind or another. The 
only change in PHP 5 is that we are no longer bundling the client library 
itself. Some reasons in no particular order:

   * Most systems these days already have the client library installed.
   * Given the above, having multiple versions of the library can get 
messy. For example, if you link mod_auth_mysql against one version and PHP 
against another, and then enable both in Apache, you get a nice fat crash. 
Also, the bundled library didn't always play well with the installed server 
version. The most obvious symptom of this being disagreement over where to 
find the mysql.socket Unix domain socket file.
   * Maintenance was somewhat lax and it was falling further and further 
behind the released version.
   * Future versions of the library are under the GPL and thus we don't 
have an upgrade path since we cannot bundle a GPL'ed library in a 
BSD/Apache-style licensed project. A clean break in PHP 5 seemed like the 
best option.


This won't actually affect that many people. Unix users, at least the ones 
who know what they are doing, tend to always build PHP against their 
system's libmyqlclient library simply by adding the --with-mysql=/usr 
option when building PHP. Windows users may enable the extension 
php_mysql.dll inside php.ini. Also, be sure libmysql.dll is available to 
the systems PATH. For more details on how, read the FAQ on 
http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopathsetting 
up the Windows systems PATH. Because libmysql.dll (and many other PHP 
related files) exist in the PHP folder, you'll want to add the PHP folder 
to your systems PATH.


I added my PHP folder (C:\php5\) to my system path and restarted 
(libmysql.ddl is in php5). Still get the error. I enabled the extension 
php_mysql.dll in php.ini and Apache startup says it can't find it 
(php_mysql.dll is in C:\php5\ext).


So, should I move php_mysql.dll to c:\php5, change the system path, or 
what? And what about php.ini showing sqlite instead of MySQL? Do I need to 
get the MySQL client libraries (what are they called and where do I put 
them - I already have some mysql dll's in the PHP libraries.


Linda

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SOLVED! Need help with PHP / MySQL connect problem

2005-07-18 Thread Linda H



do you have this in your php.ini extensions?
extension=php_mysql.dll


yes

Make sure you extension path is referencing its location also so it can 
find it...

for example:
extension_dir = c:/php/ext/


I changed this and now I can connect to MySQL! Haven't runa query yet, but 
I think I'm past the roadblock. Thanks so much to all who helped.


Linda

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Need help with PHP / MySQL connect problem

2005-07-17 Thread Linda H

Hi,

I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP 
system. I can run scripts with PHP and HTML statements and see correct 
output in my browser. But when I try to connect to MySQL I get nothing, 
including no error messages.


One book I have says to run the following scrip to test the connection. It 
should print either the Resource name or an error message:


?php
  echo mysql_connect ('localhost','calendar','pass1234');  # host, user, 
password

?

I get no output at all, and if the statement is placed in a larger script, 
above html/PHP output, it suppresses that as well.


Using the mysql monitor from the DOS command prompt, I can connect as user 
'calendar' with password 'pass1234', select a database and execute SQL 
statements successfully.


Can anyone help me figure out why I can't seem to connect, please?

Linda 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Linda H

Thanks for the advice, Matt, but it doesn't seem to solve my problem.

php.ini is in the C:Program Files/WINDOWS directory and error_reporting was 
set to E_ALL.


I found php5ts.dll in the WINDOWS/system32 directory. I copied it to 
WINDOWS/system, just in case. My install instructions said to put it with 
my other dlls, which might be in either directory. Most of them are in 
system32.



Using this at the top of your script will allow PHP and MySQL to interact.
$_POST['dbconn']=mysql_select_db(database_name, 
mysql_connect(server_name,user_name,password));


I put this in my script (changing parameters as appropriate) but got no 
results and no error messages. Any other ideas. I've spent hours on this, 
trying everything I could think of and I'm very frustrated.


The rest of my output is still suppressed if I put the connect script above 
it in the file.



It does sound like you have notices and warnings turned off in php.ini:
Find php.ini (not sure where it installs to in Windows version), and set 
error_reporting  = E_ALL.
This will show all notices and warnings generated by your PHP code; 
extremely usefull in debugging.


Matt Darby

Linda H wrote:

I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP 
system. I can run scripts with PHP and HTML statements and see correct 
output in my browser. But when I try to connect to MySQL I get nothing, 
including no error messages.


One book I have says to run the following scrip to test the connection. 
It should print either the Resource name or an error message:


?php
  echo mysql_connect ('localhost','calendar','pass1234');  # host, user, 
password

?

I get no output at all, and if the statement is placed in a larger 
script, above html/PHP output, it suppresses that as well.


Using the mysql monitor from the DOS command prompt, I can connect as 
user 'calendar' with password 'pass1234', select a database and execute 
SQL statements successfully.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Linda H



Try this just for kicks:

?
   aslkdjfalsd;
?


Nope - nothing :-(

See if this will output errors. It's rather hard to debug without error 
messages ;)


No kidding!


If I remember correctly, isn't php.ini supposed to be in c:/PHP?


It came in c:/php5 as php.ini-recommended. My instructions were to move it 
to c:\WINDOWS and rename to php.ini.


Linda

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Linda H

I added the following to the top of my script:

?php
  echo phpinfo();
?

Got all sorts of environment and path info. Not anything about MySQL, but I 
didn't see anything that looked obviously wrong, though I don't understand 
a lot of it.


I ried reinstalling MySQL, Apache, and PHP. No change.

Linda 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php