FirePhoenix Posted February 26, 2007 Share Posted February 26, 2007 Something is wrong but I cant find it can some one help... <font color="#C0C0C0">SDTV Lineup</font><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <?php mysql_connect($dbhost,$dbuser,$dbpass) or die("Unable to connect"); @mysql_select_db($dbname) or die ("Unable to select database"); $query="SELECT * FROM $tbl_packages"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $name=mysql_result($result,$i,"name"); $page=mysql_result($result,$i,"page"); $short=mysql_result($result,$i,"short"); $price=mysql_result($result,$i,"price"); mysql_close(mysql_connect($dbhost,$dbuser,$dbpass)); ?> <tr> <td width="50%" bgcolor="#9DB2E7"><font color="#FFFFFF"><? echo $name; ?></font></td> <td width="50%" bgcolor="#9DB2E7"> <p align="right"><font color="#FFFFFF">Monthly Price:<? echo $price; ?></font></td> </tr> <tr> <td width="50%"><font color="#C0C0C0"><? echo $short; ?></font></td> <td width="50%"> <p align="right"><font color="#C0C0C0"><a href="<? echo $page; ?>">View More...</a></font></td> </tr> <? $i++; } ?> </table> it wont create the table or anything no out put at all I have never done this before please help Quote Link to comment Share on other sites More sharing options...
fenway Posted February 26, 2007 Share Posted February 26, 2007 That's not the desired way to iterate though the result set... mysql_fetch_assoc() keeps an internal pointer to the next record. Quote Link to comment Share on other sites More sharing options...
mjlogan Posted February 26, 2007 Share Posted February 26, 2007 That's not the desired way to iterate though the result set... mysql_fetch_assoc() keeps an internal pointer to the next record. or there is: $query = mysql_query("INSERT QUERY HERE"); if (mysql_num_rows($query) > 0) { while($data = mysql_fetch_array($query)){ ... DO STUFF HERE } } change part of your script $result=mysql_query($query) or die(mysql_error()); your query doesn't look right. Quote Link to comment Share on other sites More sharing options...
FirePhoenix Posted February 26, 2007 Author Share Posted February 26, 2007 Thanks guys it seems to be working better Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.