[Solved (keyword issue)] passing parameters via URL

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
bob38

[Solved (keyword issue)] passing parameters via URL

Post by bob38 »

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
Last edited by bob38 on Tue Nov 20, 2007 9:17 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: passing parameters via URL

Post by calguy1000 »

don't use 'id' as a parameter..... it's reserved.  Use 'articleid', 'junk', or some other word.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
bob38

Re: passing parameters via URL

Post by bob38 »

U da MAN.

Thanking you. Only spent three hours on that little sucker.

Is there a list of key words you can point me to?

Cheers
Bob
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: passing parameters via URL

Post by calguy1000 »

well, there aren't too many

but here's a brief list:
  id
  returnid
  page
  mact

Also, you should use adodb for your database stuff, not mysql_connect, it's much easier and there won't be a problem with having to re-connect the adodb object.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “CMSMS Core”