Hello Pullo,
sorry for my late post, but this few days was very busy for me and i didn`t had time to work anymore on my personal project.
Anyway, I made significant progress, after i rent some PHP books from the library , but i got stuck in one point.
At this moment i made some changes to the script, to have the possibility to make dynamic links from the name of the mobile phones.
Here is my code:
<?php
$con=mysqli_connect("localhost","root","","");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM mobile_phones ");
echo "<table id='tablesorter-demo' class='tablesorter' border='0' cellpadding='0' cellspacing='1'>
<thead>
<tr>
<th>Id</th>
<th>Price</th>
<th>Phone name</th>
</tr>
</thead>";
while($row = mysqli_fetch_array($result))
{
$name = $row['name'];
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['price'] . "</td>";
echo "<td><a href='content.php?id=" . $row['id'] . "'>$name </a></td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
On content.php … i have a GET variable " $id = $_GET[‘id’]; " and after this i build the page with different kind of variables.
And now is coming the part where i got stuck. If a select a checkbox, will start function your filter script, what i love the most by the way
But here i don`t know how to include the <a href=“#”> in the table, to make the links to function normally.
Here is the part of your code:
function makeTable(data){
var tbl_body = "";
$.each(data, function() {
var tbl_row = "";
$.each(this, function(k , v) {
tbl_row += "<td>"+v+"</td>";
})
tbl_body += "<tr>"+tbl_row+"</tr>";
})
return tbl_body;
}
And this is what i try:
function makeTable(data){
var tbl_body = "";
$.each(data, function() {
var tbl_row = "";
$.each(this, function(k , v) {
tbl_row += "<td><a href='content.php?id=<?php echo $row['id']; ?>'>"+v+"</td></a>";
})
tbl_body += "<tr>"+tbl_row+"</tr>";
})
return tbl_body;
}
But in this way all my links have /content.php?id=1 instead of id=1…id=2…etc