php-general Digest 19 Apr 2013 20:16:14 -0000 Issue 8200

2013-04-19 Thread php-general-digest-help

php-general Digest 19 Apr 2013 20:16:14 - Issue 8200

Topics (messages 320879 through 320883):

Re: ?=$var?
320879 by: Lester Caine
320880 by: Larry Martell
320881 by: Micky Hulse

Re: Date weirdness
320882 by: Larry Martell

Newbie Question - Parse XML with PHP...
320883 by: dealTek

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---

Larry Martell wrote:

Continuing in my effort to port an app from PHP version 5.1.6 to
5.3.3, the app uses this construct all over the place when building
links:

?=$var?

I never could find any documentation for this, but I assumed it was
some conditional thing - use $var if it's defined, otherwise use
nothing. In 5.1.6 it seems to do just that. But in 5.3.3 I'm not
getting the value of $var even when it is defined. Has this construct
been deprecated? Is there now some other way to achieve this?


There WAS a period when ?= was linked to short opening tag setting, which cause 
a number of headaches, but currently the two are now isolated!


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
---End Message---
---BeginMessage---
On Wed, Apr 17, 2013 at 5:02 PM, Micky Hulse rgmi...@gmail.com wrote:
 On Wed, Apr 17, 2013 at 3:59 PM, Micky Hulse rgmi...@gmail.com wrote:
 You might need to turn on the short tag option
 in your conf file.

 Sorry, ini file, not conf. Been a long day. :D

 I guess I should have asked if short tags are turned on for your 5.3.3?

That was it. Thanks!!
---End Message---
---BeginMessage---
On Thu, Apr 18, 2013 at 8:36 AM, Larry Martell
la...@software-horizons.com wrote:
 That was it. Thanks!!

Np. Glad it helped. :)
---End Message---
---BeginMessage---
On Thu, Mar 28, 2013 at 3:40 PM, Larry Martell larry.mart...@gmail.com wrote:
 On Thu, Mar 28, 2013 at 2:44 PM, Steven Staples sstap...@mnsi.net wrote:
 I think I am losing my mind. I have some time zone converting code, and I
 just don't understand what I am seeing. Also my system seems to return the
 wrong time after I do some date operations on unrelated objects.

 This is from a machine that is in eastern time. I want to convert to, for
 example central time:

 $ndate = new Date(date(Y-m-d H:i:s));
 echo $ndate-format(%Y-%m-%d %H:%M:%S);
 2013-03-28 15:35:07  - this is the correct time

 $ndate-setTZbyID(EDT);
 echo $ndate-format(%Y-%m-%d %H:%M:%S);
 2013-03-28 15:35:07 - still correct

 $ndate-convertTZbyID(US/Central);
 echo $ndate-format(%Y-%m-%d %H:%M:%S);
 2013-03-28 10:35:07 - this is wrong it should be 14:35:07

 $xdate = new Date(date(Y-m-d H:i:s));
 echo $xdate-format(%Y-%m-%d %H:%M:%S);
 2013-03-28 19:35:07 - HUH? This is wrong - should be 15:35:07

 What in the world is going on here?


 I found this function a while back when I was converting UTC to EST... 
 simple task I know, but still...

 ( I am sorry to whomever wrote this, I didn't keep the source where I found 
 it )

 function convert_time_zone($date_time, $from_tz = 'UTC', $to_tz = 
 'America/Toronto')
 {
 $time_object = new DateTime($date_time, new DateTimeZone($from_tz));
 $time_object-setTimezone(new DateTimeZone($to_tz));
 return $time_object-format('Y-m-d H:i:s');
 }

 I don't seem to have the DateTime object. We are running 5.1.6 and
 that was added in 5.2.0. We are getting the Date module from an
 external extension. I'll have to see about upgrading.

I've upgraded to 5.3.3, got rid of the external Date extension and
implement your solution. It's working perfectly. Thanks much!
---End Message---
---BeginMessage---
Hi all,

newbie - just starting with trying to parse XML...


$mylist = simplexml_load_file('thelist.xml');

then use a foreach to echo the data...

?php
$mysongs = simplexml_load_file('songs.xml');

foreach ($mysongs as $songinfo) {
$title=$songinfo-title;
$artist=$songinfo-artist;
$date=$songinfo['dateplayed'];
echo $title.' --- ';
echo $artist.' --- ';
echo $date.' --- ';
echo ' /br ';
}

?

that I get ...

Question: how do you use $mylist when the xml is not as a file but is returned 
on a web page?


an example of the real xml I am trying to work with is like this demo below 

Goal : when this response comes back - I would like to be able to get the data 
as php and then update the database


example
?xml version=1.0 encoding=UTF-8?
response
  result1/result
  

[PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek
Hi all,

newbie - just starting with trying to parse XML...


$mylist = simplexml_load_file('thelist.xml');

then use a foreach to echo the data...

?php
$mysongs = simplexml_load_file('songs.xml');

foreach ($mysongs as $songinfo) {
$title=$songinfo-title;
$artist=$songinfo-artist;
$date=$songinfo['dateplayed'];
echo $title.' --- ';
echo $artist.' --- ';
echo $date.' --- ';
echo ' /br ';
}

?

that I get ...

Question: how do you use $mylist when the xml is not as a file but is returned 
on a web page?


an example of the real xml I am trying to work with is like this demo below 

Goal : when this response comes back - I would like to be able to get the data 
as php and then update the database


example
?xml version=1.0 encoding=UTF-8?
response
  result1/result
  result-textSUCCESS/result-text
  transaction-id1865264174/transaction-id
  result-code100/result-code
  authorization-code123456/authorization-code
  avs-resultN/avs-result
  cvv-resultN/cvv-result
  action-typesale/action-type
  amount12.00/amount
  ip-address::1/ip-address
  industryecommerce/industry
  processor-idccprocessora/processor-id
  currencyUSD/currency
  order-descriptionSmall Order/order-description
  merchant-defined-field-1Red/merchant-defined-field-1
  merchant-defined-field-2Medium/merchant-defined-field-2
  order-id1234/order-id
  tax-amount2.00/tax-amount
  shipping-amount0.00/shipping-amount
  billing
first-nameJohn/first-name
last-nameSmith/last-name
address11234 Main St./address1
cityBeverly Hills/city
stateCA/state
postal90210/postal
countryUS/country
phone555-555-/phone
emailt...@example.com/email
companyAcme, Inc./company
cc-number40**0002/cc-number
cc-exp0118/cc-exp
  /billing
  shipping
first-nameMary/first-name
last-nameSmith/last-name
address11234 Main St./address1
cityBeverly Hills/city
stateCA/state
postal90210/postal
countryUS/country
address2Unit #2/address2
  /shipping
  product
product-codeSKU-123456/product-code
descriptiontest product description/description
commodity-codeabc/commodity-code
unit-of-measure1/unit-of-measure
unit-cost5./unit-cost
quantity1./quantity
total-amount7.00/total-amount
tax-amount2.00/tax-amount
tax-rate1.00/tax-rate
discount-amount2.00/discount-amount
discount-rate1.00/discount-rate
tax-typesales/tax-type
alternate-tax-id12345/alternate-tax-id
  /product
  product
product-codeSKU-123456/product-code
descriptiontest 2 product description/description
commodity-codeabc/commodity-code
unit-of-measure2/unit-of-measure
unit-cost2.5000/unit-cost
quantity2./quantity
total-amount7.00/total-amount
tax-amount2.00/tax-amount
tax-rate1.00/tax-rate
discount-amount2.00/discount-amount
discount-rate1.00/discount-rate
tax-typesales/tax-type
alternate-tax-id12345/alternate-tax-id
  /product
/response








--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread Sebastian Krebs
A webpage is a file, that (usually) a browser downloads and parses.
You'll do exactly the same :-) I don't know exactly, but you can try to
pass the URL directly to simplexml_load_file(). If this doesn't work,
download the content (for example with file_get_contents()) and pass it to
simplexml_load_string(). There are obviously many other approaches, but you
should now have an idea :-)

Or you use a specialized library like Guzzle.
Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com:

 Hi all,

 newbie - just starting with trying to parse XML...


 $mylist = simplexml_load_file('thelist.xml');

 then use a foreach to echo the data...

 ?php
 $mysongs = simplexml_load_file('songs.xml');

 foreach ($mysongs as $songinfo) {
 $title=$songinfo-title;
 $artist=$songinfo-artist;
 $date=$songinfo['dateplayed'];
 echo $title.' --- ';
 echo $artist.' --- ';
 echo $date.' --- ';
 echo ' /br ';
 }

 ?

 that I get ...

 Question: how do you use $mylist when the xml is not as a file but is
 returned on a web page?


 an example of the real xml I am trying to work with is like this demo
 below 

 Goal : when this response comes back - I would like to be able to get the
 data as php and then update the database


 example
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response








 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]




[PHP] mysql_connect noob question

2013-04-19 Thread Glob Design Info

I know this has probably been answered already.

When I pass a user name and password from a form to my PHP script and 
then pass those to mysql_connect it doesn't connect. When I paste those 
exact same values into mysql_connect as string literals it works.


Can anyone tell me why this happens?

I know the strings are identical to the literals I try in a test but 
they don't work when submitted via form.


$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

# Connect to remote DB

$LINK = mysql_connect( $host, $form_user, $form_pass );

And yes, my $host param is correct.

Thanks,

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



Re: [PHP] mysql_connect noob question

