I use PHP 7.2.1 and I have a problem. I have to print a field of a database with a variable in a link. The database field is of type VARCHAR. I've already written a script but it only works with INT fields. What changes should I make?
<?php
if ($id_comune == 0) {
}
else {
$query4 = mysqli_query($link,"SELECT trebmeteo FROM comuni WHERE ID_comune = $id_comune");
$trebmeteo = mysqli_fetch_assoc($query4);
$riga = "https://www.3bmeteo.com/meteo/";
$riga .= $trebmeteo ["trebmeteo"];
echo "<a id='wdgt_5afc6fd60569824e2c8b4569' href='{'$riga'}'></a> ";
}
echo "<script type='text/javascript'>
var wid='5afc6fd60569824e2c8b4569';
(function() {
var wdgt = document.createElement('script'); wdgt.type = 'text/javascript'; wdgt.async = true;
wdgt.src = '//widget.3bmeteo.com/widget.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wdgt, s);
})();
</script>";
?>