RE: [PHP-DB] mssql_fetch_array not working?
well spotted :) --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- > -Original Message- > From: Terry Romine [mailto:[EMAIL PROTECTED]] > Sent: 13 May 2002 22:41 > To: Gurhan Ozen > Cc: Benjamin Walling; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] mssql_fetch_array not working? > > > Do I see a semicolon at the end of the while? that won't work... > > On Monday, May 13, 2002, at 04:35 PM, Gurhan Ozen wrote: > > > while ($row = mssql_fetch_array($rs)) _;_ > > > should be > while ($row = mssql_fetch_array($rs)) > { > ... > } > > Terry Romine > Web Developer > JumpInteractive.com > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mssql_fetch_array not working?
Whoop I did a copy and paste and didn't notice it.. Thanks Terry, and that should solve the problem.. I haven't even noticed that.. Benjamin try it without the semicolon ... Gurhan -Original Message- From: Terry Romine [mailto:[EMAIL PROTECTED]] Sent: Monday, May 13, 2002 5:41 PM To: Gurhan Ozen Cc: Benjamin Walling; [EMAIL PROTECTED] Subject: Re: [PHP-DB] mssql_fetch_array not working? Do I see a semicolon at the end of the while? that won't work... On Monday, May 13, 2002, at 04:35 PM, Gurhan Ozen wrote: > while ($row = mssql_fetch_array($rs)) _;_ > should be while ($row = mssql_fetch_array($rs)) { ... } Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_fetch_array not working?
I thought about that while I was copying the code from the tutorial. I know a little C++, and it seemed wrong, but I let it go. Thanks. "Terry Romine" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Do I see a semicolon at the end of the while? that won't work... > > On Monday, May 13, 2002, at 04:35 PM, Gurhan Ozen wrote: > > > while ($row = mssql_fetch_array($rs)) _;_ > > > should be > while ($row = mssql_fetch_array($rs)) > { > ... > } > > Terry Romine > Web Developer > JumpInteractive.com > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_fetch_array not working?
It's the ';' at the end of the while statement. It runs the loop with no statements in it, then executes the code in brackets. I copied some bum code from a tutorial... "Peter Lovatt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi > > The code looks OK > > Try something like > > while ($row = mssql_fetch_array($rs)); > { >echo "another row"; >echo $row["ItemClassKey"]; >echo ""; > } > } > > to see if it is looping thro the results, if so then the array > $row["ItemClassKey"] is empty - check the obvious - index case and that > there is data in the field in the record. > > If it is not looping thro then could the if($rs) be moving the pointer to > the end of he result set, so there is nothing left to loop thro? > > hth > > Peter > > --- > Excellence in internet and open source software > --- > Sunmaia > www.sunmaia.net > [EMAIL PROTECTED] > tel. 0121-242-1473 > ----------- > > > -Original Message- > > From: Benjamin Walling [mailto:[EMAIL PROTECTED]] > > Sent: 13 May 2002 22:16 > > To: [EMAIL PROTECTED] > > Subject: [PHP-DB] mssql_fetch_array not working? > > > > > > I apologize if the answer to this is incredibly simple. I'm > > trying to learn > > PHP, and evaluate whether to change our site away from ASP. > > > > I have the following php code, and I can't get any results. > > > > I have add the line echo mssql_num_rows($rs); to see how many rows are > > returned, and I get 11 (there are 11 rows in this table). > > > > The page outputs only "11Done". Why am I not getting any thing into > > $row? Why do I only get 1 (I would expect 11)? > > > > --Begin Code > > > > $db = mssql_connect("domino","uid","pwd"); > > if ($db) > > { > > $dbs = mssql_select_db("acuity_edd_app",$db) > > or die("Couldn't set DB"); > > $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID"; > > $rs = mssql_query($sql); > > echo mssql_num_rows($rs); > > if ($rs) > > { > > while ($row = mssql_fetch_array($rs)); > > { > >echo $row["ItemClassKey"]; > >echo ""; > > } > > }else{ > > echo "No results\n"; > > } > > echo "Done\n"; > > }else{ > > echo "Unable to connect to database.\n"; > > } > > > > --End Code > > > > > > > > > > -- > > 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] mssql_fetch_array not working?
Are you sure??? Did you make sure that the ItemClassKey field is not empty? Gurhan -Original Message- From: Benjamin Walling [mailto:[EMAIL PROTECTED]] Sent: Monday, May 13, 2002 5:38 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] mssql_fetch_array not working? I still get the same response. "Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi ... > Get rid of the if($rs) block... > Just do: > > while ($row = mssql_fetch_array($rs)); > { >echo $row["ItemClassKey"]; >echo ""; > } > > Gurhan > > -Original Message- > From: Benjamin Walling [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 13, 2002 5:16 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] mssql_fetch_array not working? > > > I apologize if the answer to this is incredibly simple. I'm trying to learn > PHP, and evaluate whether to change our site away from ASP. > > I have the following php code, and I can't get any results. > > I have add the line echo mssql_num_rows($rs); to see how many rows are > returned, and I get 11 (there are 11 rows in this table). > > The page outputs only "11Done". Why am I not getting any thing into > $row? Why do I only get 1 (I would expect 11)? > > --Begin Code > > $db = mssql_connect("domino","uid","pwd"); > if ($db) > { > $dbs = mssql_select_db("acuity_edd_app",$db) > or die("Couldn't set DB"); > $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID"; > $rs = mssql_query($sql); > echo mssql_num_rows($rs); > if ($rs) > { > while ($row = mssql_fetch_array($rs)); > { >echo $row["ItemClassKey"]; >echo ""; > } > }else{ > echo "No results\n"; > } > echo "Done\n"; > }else{ > echo "Unable to connect to database.\n"; > } > > --End Code > > > > > -- > 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] mssql_fetch_array not working?
Do I see a semicolon at the end of the while? that won't work... On Monday, May 13, 2002, at 04:35 PM, Gurhan Ozen wrote: > while ($row = mssql_fetch_array($rs)) _;_ > should be while ($row = mssql_fetch_array($rs)) { ... } Terry Romine Web Developer JumpInteractive.com
RE: [PHP-DB] mssql_fetch_array not working?
hi The code looks OK Try something like while ($row = mssql_fetch_array($rs)); { echo "another row"; echo $row["ItemClassKey"]; echo ""; } } to see if it is looping thro the results, if so then the array $row["ItemClassKey"] is empty - check the obvious - index case and that there is data in the field in the record. If it is not looping thro then could the if($rs) be moving the pointer to the end of he result set, so there is nothing left to loop thro? hth Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- > -Original Message- > From: Benjamin Walling [mailto:[EMAIL PROTECTED]] > Sent: 13 May 2002 22:16 > To: [EMAIL PROTECTED] > Subject: [PHP-DB] mssql_fetch_array not working? > > > I apologize if the answer to this is incredibly simple. I'm > trying to learn > PHP, and evaluate whether to change our site away from ASP. > > I have the following php code, and I can't get any results. > > I have add the line echo mssql_num_rows($rs); to see how many rows are > returned, and I get 11 (there are 11 rows in this table). > > The page outputs only "11Done". Why am I not getting any thing into > $row? Why do I only get 1 (I would expect 11)? > > --Begin Code > > $db = mssql_connect("domino","uid","pwd"); > if ($db) > { > $dbs = mssql_select_db("acuity_edd_app",$db) > or die("Couldn't set DB"); > $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID"; > $rs = mssql_query($sql); > echo mssql_num_rows($rs); > if ($rs) > { > while ($row = mssql_fetch_array($rs)); > { >echo $row["ItemClassKey"]; >echo ""; > } > }else{ > echo "No results\n"; > } > echo "Done\n"; > }else{ > echo "Unable to connect to database.\n"; > } > > --End Code > > > > > -- > 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] mssql_fetch_array not working?
I still get the same response. "Gurhan Ozen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi ... > Get rid of the if($rs) block... > Just do: > > while ($row = mssql_fetch_array($rs)); > { >echo $row["ItemClassKey"]; >echo ""; > } > > Gurhan > > -Original Message- > From: Benjamin Walling [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 13, 2002 5:16 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] mssql_fetch_array not working? > > > I apologize if the answer to this is incredibly simple. I'm trying to learn > PHP, and evaluate whether to change our site away from ASP. > > I have the following php code, and I can't get any results. > > I have add the line echo mssql_num_rows($rs); to see how many rows are > returned, and I get 11 (there are 11 rows in this table). > > The page outputs only "11Done". Why am I not getting any thing into > $row? Why do I only get 1 (I would expect 11)? > > --Begin Code > > $db = mssql_connect("domino","uid","pwd"); > if ($db) > { > $dbs = mssql_select_db("acuity_edd_app",$db) > or die("Couldn't set DB"); > $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID"; > $rs = mssql_query($sql); > echo mssql_num_rows($rs); > if ($rs) > { > while ($row = mssql_fetch_array($rs)); > { >echo $row["ItemClassKey"]; >echo ""; > } > }else{ > echo "No results\n"; > } > echo "Done\n"; > }else{ > echo "Unable to connect to database.\n"; > } > > --End Code > > > > > -- > 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] mssql_fetch_array not working?
Hi ... Get rid of the if($rs) block... Just do: while ($row = mssql_fetch_array($rs)); { echo $row["ItemClassKey"]; echo ""; } Gurhan -Original Message- From: Benjamin Walling [mailto:[EMAIL PROTECTED]] Sent: Monday, May 13, 2002 5:16 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] mssql_fetch_array not working? I apologize if the answer to this is incredibly simple. I'm trying to learn PHP, and evaluate whether to change our site away from ASP. I have the following php code, and I can't get any results. I have add the line echo mssql_num_rows($rs); to see how many rows are returned, and I get 11 (there are 11 rows in this table). The page outputs only "11Done". Why am I not getting any thing into $row? Why do I only get 1 (I would expect 11)? --Begin Code $db = mssql_connect("domino","uid","pwd"); if ($db) { $dbs = mssql_select_db("acuity_edd_app",$db) or die("Couldn't set DB"); $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID"; $rs = mssql_query($sql); echo mssql_num_rows($rs); if ($rs) { while ($row = mssql_fetch_array($rs)); { echo $row["ItemClassKey"]; echo ""; } }else{ echo "No results\n"; } echo "Done\n"; }else{ echo "Unable to connect to database.\n"; } --End Code -- 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-DB] mssql_fetch_array not working?
I apologize if the answer to this is incredibly simple. I'm trying to learn PHP, and evaluate whether to change our site away from ASP. I have the following php code, and I can't get any results. I have add the line echo mssql_num_rows($rs); to see how many rows are returned, and I get 11 (there are 11 rows in this table). The page outputs only "11Done". Why am I not getting any thing into $row? Why do I only get 1 (I would expect 11)? --Begin Code $db = mssql_connect("domino","uid","pwd"); if ($db) { $dbs = mssql_select_db("acuity_edd_app",$db) or die("Couldn't set DB"); $sql = "SELECT * FROM timItemClass ORDER BY ItemClassID"; $rs = mssql_query($sql); echo mssql_num_rows($rs); if ($rs) { while ($row = mssql_fetch_array($rs)); { echo $row["ItemClassKey"]; echo ""; } }else{ echo "No results\n"; } echo "Done\n"; }else{ echo "Unable to connect to database.\n"; } --End Code -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php