2013-04-19 Thread Matijn Woudt
On Fri, Apr 19, 2013 at 10:43 PM, Glob Design Info i...@globdesign.comwrote:

 I know this has probably been answered already.

 When I pass a user name and password from a form to my PHP script and then
 pass those to mysql_connect it doesn't connect. When I paste those exact
 same values into mysql_connect as string literals it works.

 Can anyone tell me why this happens?

 I know the strings are identical to the literals I try in a test but they
 don't work when submitted via form.

 $form_user = $_POST[ 'user' ];
 $form_pass = $_POST[ 'password' ];

 # Connect to remote DB

 $LINK = mysql_connect( $host, $form_user, $form_pass );

 And yes, my $host param is correct.

 Thanks,


Try printing the $form_user and form_pass values, it might be that it's
just an error elsewhere, maybe field name is different in the html?
Otherwise, it might be you have some php init setting, like magic quotes
that does something with the input data.

- Matijn


Re: [PHP] mysql_connect noob question

2013-04-19 Thread Glob Design Info
Already did that. I printed the form values in the PHP script after they 
are received and they print exactly as entered in the form. Even checked 
for extra spaces.


Any functions I can pass the values to to remove the magic quotes?

Thanks,

On 4/19/13 1:47 PM, Matijn Woudt wrote:

On Fri, Apr 19, 2013 at 10:43 PM, Glob Design Info i...@globdesign.comwrote:


I know this has probably been answered already.

When I pass a user name and password from a form to my PHP script and then
pass those to mysql_connect it doesn't connect. When I paste those exact
same values into mysql_connect as string literals it works.

Can anyone tell me why this happens?

I know the strings are identical to the literals I try in a test but they
don't work when submitted via form.

$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

# Connect to remote DB

$LINK = mysql_connect( $host, $form_user, $form_pass );

And yes, my $host param is correct.

Thanks,



Try printing the $form_user and form_pass values, it might be that it's
just an error elsewhere, maybe field name is different in the html?
Otherwise, it might be you have some php init setting, like magic quotes
that does something with the input data.

- Matijn



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



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek

On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com wrote:

 A webpage is a file, that (usually) a browser downloads and parses. You'll 
 do exactly the same :-) I don't know exactly, but you can try to pass the URL 
 directly to simplexml_load_file(). If this doesn't work, download the content 
 (for example with file_get_contents()) and pass it to 
 simplexml_load_string(). There are obviously many other approaches, but you 
 should now have an idea :-)
 

Thanks Sebastian for the help

Actually what is happening in my case is:

page1.php is sending out to credit card company - getting processed - then 
coming back to the *same page1.php* with the XML data listed below...

- so I'm not going to some other page to get it - it is coming to me to the 
same page I am on..

so - after the XML result comes in - I need to assign the php to the XML 
somehow...

I hope I am making myself clear

Thanks in advance for the help


 Or you use a specialized library like Guzzle.
 
 Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com:
 Hi all,
 
 newbie - just starting with trying to parse XML...
 
 
 $mylist = simplexml_load_file('thelist.xml');
 
 then use a foreach to echo the data...
 
 ?php
 $mysongs = simplexml_load_file('songs.xml');
 
 foreach ($mysongs as $songinfo) {
 $title=$songinfo-title;
 $artist=$songinfo-artist;
 $date=$songinfo['dateplayed'];
 echo $title.' --- ';
 echo $artist.' --- ';
 echo $date.' --- ';
 echo ' /br ';
 }
 
 ?
 
 that I get ...
 
 Question: how do you use $mylist when the xml is not as a file but is 
 returned on a web page?
 
 
 an example of the real xml I am trying to work with is like this demo below 
 
 
 Goal : when this response comes back - I would like to be able to get the 
 data as php and then update the database
 
 
 example
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response
 
 
 
 
 
 
 
 
 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]
 


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] mysql_connect noob question

2013-04-19 Thread Matijn Woudt
On Fri, Apr 19, 2013 at 10:59 PM, Glob Design Info i...@globdesign.comwrote:

 Already did that. I printed the form values in the PHP script after they
 are received and they print exactly as entered in the form. Even checked
 for extra spaces.

 Any functions I can pass the values to to remove the magic quotes?

 Thanks,


You would see the quotes if they were there in the output. There's no
reason why it should not work this way, though I doubt it's safe to do. Can
you show us the rest of the code, including the HTML form?
And exactly what error are you getting? (eg. from mysql_error())




 On 4/19/13 1:47 PM, Matijn Woudt wrote:

 On Fri, Apr 19, 2013 at 10:43 PM, Glob Design Info i...@globdesign.com
 wrote:

  I know this has probably been answered already.

 When I pass a user name and password from a form to my PHP script and
 then
 pass those to mysql_connect it doesn't connect. When I paste those exact
 same values into mysql_connect as string literals it works.

 Can anyone tell me why this happens?

 I know the strings are identical to the literals I try in a test but they
 don't work when submitted via form.

 $form_user = $_POST[ 'user' ];
 $form_pass = $_POST[ 'password' ];

 # Connect to remote DB

 $LINK = mysql_connect( $host, $form_user, $form_pass );

 And yes, my $host param is correct.

 Thanks,


  Try printing the $form_user and form_pass values, it might be that it's
 just an error elsewhere, maybe field name is different in the html?
 Otherwise, it might be you have some php init setting, like magic quotes
 that does something with the input data.

 - Matijn





