Hi everyone, i have been working on this for hours but i can't solve the problem myself. Hope someone can help me out.
So i have a main page with has a search function
as you can see, every result has link rs.php?id=$id specific to its id. Until now it's fine.
Then i create the rs.php
When I click on the link of a result, no error found but the title doesn't appear. Ive been looking on this for hours, I found a same question on this website which was posted since 2007. Except the main page, our rs.php pages are exactly the same so i don't know mine doesn't work. Hope someone can help me out. Thank you...
So i have a main page with has a search function
Code:
<?php
$search = $_GET['search'];
$terms = explode(" ", $search);
$query = "SELECT * FROM search WHERE ";
foreach ($terms as $each){
$i++;
if ($i == 1)
$query .= "keywords LIKE '%$each%' ";
else
$query .= "OR keywords LIKE '%$each%' ";
}
$db = mysql_connect("a", "a", "a");
mysql_select_db("a");
mysql_query("SET NAMES UTF8", $db);
$query = mysql_query($query);
$numrows = mysql_num_rows($query);
if ($numrows > 0) {
while ($row = mysql_fetch_array($query)) {
$id = $row['id'];
$title = $row['title'];
$description = $row['description'];
$keywords = $row['keywords'];
$link = $row['link'];
echo "<div id='kq' ><a href='http://bytes.com/a/rs.php?id=$id'>$title</a></div></br >";
}
}
else
echo "<div id='kq1'> '$search'</div>";
mysql_close ();
?>
Then i create the rs.php
Code:
<?php
$newid = (int) $_GET['id'];
$servername = "a";
$username = "a";
$password = "a";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysql_select_db("a", $db);
$newid = (int) $_GET['id'];
$result = mysql_query("SELECT * FROM 'search' WHERE id = 1", $db) ;
$myrow = mysql_fetch_array($result);
echo $myrow["title"];
mysql_close();
?> <html> <head> <meta charset='utf-8'> <title>dd</title> </head> <body> <?php echo $myrow['title']; ?> </body> </html>
Comment