-1
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

Eddie
  • 26,593
  • 6
  • 36
  • 58

1 Answers1

0

Try like this:

$res[$result1['gnewsid']] ='<h3> <a href="'.$result1['gnewsd'].'" target="_tab">'.$result1['gnewsh'].'</a></h3>';
Himanshu Upadhyay
  • 6,558
  • 1
  • 20
  • 33