Re: [PHP] mysql_connect noob question

2013-04-19 Thread tamouse mailing lists
On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com wrote:
 I know this has probably been answered already.

 When I pass a user name and password from a form to my PHP script and then
 pass those to mysql_connect it doesn't connect. When I paste those exact
 same values into mysql_connect as string literals it works.

 Can anyone tell me why this happens?

 I know the strings are identical to the literals I try in a test but they
 don't work when submitted via form.

 $form_user = $_POST[ 'user' ];
 $form_pass = $_POST[ 'password' ];

 # Connect to remote DB

 $LINK = mysql_connect( $host, $form_user, $form_pass );


Please show the error you are getting from the mysql_connect



 And yes, my $host param is correct.

 Thanks,

 --
 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] Newbie Question - Parse XML with PHP...

2013-04-19 Thread tamouse mailing lists
On Fri, Apr 19, 2013 at 4:04 PM, dealTek deal...@gmail.com wrote:

 On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com wrote:

 A webpage is a file, that (usually) a browser downloads and parses. You'll 
 do exactly the same :-) I don't know exactly, but you can try to pass the 
 URL directly to simplexml_load_file(). If this doesn't work, download the 
 content (for example with file_get_contents()) and pass it to 
 simplexml_load_string(). There are obviously many other approaches, but you 
 should now have an idea :-)


 Thanks Sebastian for the help

 Actually what is happening in my case is:

 page1.php is sending out to credit card company - getting processed - then 
 coming back to the *same page1.php* with the XML data listed below...

Please expand what you mean by sending out and coming back - is
this a REST or SOAP API call? In that case, the response body is
likely to be the XML.


 - so I'm not going to some other page to get it - it is coming to me to the 
 same page I am on..

 so - after the XML result comes in - I need to assign the php to the XML 
 somehow...

How do you recognize the XML result com(ing) in ?




 I hope I am making myself clear

 Thanks in advance for the help


 Or you use a specialized library like Guzzle.

 Am 19.04.2013 22:17 schrieb dealTek deal...@gmail.com:
 Hi all,

 newbie - just starting with trying to parse XML...


 $mylist = simplexml_load_file('thelist.xml');

 then use a foreach to echo the data...

 ?php
 $mysongs = simplexml_load_file('songs.xml');

 foreach ($mysongs as $songinfo) {
 $title=$songinfo-title;
 $artist=$songinfo-artist;
 $date=$songinfo['dateplayed'];
 echo $title.' --- ';
 echo $artist.' --- ';
 echo $date.' --- ';
 echo ' /br ';
 }

 ?

 that I get ...

 Question: how do you use $mylist when the xml is not as a file but is 
 returned on a web page?


 an example of the real xml I am trying to work with is like this demo below 
 

 Goal : when this response comes back - I would like to be able to get the 
 data as php and then update the database


 example
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response








 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]



 --
 Thanks,
 Dave - DealTek
 deal...@gmail.com
 [db-3]


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



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek

On Apr 19, 2013, at 3:32 PM, tamouse mailing lists tamouse.li...@gmail.com 
wrote:

 
 page1.php is sending out to credit card company - getting processed - then 
 coming back to the *same page1.php* with the XML data listed below...
 
 Please expand what you mean by sending out and coming back - is
 this a REST or SOAP API call? In that case, the response body is
 likely to be the XML.
 
 
 - so I'm not going to some other page to get it - it is coming to me to the 
 same page I am on..
 
 so - after the XML result comes in - I need to assign the php to the XML 
 somehow...
 
 How do you recognize the XML result com(ing) in ?
 

Hi tamouse,

with my untrained eye - it appears that this  is what is 'sending out'


 $data = sendXMLviaCurl($xmlRequest,$gatewayURL);


and this might be what is 'responding back' on the same page


$gwResponse = @new SimpleXMLElement((string)$data);


you can see these lines towards the bottom at - // Process Step Three...


---



the page code is long - so i cut out some extra lines - but this is
===


all page code - with edits...

?php





// API Setup Parameters

$gatewayURL = 'https://secure.webxxx.com/api/test';

$APIKey = 'xxx';





// If there is no POST data or a token-id, print the initial shopping cart form 
to get ready for Step One.

