view raw
Silversprint Silversprint - 1 year ago 54
SQL Question

Display data from mysql table inside a <span>

I am trying to display data from a mysql table inside a which is inside a but i get a syntax error in the echos where i start to display the $data and i can't really understand why , here's the code :

while ($data = mysql_fetch_array($req)) {
echo'<div class="row">';
echo'<input type="radio" name="expand">';
echo '<span class="cell primary" data-label="Date">'$data['date']'</span>';
echo'<span class="cell" data-label="Titre"> <a href="read_msg.php?id_msg_usr='$data['id_msg_usr']'"> </span>';
echo'<span class="cell" data-label="Fromm">'stripslashes(htmlentities(trim($data['fromm'])))'</span>';

Thanks for your help


You forgot to put dots in so many places...

Try this:

while ($data = mysql_fetch_array($req)) {
    echo '<div class="row">';
    echo '<input type="radio" name="expand">';
    echo '<span class="cell primary" data-label="Date">'.$data['date'].'</span>';
    echo '<span class="cell" data-label="Titre"> <a href="read_msg.php?id_msg_usr='.$data['id_msg_usr'].'"> </span>';
    echo '<span class="cell" data-label="Fromm">'.stripslashes(htmlentities(trim($data['fromm']))).'</span>';