mssql - php issues

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
wisebot_rank
Forum Newbie
Posts: 3
Joined: Tue Feb 08, 2005 8:25 am

mssql - php issues

Post by wisebot_rank »

Hi, can anynoe give me an idea what I am doing wrong here?

Code: Select all

$conn=odbc_connect('keyhole_db','sa','glm101');
$sql=("SELECT * FROM tblTestProductsCategory where macrocategory like 'Men'  and dept like 'Shoes'"); 
$columns = 3;
// check the number of rows
$num_rows = mssql_num_rows($rs);
echo "<tr><TD vAlign=top align=middle height=225>
<TABLE cellSpacing=0 cellPadding=0 width=193 border=0>";
// change this to a for loop so we can use the number of rows
for ($i = 0; $i < $num_rows; $i++) &#123;
$row = mssql_fetch_array($sql);
if($i % $columns == 0) &#123;
//if there is no remainder, we want to start a new row
echo "<tr>\n";
&#125;
echo "<td>" . $row&#1111;'Name'] . "</td>\n";
if(($i % $columns) == ($columns - 1) || ($i + 1) ==               
$num_rows) &#123;
//if there is a remainder of 1, end row or if there is nothing left in our result set, end the row
echo "</tr>\n";
&#125;
&#125;
echo "</table>";
i am not getting any values returned...


feyd | please use the formatting tags we provide
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

this code performs no query.
wisebot_rank
Forum Newbie
Posts: 3
Joined: Tue Feb 08, 2005 8:25 am

Post by wisebot_rank »

the query is
$sql=("SELECT * FROM tblTestProductsCategory where macrocategory like 'Men' and dept like 'Shoes'");

pls advise on if i am making a msitake, remember I am using a Windows box and using mssql and not mysql
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's not performing a query. Just a query string.
wisebot_rank
Forum Newbie
Posts: 3
Joined: Tue Feb 08, 2005 8:25 am

Post by wisebot_rank »

ok, can you please correct me where i went wrong?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply