Display data from mysql that has specified string
Posted: 23 May 2019, 13:32
I have a simple script to show the visited url
but from my sql table I would like to display only the 'tag=variables', not id= or other query_strings.
Is their some possibility to get only the tag= variables?
Here under are some examples from the query_string
but i would like not to have id= or others like name= but only the tag=
but from my sql table I would like to display only the 'tag=variables', not id= or other query_strings.
Is their some possibility to get only the tag= variables?
Code: Select all
<?php
// connect to the "tests" database
$conn = new mysqli('127.0.0.1', 'tracker', '123456', 'tracker');
// check connection
if (mysqli_connect_errno()) {
exit('Connect failed: '. mysqli_connect_error());
}
$today = date('Y-n-j');
// SELECT sql query
$sql = "SELECT * FROM `visitor_tracker` WHERE date='$today' and not query_string='' ORDER BY `visitor_tracker`.`id` DESC limit 15";
// perform the query and store the result
$result = $conn->query($sql);
// if the $result contains at least one row
if ($result->num_rows > 0) {
// output data of each row from $result
while($row = $result->fetch_assoc()) {
echo '<tr><td> <a href="http://145.53.93.209/'. $row['web_page']. '?'. $row['query_string']. '" title="" class="postlink" target="_top">'. $row['query_string']. '</a> </td><br> ' ;
}
}
else {
echo '0 results';
}
$conn->close();
?>
but i would like not to have id= or others like name= but only the tag=
Code: Select all
tag=nature
id=628
tag=politiek
name=Guest&album=Beatrix-Blik-Collectie
name=Guest&album=Beatrix-Blik-Collectie
id=628
id=628
tag=AEX