Page 1 of 1

mssql - php issues

Posted: Tue Feb 08, 2005 8:29 am
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

Posted: Tue Feb 08, 2005 8:36 am
by feyd
this code performs no query.

Posted: Tue Feb 08, 2005 10:19 am
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

Posted: Tue Feb 08, 2005 10:22 am
by feyd
that's not performing a query. Just a query string.

Posted: Tue Feb 08, 2005 10:31 am
by wisebot_rank
ok, can you please correct me where i went wrong?

Posted: Tue Feb 08, 2005 10:34 am
by feyd