Now i extract data from mysql database, and echo them in a table.
In the last column of each row, i made a link. It link to the corresponding page according to the value of first column in the row.
Now i can't get the solution and have some errors.
Here is my code:
<table id="t" border="1"> <tr> <th>SUJET</th> <th>DATE</th> <th>NATURE</th> <th>ACTION</th> <th>NON DE DECIDEUR</th> <th>DETAIL</th> </tr> <?php $conn = mysql_connect("localhost","root","") or die("Sorry, can't connect: ".mysql_error()); mysql_select_db($db); $query = "SELECT sujet, bdate, nature, adetail, decideur FROM besoin"; $result = mysql_query($query, $conn) or die("Sorry, don't get result for error: ".mysql_error()); while($row = mysql_fetch_assoc($result)){ echo "<tr><td>".$row["sujet"]."</td>"; echo "<td>".$row["bdate"]."</td>"; echo "<td>".$row["nature"]."</td>"; echo "<td>".$row["adetail"]."</td>"; echo "<td>".$row["decideur"]."</td>"; echo "<td><a href=\"$row[\"sujet\"].php\" alt='autosujet.php'>DETAIL</a></td>"; echo "</tr>"; } ?>Error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\CRM1.11\pages\pperso\bes\list.php on line 38
<table id="t" border="1">
<tr>
<th>SUJET</th>
<th>DATE</th>
<th>NATURE</th>
<th>ACTION</th>
<th>NON DE DECIDEUR</th>
<th>DETAIL</th>
</tr>
<?php
$conn = mysql_connect("localhost","root","") or die("Sorry, can't connect: ".mysql_error());
mysql_select_db($db);
$query = "SELECT sujet, bdate, nature, adetail, decideur FROM besoin";
$result = mysql_query($query, $conn) or die("Sorry, don't get result for error: ".mysql_error());
while($row = mysql_fetch_assoc($result)){
echo '<tr><td>'.$row["sujet"].'</td>';
echo '<td>'.$row["bdate"].'</td>';
echo '<td>'.$row["nature"].'</td>';
echo '<td>'.$row["adetail"].'</td>';
echo '<td>'.$row["decideur"].'</td>';
echo '<td><a href="'.$row['sujet'].'".php" alt="autosujet.php">DETAIL</a></td>';
echo '</tr>';
}
?>