Posted by bokke on 10/26/06 15:19
Hi,
I have a page with a link
<a href="Contributor.php?action=&SubCat=<?php echo $row["writer"];
?>"><?php echo $row["writer"];?></a>
that does to a page with a SELECT
$query = "SELECT * FROM news WHERE writer='$SubCat' ";
But it is not pulling any data from the database. If I do this
$query = "SELECT * FROM news WHERE writer='Bob Smith' ";
works great??
also
the ULR reads -
Contributor.php?action=&SubCat=Bob%20Smith
so I know the link is correct ....
but for the life of me I can't figure out whats wrong with the SELECT
statement?
If anyone can help me with this I would be forever in your Debt.
Thanks
here is the complete Contributor.php script.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!--
#BeginTemplate "/Templates/journ.dwt" -->
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1" />
<!-- #BeginEditable "doctitle" -->
<title>paper</title>
<!-- #EndEditable -->
<link rel="stylesheet" href="Styles/template.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="logo"><img src="Images/logo.jpg" border="0"
alt="logo"></div>
<div id=bar><form action="a.php" method="POST">
<label for="searchtxt">Search our archives:</label>
<input id="searchtxt" type="text" name="searchtxt" value="" />
<input class="button" type="submit" value="Search" /></form>
</div>
<div id="header">
<!-- #BeginEditable "Adds" --><div id="athlete"><img
src="../Images/Athlete.gif" border="0" alt="AthleteMonth">
<img src="../Images/AthleteMonth.jpg" border="0"
alt="AthleteMonth"><br>
Susan smith</div>
<br>
<? include("Ads.php") ?><!-- #EndEditable -->
</div>
<div id="sidebar">
<div id=writer>Your News</div>
<div id="navcontainer">
<ul id="navlist">
<table>
<?
$query = "SELECT DISTINCT cat FROM news";
$result = mysql_query($query)
or die ("no can do.");
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td>
<li><a href="../<?php echo $row["cat"];?>"><?php echo
$row["cat"];?></a></li>
</td>
</tr>
<?php
}
?>
</table>
------------------------
<li><a href="Classified.php">Classified Ads</a></li>
<li><a href="Advertise.php">Advertise With Us</a></li>
<li><a href="About.php">About Us</a></li>
<li><a href="FindUs.php">Contact Us</a></li>
</ul>
</div>
<div id=writer>Visit our Sponsor</div>
<!-- #BeginEditable "Left" -->{Left}<!-- #EndEditable -->
</div>
<!-- #BeginEditable "middle" -->
<!--
-----------------------------------------NEWS-------------------------------------------------------------
-->
<div id="content">
<div id="bodymenu">News</div>
<table>
<?
$query = "SELECT * FROM news WHERE writer='$SubCat' ";
$result = mysql_query($query)
or die ("no can do.");
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td>
<div id="bodyhead"><?php echo $row["heading"];?></div>
</td>
<td>
Issue: <a href="#"><?php echo $row["date"];?></a>
</td>
</tr>
<tr>
</tr>
<tr>
<td colspan=2>
<div id=bodywords>
<?php
$abc = ($row["article"]);
$abc=substr($abc,0,400);
echo $abc;
?>
......<span class="class1"><a href="#">Read the article</a></span>
</div>
</td>
</tr>
<?php
}
?>
</table>
</div>
<!-- #EndEditable --> </div>
</body>
<!-- #EndTemplate --></html>
Navigation:
[Reply to this message]
|