Jump to content

Recommended Posts

Looks like HTML problem. But can not put this question in HTML section cause it has PHP code.

 

I have table. I have 3 rows. 1 of rows has rowspan with 2 other rows.Problem is when database is empty program should take one picture and put inside 2 cells of table. First picture sits inside td normally but second picture not fitting into td and gows out of <tr>. Do not know what to do.

 

echo "<tr>

  <td rowspan='2' width='1000' height='600'>

    <div id='fadeshow1'></div>

  </td>

 

  <td valign='top' height='300' background='tilbud.jpg'>";

    if(!mysql_num_rows($result)){

      echo "<img src='note.jpg'>";

    }else{

    echo "<table border='1' width='120' style='table-layout:fixed' cellspacing='0'>

     

      <tr><td colspan='2'><center><b>Ukens tilbud</b></center><br></td></tr>";

      while($row = mysql_fetch_array($result)){

        echo "<tr><td>";

        $product = $row["Product"];

        $price = $row["Price"];

        echo "$product";

     

        echo "</td>";

   

        echo "<td>" . "$price" . "</td></tr>";

      }

    }

   

    echo "</table></td></tr>";

 

 

   

$query = "SELECT Product, Price FROM tilbud WHERE Period='Daglig'";

$result = mysql_query($query,$link_id) or die (mysql_error());   

   

 

echo "<tr background='tilbud.jpg'>

      <td valign='top' height='300' width=120 background='tilbud2.jpg'>";

      if(!mysql_num_rows($result)){

      echo "<img src='note.jpg' width='120'>";

      }else{

        echo "<table border='1' width='120' style='table-layout:fixed' cellspacing='0'>

                <col width=110>

                <tr><td colspan=2><center><b>Dagens tilbud</b></center><br></td></tr>";

                while($row = mysql_fetch_array($result)){

                  echo "<tr><td  width='110'>"; 

                  $product = $row["Product"];

                  $price = $row["Price"];

                  echo "$product"; 

                  echo "</td>";

   

                  echo "<td>" . "$price" . "</td></tr>";

                }

              echo "</table>";

      }

   

echo "</td></tr>

Link to comment
https://forums.phpfreaks.com/topic/236418-second-picture-goes-out-of/
Share on other sites

I have already found my own mistake.  Closing </table> tag is not in correct place :-)

 

echo "<tr>";

      if(!mysql_num_rows($result)){

        echo "<td valign='top' width='150' height='300' bgcolor='white' cellpadding='0'>";

        echo "<img src='note.jpg'>";

      }else{

        echo "<td valign='top' width='150' height='300' background='tilbud2.jpg' cellpadding='0'>

              <table border='0' width='150' style='table-layout:fixed' cellspacing='0'>

                <col width='120'>

                <col width='30'>

                <tr><td colspan=2><center><b>Dagens tilbud</b></center><br></td></tr>";

                while($row = mysql_fetch_array($result)){

                  echo "<tr><td>"; 

                  $product = $row["Product"];

                  $price = $row["Price"];

                  echo "$product"; 

                  echo "</td>";

   

                  echo "<td>" . "$price" . "</td></tr>";

                }

              echo "</table>";

      }

   

echo "</td></tr>

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.