RE: [PHP] MS SQL / PHP
Got it! The rs objects need to be written as follows: to give the following code: $list2 = $conn->Execute("SELECT * FROM elive.registration") or DIE($conn->ErrorMsg()); while (!$list2->EOF){ $Msku = $list2->Fields("sku"); $Mname = $list2->Fields("name"); $Memailaddress = $list2->Fields("emailadd"); $Mcountry = $list2->Fields("country"); $Mnumdevices = $list2->Fields("numdevices"); $Msource = $list2->Fields("source"); print ("" . $list2->Fields["sku"]->value . "" . $list2->Fields["name"]->value . "" . $list2->Fields["emailadd"]->value . "" . $list2->Fields["country"]->value . "" . $list2->Fields["numdevices"]->value . "" . $list2->Fields["source"]->value . ""); $list2->MoveNext(); } -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: 27 January 2004 14:34 To: Enda Nagle Cc: PHP List Subject: Re: [PHP] MS SQL / PHP You need to find out what $list2->Fields("sku"); returns. This is not php anymore, check COM reference. Enda Nagle wrote: > Hi Marek, > > Thanks for your reply. > > Tried that and got the following output: > COM Object ( [0] => Resource id #3 ) COM Object ( [0] => Resource id #9 ) > COM Object ( [0] => Resource id #15 ) COM Object ( [0] => Resource id #21 ) > > There are 4 records in the table at the moment, and its performing the loop > etc for the recordset but just isn't returning the data (or returning data > in a readable format). > > Thanks > > Enda > -- > > > > -Original Message- > From: Marek Kilimajer [mailto:[EMAIL PROTECTED] > Sent: 27 January 2004 14:05 > To: Enda Nagle > Cc: PHP List > Subject: Re: [PHP] MS SQL / PHP > > > try print_r($Msku) and see what comes out > > Enda Nagle wrote: > > >>I have a potentially stupid problem with PHP and MSSQL on a Windows >>server... >> >>I can connect to the database and insert data to the tables etc but cannot >>retrieve data... >> >>This is the code I'm using: >> >>//--- >>$list2 = $conn->Execute("SELECT * FROM elive.registration") or >>DIE($conn->ErrorMsg()); >> >>while (!$list2->EOF){ >> >> $Msku = $list2->Fields("sku"); >> $Mname = $list2->Fields("name"); >> $Memailaddress = $list2->Fields("emailadd"); >> $Mcountry = $list2->Fields("country"); >> $Mnumdevices = $list2->Fields("numdevices"); >> $Msource = $list2->Fields("source"); >> >>echo >> > > "$Msku$Mname$Memailaddress$Mcountry< > >>td>$Mnumdevices$Msource"; >> $list2->MoveNext(); >>} >>//--- >> >>The returned info is: >> >> Object Object Object Object Object Object >> >>Am I doing something stupid? >> >>Presumably, the code is the same as I am already using on an adodb >>connection on a Linux box to a MySQL server? >> >>Thanks for the help >> >>Enda >>Enda Nagle >>+353 86 168 0774 >>[EMAIL PROTECTED] >>www.nightsol.net >> > > > -- > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS SQL / PHP
You need to find out what $list2->Fields("sku"); returns. This is not php anymore, check COM reference. Enda Nagle wrote: Hi Marek, Thanks for your reply. Tried that and got the following output: COM Object ( [0] => Resource id #3 ) COM Object ( [0] => Resource id #9 ) COM Object ( [0] => Resource id #15 ) COM Object ( [0] => Resource id #21 ) There are 4 records in the table at the moment, and its performing the loop etc for the recordset but just isn't returning the data (or returning data in a readable format). Thanks Enda -- -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: 27 January 2004 14:05 To: Enda Nagle Cc: PHP List Subject: Re: [PHP] MS SQL / PHP try print_r($Msku) and see what comes out Enda Nagle wrote: I have a potentially stupid problem with PHP and MSSQL on a Windows server... I can connect to the database and insert data to the tables etc but cannot retrieve data... This is the code I'm using: //--- $list2 = $conn->Execute("SELECT * FROM elive.registration") or DIE($conn->ErrorMsg()); while (!$list2->EOF){ $Msku = $list2->Fields("sku"); $Mname = $list2->Fields("name"); $Memailaddress = $list2->Fields("emailadd"); $Mcountry = $list2->Fields("country"); $Mnumdevices = $list2->Fields("numdevices"); $Msource = $list2->Fields("source"); echo "$Msku$Mname$Memailaddress$Mcountry< td>$Mnumdevices$Msource"; $list2->MoveNext(); } //--- The returned info is: Object Object Object Object Object Object Am I doing something stupid? Presumably, the code is the same as I am already using on an adodb connection on a Linux box to a MySQL server? Thanks for the help Enda Enda Nagle +353 86 168 0774 [EMAIL PROTECTED] www.nightsol.net -- 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] MS SQL / PHP
Hi Marek, Thanks for your reply. Tried that and got the following output: COM Object ( [0] => Resource id #3 ) COM Object ( [0] => Resource id #9 ) COM Object ( [0] => Resource id #15 ) COM Object ( [0] => Resource id #21 ) There are 4 records in the table at the moment, and its performing the loop etc for the recordset but just isn't returning the data (or returning data in a readable format). Thanks Enda -- -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: 27 January 2004 14:05 To: Enda Nagle Cc: PHP List Subject: Re: [PHP] MS SQL / PHP try print_r($Msku) and see what comes out Enda Nagle wrote: > I have a potentially stupid problem with PHP and MSSQL on a Windows > server... > > I can connect to the database and insert data to the tables etc but cannot > retrieve data... > > This is the code I'm using: > > //--- > $list2 = $conn->Execute("SELECT * FROM elive.registration") or > DIE($conn->ErrorMsg()); > > while (!$list2->EOF){ > > $Msku = $list2->Fields("sku"); > $Mname = $list2->Fields("name"); > $Memailaddress = $list2->Fields("emailadd"); > $Mcountry = $list2->Fields("country"); > $Mnumdevices = $list2->Fields("numdevices"); > $Msource = $list2->Fields("source"); > > echo > "$Msku$Mname$Memailaddress$Mcountry< > td>$Mnumdevices$Msource"; > $list2->MoveNext(); > } > //--- > > The returned info is: > > Object Object Object Object Object Object > > Am I doing something stupid? > > Presumably, the code is the same as I am already using on an adodb > connection on a Linux box to a MySQL server? > > Thanks for the help > > Enda > Enda Nagle > +353 86 168 0774 > [EMAIL PROTECTED] > www.nightsol.net > -- 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] MS SQL / PHP
try print_r($Msku) and see what comes out Enda Nagle wrote: I have a potentially stupid problem with PHP and MSSQL on a Windows server... I can connect to the database and insert data to the tables etc but cannot retrieve data... This is the code I'm using: //--- $list2 = $conn->Execute("SELECT * FROM elive.registration") or DIE($conn->ErrorMsg()); while (!$list2->EOF){ $Msku = $list2->Fields("sku"); $Mname = $list2->Fields("name"); $Memailaddress = $list2->Fields("emailadd"); $Mcountry = $list2->Fields("country"); $Mnumdevices = $list2->Fields("numdevices"); $Msource = $list2->Fields("source"); echo "$Msku$Mname$Memailaddress$Mcountry< td>$Mnumdevices$Msource"; $list2->MoveNext(); } //--- The returned info is: Object Object Object Object Object Object Am I doing something stupid? Presumably, the code is the same as I am already using on an adodb connection on a Linux box to a MySQL server? Thanks for the help Enda Enda Nagle +353 86 168 0774 [EMAIL PROTECTED] www.nightsol.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php