Table_gnews|
+-------------------+
| gnewsid=>int |
| gnewsh=>varchar |
| gnewsd=>varchar |
Data:
gnewsh:test
gnewsd:leadstart.in/blog
PHP code below
<?php
$hostname = "localhost";
$username = "gb";
$password = "123";
$dbname = "test_database";
$limitStart = $_POST['limitStart'];
$limitCount = 100;
if(isset($limitStart ) || !empty($limitStart)) {
$con = mysqli_connect($hostname, $username, $password, $dbname);
$query = "SELECT * FROM gnews ORDER BY gnewsid limit $limitStart, $limitCount";
$result = mysqli_query($con, $query);
$res = array();
while($result1 = mysqli_fetch_assoc($result)) {
$res[$result1['gnewsid']] ='<h3>' . <a href="$result1["gnewsd"]" target="_blank">"$result1["gnewsh"]"</a> . '</h3>';
}
echo json_encode($res);
}
?>
What I want: When I click "test" it will open "leadstart.in/blog" in a separate tab. I tried in this way: But no result
$res[$result1['gnewsid']] ='<h3>' . <a href="$result1["gnewsd"]" target="_blank">"$result1["gnewsh"]"</a> . '</h3>';
Where is the fault? Any Help
' . "$result1["gnewsh"]" . '
'; would you try that? – Özgür Can Karagöz Dec 07 '17 at 12:11'.$result1['gnewsh'].'
';` – Nawin Dec 07 '17 at 12:15' . '"$result1["gnewsh"]"' . '
';` – xander Dec 07 '17 at 12:15