if (empty($_POST['DO_STEP_1']) empty($_GET['token-id'])) {



print '  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;';

print '

html

  head

meta http-equiv=Content-Type content=text/html; charset=UTF-8 /

titleCollect non-sensitive Customer Info /title

  /head

  body

  ph2Step One: Collect non-sensitive payment information.br //h2/p



  h3 Customer Information/h3

  h4 Billing Details/h4



form action= method=post

  table

  trtdCompany/tdtdinput type=text 
name=billing-address-company value=Acme, Inc./td/tr

 
 
 --- more



  trtdh4br / Shipping Details/h4

  
  
  --more
  

  trtd colspan=2nbsp;/td

  trtd colspan=2 align=centerTotal Amount $12.00 /td/tr

  trtd colspan=2 align=centerinput type=submit value=Submit 
Step Oneinput type=hidden name =DO_STEP_1 value=true/td/tr

  /table



/form

  /body

/html



';

}else if (!empty($_POST['DO_STEP_1'])) {



// Initiate Step One: Now that we've collected the non-sensitive payment 
information, we can combine other order information and build the XML format.

$xmlRequest = new DOMDocument('1.0','UTF-8');



$xmlRequest-formatOutput = true;

$xmlSale = $xmlRequest-createElement('sale');



// Amount, authentication, and Redirect-URL are typically the bare mininum.

appendXmlNode($xmlSale,'api-key',$APIKey);

appendXmlNode($xmlSale,'redirect-url',$_SERVER['HTTP_REFERER']);

appendXmlNode($xmlSale, 'amount', '12.00');

appendXmlNode($xmlSale, 'ip-address', $_SERVER[REMOTE_ADDR]);

//appendXmlNode($xmlSale, 'processor-id' , 'processora');

appendXmlNode($xmlSale, 'currency', 'USD');

//appendXmlNode($xmlSale, 'dup-seconds' , '2');



// Some additonal fields may have been previously decided by user

appendXmlNode($xmlSale, 'order-id', '1234');

appendXmlNode($xmlSale, 'order-description', 'Small Order');

appendXmlNode($xmlSale, 'merchant-defined-field-1' , 'Red');

appendXmlNode($xmlSale, 'merchant-defined-field-2', 'Medium');

appendXmlNode($xmlSale, 'tax-amount' , '2.00');

appendXmlNode($xmlSale, 'shipping-amount' , '0.00');



/*if(!empty($_POST['customer-vault-id'])) {

appendXmlNode($xmlSale, 'customer-vault-id' , 
$_POST['customer-vault-id']);

}else {

 $xmlAdd = $xmlRequest-createElement('add-customer');

 appendXmlNode($xmlAdd, 'customer-vault-id' ,411);

 $xmlSale-appendChild($xmlAdd);

}*/





// Set the Billing  Shipping from what was collected on initial shopping 
cart form

$xmlBillingAddress = $xmlRequest-createElement('billing');

appendXmlNode($xmlBillingAddress,'first-name', 
$_POST['billing-address-first-name']);

//-more


//billing-address-email

appendXmlNode($xmlBillingAddress,'country', 
$_POST['billing-address-country']);

appendXmlNode($xmlBillingAddress,'email', $_POST['billing-address-email']);

//more

$xmlSale-appendChild($xmlBillingAddress);





$xmlShippingAddress = $xmlRequest-createElement('shipping');

appendXmlNode($xmlShippingAddress,'first-name', 
$_POST['shipping-address-first-name']);

appendXmlNode($xmlShippingAddress,'last-name', 
$_POST['shipping-address-last-name']);

// more

appendXmlNode($xmlShippingAddress,'fax', $_POST['shipping-address-fax']);

$xmlSale-appendChild($xmlShippingAddress);


Re: [PHP] mysql_connect noob question

2013-04-19 Thread Glob Design Info

Nope, quotes are not visible in the output.

Both the HTML and the script it calls are shown below. They are in 2 
separate files. The variable names in both are user and password. 
The data comes through to the PHP script fine - if I print them I see 
exactly what I typed in the form, but when I pass them to my DB host on 
another server via mysql_connect it give me an error.



HTML:


!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

html xmlns=http://www.w3.org/1999/xhtml;

head

meta http-equiv=Content-Type content=text/html; charset=UTF-8 /

titleAdmin/title

style type=text/css

.desw { font-family: Arial, Helvetica, sans-serif; }

/style
/head
body

div align=center
  pnbsp;/p
  pimg src=../images/web_logo_admin.png alt=0 width=221 
height=134 border=0 //p


p class=deswnbsp;/p
  p class=deswstrongPlease log in./strong/p
  p class=deswnbsp;/p

   form id=form1 name=form1 action=../wservices/connect.php 
method=post

pUser: input type=text name=user id=user //p
pPassword: input type=password name=password id=password 
//p

pinput type=submit name=login id=login value=Login //p
  /form

  p class=deswnbsp;/p
  p class=deswnbsp;/p
/div
pnbsp;/p
pnbsp;/p
/body

/html



PHP:






?php

# Add redirect page for errors

header( Location: ../admin/login_error.html );

# Server info

$host = instance43490.db.xeround.com:8904;

# Get user  pass from input form

$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

echo pUser:  . $form_user . /p;
echo pPass:  . $form_pass . /p;

# Connect to remote DB

$WSDB_LINK = mysql_connect( $host, $form_user, $form_pass );
if( !$WSDB_LINK )
{
error_log( NeverStranded: cannot connect to the database. );
}
else
{
   ..
}

?

On 4/19/13 2:13 PM, Matijn Woudt wrote:

On Fri, Apr 19, 2013 at 10:59 PM, Glob Design Info i...@globdesign.comwrote:


Already did that. I printed the form values in the PHP script after they
are received and they print exactly as entered in the form. Even checked
for extra spaces.

Any functions I can pass the values to to remove the magic quotes?

Thanks,


You would see the quotes if they were there in the output. There's no
reason why it should not work this way, though I doubt it's safe to do. Can
you show us the rest of the code, including the HTML form?
And exactly what error are you getting? (eg. from mysql_error())




On 4/19/13 1:47 PM, Matijn Woudt wrote:


On Fri, Apr 19, 2013 at 10:43 PM, Glob Design Info i...@globdesign.com

wrote:

  I know this has probably been answered already.

When I pass a user name and password from a form to my PHP script and
then
pass those to mysql_connect it doesn't connect. When I paste those exact
same values into mysql_connect as string literals it works.

Can anyone tell me why this happens?

I know the strings are identical to the literals I try in a test but they
don't work when submitted via form.

$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

# Connect to remote DB

$LINK = mysql_connect( $host, $form_user, $form_pass );

And yes, my $host param is correct.

Thanks,


  Try printing the $form_user and form_pass values, it might be that it's

just an error elsewhere, maybe field name is different in the html?
Otherwise, it might be you have some php init setting, like magic quotes
that does something with the input data.

- Matijn





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



Re: [PHP] mysql_connect noob question

2013-04-19 Thread Glob Design Info

Sorry. The error displayed is:

*Warning*: mysql_connect() [function.mysql-connect 
http://localhost/wservices/function.mysql-connect]: Access denied for 
user 'user'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in 
*/Library/WebServer/Documents/wservices/connect.php* on line *29*


(But with the real user name, not just 'user')

Thanks,

On 4/19/13 3:28 PM, tamouse mailing lists wrote:

On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com wrote:

I know this has probably been answered already.

When I pass a user name and password from a form to my PHP script and then
pass those to mysql_connect it doesn't connect. When I paste those exact
same values into mysql_connect as string literals it works.

Can anyone tell me why this happens?

I know the strings are identical to the literals I try in a test but they
don't work when submitted via form.

$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

# Connect to remote DB

$LINK = mysql_connect( $host, $form_user, $form_pass );


Please show the error you are getting from the mysql_connect



And yes, my $host param is correct.

Thanks,

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







Re: [PHP] mysql_connect noob question

2013-04-19 Thread David Robley
Glob Design Info wrote:

 Sorry. The error displayed is:
 
 *Warning*: mysql_connect() [function.mysql-connect
 http://localhost/wservices/function.mysql-connect]: Access denied for
 user 'user'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in
 */Library/WebServer/Documents/wservices/connect.php* on line *29*
 
 (But with the real user name, not just 'user')
 
 Thanks,
 
 On 4/19/13 3:28 PM, tamouse mailing lists wrote:
 On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com
 wrote:
 I know this has probably been answered already.

 When I pass a user name and password from a form to my PHP script and
 then pass those to mysql_connect it doesn't connect. When I paste those
 exact same values into mysql_connect as string literals it works.

 Can anyone tell me why this happens?

 I know the strings are identical to the literals I try in a test but
 they don't work when submitted via form.

 $form_user = $_POST[ 'user' ];
 $form_pass = $_POST[ 'password' ];

 # Connect to remote DB

 $LINK = mysql_connect( $host, $form_user, $form_pass );

 Please show the error you are getting from the mysql_connect


 And yes, my $host param is correct.

 Thanks,

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



First guess is that you don't have privileges for 
'user'@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges for 
'user'.

And, what are you using for the $host value? If the script and mysql are on 
the same server, it shouldn't need to be anything other than 'localhost'.
-- 
Cheers
David Robley

A man's best friend is his dogma.

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



Re: [PHP] mysql_connect noob question

2013-04-19 Thread Glob Design Info
They aren't on the same server. The DB is on xeround.com, the web server 
is localhost.


The host value is set and working. If I hard-code the user and password 
values in the mysql_connect() call and leave the host value as is, it 
connects fine. Only passing the user and password from the form cause it 
to fail.



On 4/19/13 5:47 PM, David Robley wrote:

Glob Design Info wrote:


Sorry. The error displayed is:

*Warning*: mysql_connect() [function.mysql-connect
http://localhost/wservices/function.mysql-connect]: Access denied for
user 'user'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in
*/Library/WebServer/Documents/wservices/connect.php* on line *29*

(But with the real user name, not just 'user')

Thanks,

On 4/19/13 3:28 PM, tamouse mailing lists wrote:

On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com
wrote:

I know this has probably been answered already.

When I pass a user name and password from a form to my PHP script and
then pass those to mysql_connect it doesn't connect. When I paste those
exact same values into mysql_connect as string literals it works.

Can anyone tell me why this happens?

I know the strings are identical to the literals I try in a test but
they don't work when submitted via form.

$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

# Connect to remote DB

$LINK = mysql_connect( $host, $form_user, $form_pass );


Please show the error you are getting from the mysql_connect



And yes, my $host param is correct.

Thanks,

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





First guess is that you don't have privileges for
'user'@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges for
'user'.

And, what are you using for the $host value? If the script and mysql are on
the same server, it shouldn't need to be anything other than 'localhost'.



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



Re: [PHP] mysql_connect noob question

2013-04-19 Thread Jim Giner

On 4/19/2013 9:33 PM, Glob Design Info wrote:

They aren't on the same server. The DB is on xeround.com, the web server
is localhost.

The host value is set and working. If I hard-code the user and password
values in the mysql_connect() call and leave the host value as is, it
connects fine. Only passing the user and password from the form cause it
to fail.


On 4/19/13 5:47 PM, David Robley wrote:

Glob Design Info wrote:


Sorry. The error displayed is:

*Warning*: mysql_connect() [function.mysql-connect
http://localhost/wservices/function.mysql-connect]: Access denied for
user 'user'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in
*/Library/WebServer/Documents/wservices/connect.php* on line *29*

(But with the real user name, not just 'user')

Thanks,

On 4/19/13 3:28 PM, tamouse mailing lists wrote:

On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com
wrote:

I know this has probably been answered already.

When I pass a user name and password from a form to my PHP script and
then pass those to mysql_connect it doesn't connect. When I paste
those
exact same values into mysql_connect as string literals it works.

Can anyone tell me why this happens?

I know the strings are identical to the literals I try in a test but
they don't work when submitted via form.

$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

# Connect to remote DB

$LINK = mysql_connect( $host, $form_user, $form_pass );


Please show the error you are getting from the mysql_connect



And yes, my $host param is correct.

Thanks,

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





First guess is that you don't have privileges for
'user'@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges
for
'user'.

And, what are you using for the $host value? If the script and mysql
are on
the same server, it shouldn't need to be anything other than 'localhost'.

Do your user or password contain spaces, thereby requiring quotes in 
your call?


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



Re: [PHP] mysql_connect noob question

2013-04-19 Thread Glob Design Info
No, no spaces.

I am wondering if I need to use htmlspecialchars()

On Apr 19, 2013, at 7:17 PM, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 4/19/2013 9:33 PM, Glob Design Info wrote:
 They aren't on the same server. The DB is on xeround.com, the web server
 is localhost.
 
 The host value is set and working. If I hard-code the user and password
 values in the mysql_connect() call and leave the host value as is, it
 connects fine. Only passing the user and password from the form cause it
 to fail.
 
 
 On 4/19/13 5:47 PM, David Robley wrote:
 Glob Design Info wrote:
 
 Sorry. The error displayed is:
 
 *Warning*: mysql_connect() [function.mysql-connect
 http://localhost/wservices/function.mysql-connect]: Access denied for
 user 'user'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in
 */Library/WebServer/Documents/wservices/connect.php* on line *29*
 
 (But with the real user name, not just 'user')
 
 Thanks,
 
 On 4/19/13 3:28 PM, tamouse mailing lists wrote:
 On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com
 wrote:
 I know this has probably been answered already.
 
 When I pass a user name and password from a form to my PHP script and
 then pass those to mysql_connect it doesn't connect. When I paste
 those
 exact same values into mysql_connect as string literals it works.
 
 Can anyone tell me why this happens?
 
 I know the strings are identical to the literals I try in a test but
 they don't work when submitted via form.
 
 $form_user = $_POST[ 'user' ];
 $form_pass = $_POST[ 'password' ];
 
 # Connect to remote DB
 
 $LINK = mysql_connect( $host, $form_user, $form_pass );
 
 Please show the error you are getting from the mysql_connect
 
 
 And yes, my $host param is correct.
 
 Thanks,
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 First guess is that you don't have privileges for
 'user'@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges
 for
 'user'.
 
 And, what are you using for the $host value? If the script and mysql
 are on
 the same server, it shouldn't need to be anything other than 'localhost'.
 
 Do your user or password contain spaces, thereby requiring quotes in your 
 call?
 
 -- 
 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] mysql_connect noob question

2013-04-19 Thread Jim Giner

On 4/20/2013 12:23 AM, Glob Design Info wrote:

No, no spaces.

I am wondering if I need to use htmlspecialchars()

On Apr 19, 2013, at 7:17 PM, Jim Giner jim.gi...@albanyhandball.com wrote:


On 4/19/2013 9:33 PM, Glob Design Info wrote:

They aren't on the same server. The DB is on xeround.com, the web server
is localhost.

The host value is set and working. If I hard-code the user and password
values in the mysql_connect() call and leave the host value as is, it
connects fine. Only passing the user and password from the form cause it
to fail.


On 4/19/13 5:47 PM, David Robley wrote:

Glob Design Info wrote:


Sorry. The error displayed is:

*Warning*: mysql_connect() [function.mysql-connect
http://localhost/wservices/function.mysql-connect]: Access denied for
user 'user'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in
*/Library/WebServer/Documents/wservices/connect.php* on line *29*

(But with the real user name, not just 'user')

Thanks,

On 4/19/13 3:28 PM, tamouse mailing lists wrote:

On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com
wrote:

I know this has probably been answered already.

When I pass a user name and password from a form to my PHP script and
then pass those to mysql_connect it doesn't connect. When I paste
those
exact same values into mysql_connect as string literals it works.

Can anyone tell me why this happens?

I know the strings are identical to the literals I try in a test but
they don't work when submitted via form.

$form_user = $_POST[ 'user' ];
$form_pass = $_POST[ 'password' ];

# Connect to remote DB

$LINK = mysql_connect( $host, $form_user, $form_pass );


Please show the error you are getting from the mysql_connect



And yes, my $host param is correct.

Thanks,

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





First guess is that you don't have privileges for
'user'@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges
for
'user'.

And, what are you using for the $host value? If the script and mysql
are on
the same server, it shouldn't need to be anything other than 'localhost'.


Do your user or password contain spaces, thereby requiring quotes in your call?

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


Why does the error message refer to mysql-connect and not mysql_connect?

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



Re: [PHP] mysql_connect noob question

2013-04-19 Thread Glob Design Info
Dunno. The code definitely has the underscore.

On Apr 19, 2013, at 9:11 PM, Jim Giner jim.gi...@albanyhandball.com wrote:

 On 4/20/2013 12:23 AM, Glob Design Info wrote:
 No, no spaces.
 
 I am wondering if I need to use htmlspecialchars()
 
 On Apr 19, 2013, at 7:17 PM, Jim Giner jim.gi...@albanyhandball.com wrote:
 
 On 4/19/2013 9:33 PM, Glob Design Info wrote:
 They aren't on the same server. The DB is on xeround.com, the web server
 is localhost.
 
 The host value is set and working. If I hard-code the user and password
 values in the mysql_connect() call and leave the host value as is, it
 connects fine. Only passing the user and password from the form cause it
 to fail.
 
 
 On 4/19/13 5:47 PM, David Robley wrote:
 Glob Design Info wrote:
 
 Sorry. The error displayed is:
 
 *Warning*: mysql_connect() [function.mysql-connect
 http://localhost/wservices/function.mysql-connect]: Access denied for
 user 'user'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in
 */Library/WebServer/Documents/wservices/connect.php* on line *29*
 
 (But with the real user name, not just 'user')
 
 Thanks,
 
 On 4/19/13 3:28 PM, tamouse mailing lists wrote:
 On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info i...@globdesign.com
 wrote:
 I know this has probably been answered already.
 
 When I pass a user name and password from a form to my PHP script and
 then pass those to mysql_connect it doesn't connect. When I paste
 those
 exact same values into mysql_connect as string literals it works.
 
 Can anyone tell me why this happens?
 
 I know the strings are identical to the literals I try in a test but
 they don't work when submitted via form.
 
 $form_user = $_POST[ 'user' ];
 $form_pass = $_POST[ 'password' ];
 
 # Connect to remote DB
 
 $LINK = mysql_connect( $host, $form_user, $form_pass );
 
 Please show the error you are getting from the mysql_connect
 
 
 And yes, my $host param is correct.
 
 Thanks,
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 First guess is that you don't have privileges for
 'user'@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges
 for
 'user'.
 
 And, what are you using for the $host value? If the script and mysql
 are on
 the same server, it shouldn't need to be anything other than 'localhost'.
 
 Do your user or password contain spaces, thereby requiring quotes in your 
 call?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 Why does the error message refer to mysql-connect and not mysql_connect?
 
 -- 
 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