Re: mssql_fetch_array problem
| From: | Angie Tollerson | Date: | Wed, 20 Jun 2001 14:12:19 +0000 |
| Subject: | Re: mssql_fetch_array problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9664@lists.php.net to get a copy of this message | ||
Jennifer,
Try this code..I am using the same stuff as you with the exception of mysql instead of sql..but it
may still work:
<?
$country_sql = "select countryname co_name_val, countryid co_id_val from TBL_COUNTRY";
if ($country_query = mssql_query($country_sql)) {
while ($myrow = mssql_fetch_array($country_query)) {
$countryid = $myrow["co_id_val"];
$countryname = $myrow["co_name_val"];
print "countryid is " . $countryid . " ,countryname is " .
$countryname . "<br>";
}
}
?>
It's kind of a "save as" type of statment but it works for me! I've had no
problems with that sql statement.
Angie
>>> "Jennifer Arcino Demeterio" <eper@tridel.net> 06/20/01 12:17AM
>>> >>>
Thanks for all your answers, but, they still seem not to work. In my query,
the value of countryname is retrieved as expected but the value of countryid
is not. There seems to be no value retrieved for countryid. I am using
PHP4 on IIS4 on an NT machine with SQL Server 7 as the database.
"countryname" is of type varchar while "countryid" is type int, indentity,
auto_increment. I tried listing them by printing the resultset but
countryid still does not have any value. This could be a quirk that some of
you experienced and I sure would like to hear how you overcame this.
Thanks.
I am posting again the code snippet below:
<?
$country_sql = "select countryname, countryid from TBL_COUNTRY";
if ($country_query = mssql_query($country_sql)) {
while ($myrow = mssql_fetch_array($country_query)) {
$countryid = $myrow["countryid"];
$countryname = $myrow["countryname"];
print "countryid is " . $countryid . " ,countryname is " .
$countryname . "<br>";
}
}
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net