Getting Post Tile For SQL
-
I am trying to echo some data from a separate DB I have by using the title of the posts and can not figure it out, unless I manually put the post title in the code below. (I mainly need help with the [id=’….’] and if I put <?php the_title(); ?> in the id= I get an error)
<?php $t_title = $_GET[‘the_title()’]; ?>
<?php
$con = mysql_connect(“localhost”,”********”,”********”);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
mysql_select_db(“********”, $con);
$result = mysql_query(“SELECT * FROM products WHERE id=’$t_title'”);
echo “<table border=’1′>
<tr>
<th>F</th>
<th>L</th>
</tr>”;
while($row = mysql_fetch_array($result))
{
echo “<tr>”;
echo “<td>” . $row[‘size’] . “</td>”;
echo “<td>” . $row[‘description’] . “</td>”;
echo “</tr>”;
}
echo “</table>”;
mysql_close($con);
?>
- The topic ‘Getting Post Tile For SQL’ is closed to new replies.