Jump to content

[SOLVED] Unsure


FirePhoenix

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.