RE: [PHP-DB] Date Conversion

2006-05-16 Thread Ralph Brickley
A simple associate array would work as well, although not quite as elegent.
$months_arr = array(January=01, February=02...);

-Original Message-
From: Mark Bomgardner [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 16, 2006 12:35 PM
To: Php-Db
Subject: [PHP-DB] Date Conversion

PHP 4.4/MySQL 4.0

I am tying to convert a date to put into a database from a string (ie: 
January, February) to a numeric value (ie: 01,02).  I am taking the 
value from a form, which is a drop down menu listing the months.

$sMonth1 = $_POST['Smonth']; returns the money selected from the form.
When I go to format the month from a string to numeric with 
date('m',strtotime($sMonth1));
it returns 12, no matter which month I select.

In reading the docs at php.net, date('m',strtotime($sMonth1)); is 
correct to reformat from a string to a time format.

What am I missing.


mark bomgardner

-- 
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] Date Conversion

2006-05-16 Thread Ralph Brickley
ADDENDUM:

To Convert your date string, use the associate array:
$months_arr = array(January=01, February
=02...);

$month = $months_arr[February];

* Replace $months_arr[February] with $_POST[Month];

// Output
$month = 01;



Ralph Brickley

-Original Message-
From: Ralph Brickley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 16, 2006 1:29 PM
To: [EMAIL PROTECTED]; 'Php-Db'
Subject: RE: [PHP-DB] Date Conversion

A simple associate array would work as well, although not quite as elegent.
$months_arr = array(January=01, February=02...);

-Original Message-
From: Mark Bomgardner [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 16, 2006 12:35 PM
To: Php-Db
Subject: [PHP-DB] Date Conversion

PHP 4.4/MySQL 4.0

I am tying to convert a date to put into a database from a string (ie: 
January, February) to a numeric value (ie: 01,02).  I am taking the 
value from a form, which is a drop down menu listing the months.

$sMonth1 = $_POST['Smonth']; returns the money selected from the form.
When I go to format the month from a string to numeric with 
date('m',strtotime($sMonth1));
it returns 12, no matter which month I select.

In reading the docs at php.net, date('m',strtotime($sMonth1)); is 
correct to reformat from a string to a time format.

What am I missing.


mark bomgardner

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

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

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



RE: [PHP-DB] Cannot connect to MySQL using

2006-03-29 Thread Ralph Brickley
It looks right on the function use, but you may want to check the
installation of the mySQL service to ensure you have the right setup. There
is normally always a password on root.

Also, I would be a little more careful of pasting your IP Address into a
message forum. I'm sure we are all honest people but you never know. Coupled
with your DB name we can now look at your data if we get in.

You didn't tell us what the error was when using 'localhost' versus the IP
address. What does it say then?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 29, 2006 2:31 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Cannot connect to MySQL using

Dear All,

 

 

I need some help. I`m trying to connect to MySQL using these script :

 

?php

 

  $dbHostname = localhost;

  $dbUsername = root;

  $dbPassword = ;

  $dbName = cms;  

   

  //  Make connection to database 

  //  If no connection made, display error Message  

  $dblink = mysql_connect($dbHostname, $dbUsername, $dbPassword) or
die(Error !! Unable to connect to database);   

 

  // Select database or print error message if unsuccessful */

  mysql_select_db($dbName) or die( Unable to select database
.$dbName); 

 

?

 

But if I changed the Hostname with the Server Name/IP Address (not using
localhost), the error message become :

 

Warning: mysql_connect() [function.mysql-connect
http://tu-lip-nt4/CMS/forecast/function.mysql-connect ]: Host
'157.47.115.180' is not allowed to connect to this MySQL server in
c:\wamp\www\CMS\forecast\includes\db_connection.php on line 10
Error !! Unable to connect to database

 

 

What should I do?

 

Thanks  Regards,

 

Anita

 



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



[PHP-DB] MySQL - Unable to run service

2006-03-15 Thread Ralph Brickley
I have been using MySQL for quite some time and am now running Server 4.1. I
have been developing custom web-based software for a customer and recently
moved their server to a different machine. I have everything running
smoothly EXCEPT for mySQL. Any time I try to start the service I get an
error:

Error 1067: Unable to start service on Local Computer.

 

Anyone have an idea about that? That user logged in is the comp
administrator.

 

 

Ralph E. Brickley

AE Security and Electronics

(503) 472-6439 / (877) 472-6439

(503) 519-3914 Cell

(503) 472-3570 Fax

[EMAIL PROTECTED]