[Solved (keyword issue)] passing parameters via URL
Posted: Tue Nov 20, 2007 8:47 pm
Hi there,
I have a UDT as below
===
$topic = $params['topic'];
$link = mysql_connect('mylocalhost', 'myUser', 'mypass');
mysql_select_db('mt_articlesdb');
if ($topic == "" OR $topic == "Home"){
$result=mysql_query('SELECT * FROM articles ORDER BY ID DESC LIMIT 20', $link);
}else{
$result = mysql_query('SELECT * FROM articles WHERE section = \''.$topic.'\' ORDER BY ID DESC LIMIT 20');
}
echo "";
// Get an array containing the results.
// Loop for each item in that array
while ($row = mysql_fetch_array($result)){
echo "";
echo "".$row['section'].": ";
echo "".stripslashes($row['title'])." ";
echo "Posted by ".$row['postedby']." on ".$row['posteddate']."";
echo "".stripslashes($row['tagline'])."...";
echo "Read Complete Article";
echo "";
echo "";
}
echo "";
===
Trying to create a list of articles that the user clicks on to read the full article.
The problem is that I can not access the id in a UDT in the readarticle page. In fact if the id param is included the UDT in the readarticle page does not run at all. It will not echo 1. But if I remove id from the above href it does echo 1.
readarticle UDT
===
echo '1';
$link = mysql_connect('mylocalhost', 'myuser', 'mypass');
mysql_select_db('mt_articlesdb');
$articleID = $HTTP_GET_VARS['id'];
echo '$articleID '.$articleID;
$result = $connector->query('SELECT * FROM articles WHERE ID='.$articleID);
$row = mysql_fetch_array($result);
echo "";
echo "";
echo "".stripslashes($row['title'])." ";
echo "Posted by ".$row['postedby']." on ".$row['posteddate']."";
echo ''.stripslashes($row['thearticle']);
echo "";
echo "";
===
The readarticle is displayed but the UDT not actioned.
What am I missing here?
Cheers
Tom
I have a UDT as below
===
$topic = $params['topic'];
$link = mysql_connect('mylocalhost', 'myUser', 'mypass');
mysql_select_db('mt_articlesdb');
if ($topic == "" OR $topic == "Home"){
$result=mysql_query('SELECT * FROM articles ORDER BY ID DESC LIMIT 20', $link);
}else{
$result = mysql_query('SELECT * FROM articles WHERE section = \''.$topic.'\' ORDER BY ID DESC LIMIT 20');
}
echo "";
// Get an array containing the results.
// Loop for each item in that array
while ($row = mysql_fetch_array($result)){
echo "";
echo "".$row['section'].": ";
echo "".stripslashes($row['title'])." ";
echo "Posted by ".$row['postedby']." on ".$row['posteddate']."";
echo "".stripslashes($row['tagline'])."...";
echo "Read Complete Article";
echo "";
echo "";
}
echo "";
===
Trying to create a list of articles that the user clicks on to read the full article.
The problem is that I can not access the id in a UDT in the readarticle page. In fact if the id param is included the UDT in the readarticle page does not run at all. It will not echo 1. But if I remove id from the above href it does echo 1.
readarticle UDT
===
echo '1';
$link = mysql_connect('mylocalhost', 'myuser', 'mypass');
mysql_select_db('mt_articlesdb');
$articleID = $HTTP_GET_VARS['id'];
echo '$articleID '.$articleID;
$result = $connector->query('SELECT * FROM articles WHERE ID='.$articleID);
$row = mysql_fetch_array($result);
echo "";
echo "";
echo "".stripslashes($row['title'])." ";
echo "Posted by ".$row['postedby']." on ".$row['posteddate']."";
echo ''.stripslashes($row['thearticle']);
echo "";
echo "";
===
The readarticle is displayed but the UDT not actioned.
What am I missing here?
Cheers
Tom