Pulling data and printing it in an HTML table

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-03-18T04:02:06Z Indexed on 2010/03/18 4:11 UTC
Read the original article Hit count: 406

Filed under:
|

Hello,

From a MySQL table called "submission" containing the fields "loginid, submissionid, title, url, datesubmitted, displayurl", I would like to print an HTML table thats contains all "title" and corresponding "datesubmitted" where "loginid" equals "$profile." The code I am trying to use is below. It isn't working. Any ideas why it isn't working?

Thanks in advance,

John

  $profile = $_GET['profile'];






$sqlStr = "SELECT loginid, submissionid, title, url, datesubmitted, displayurl
             FROM submission
            WHERE loginid = $profile
         ORDER BY datesubmitted DESC";


$result = mysql_query($sqlStr);

$arr = array(); 
echo "<table class=\"samplesrec\">";
while ($row = mysql_fetch_array($result)) { 
    echo '<tr>';
    echo '<td class="sitename1"><a href="http://www.'.$row["url"].'">'.$row["title"].'</a></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="sitename2">'.$row["datesubmitted"].'</a></td>';
    echo '</tr>';
    }
echo "</table>";

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php