SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: table

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Norway
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    table

    why won't my second table show?



    <?php


    $query = "SELECT * FROM $var1 where $var2 like '$var3'";

    $innhold = mysql_query($query) or die("SELECT query failed");


    echo "<table border=\"1\">";
    while($a_row = mysql_fetch_array($innhold))
    {
    echo "<tr>";
    echo "<td>". $a_row[$var4] ."</td>";
    echo "<td>". $a_row[$var2] ."</td>";
    echo "<td>". $a_row[$var5] ."</td>";
    echo "</tr>";
    }
    echo "</table>";

    $query2 = "SELECT * FROM $var6 where $var7 like 'var8'";

    $innhold2 = mysql_query($query2) or die("SELECT query failed");


    echo "<table border=\"1\">";
    while($b_row = mysql_fetch_array($innhold2))
    {
    echo "<tr>";
    echo "<td>". $b_row[$var9] ."</td>";
    echo "<td>". $b_row[$var7] ."</td>";
    echo "<td>". $b_row[$var10] ."</td>";
    echo "<td>". $b_row[$var11] ."</td>";
    echo "</tr>";
    }
    echo "</table>";
    ?>

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I'm assuming this line is the culprit
    PHP Code:
    $query2 "SELECT * FROM $var6 where $var7 like 'var8'";
    /* change to */
    $query2 "SELECT * FROM {$var6} where {$var7} like '{$var8}'"

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Norway
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No..it didn't help...

    I don't understand why my first table is shown in the browser,and the second not.

    They seem identic to me..

    Can there be other explainations?

  4. #4
    ********* Poet X Q mano's Avatar
    Join Date
    Oct 2002
    Location
    Still Thulcandra
    Posts
    997
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Honestly, I can also only see the missing $ in var8

    Cool to see another norwegian here btw...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •