can anyone tell me what is this script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kujtim
Forum Commoner
Posts: 35
Joined: Sat Oct 25, 2003 4:00 am
Location: kosovo
Contact:

can anyone tell me what is this script

Post by kujtim »

can anyone tell me what is this script doing on general....

Code: Select all

<?php
$result = mysql_query("SELECT * FROM menu_main WHERE menu_lang='$HTTP_SESSION_VARS[language_id]'") or show_site_error('Error on main menu '.mysql_error());

if(mysql_num_rows($result)>0){
	
	echo"<table cellpadding=2 cellspacing=0 border=0   class=menuMainTable><tr>";
	
	$i=0;
	while ($row = mysql_fetch_array($result)) {

	$link 	= $PHP_SELF."?menu_id=".$row['menu_id'];

	/* selects clicked menu */
	if ($HTTP_SESSION_VARS[menu_id] == $row['menu_id'])
		$class="menuMainLinkCurrent & menuMainTdCurrent";
	
	/* selects first link in main menu if language is changed */
	else if($HTTP_GET_VARS[language_id] && $i==0){
		$HTTP_SESSION_VARS[menu_id]	 = $row['menu_id'];
		$class="menuMainLinkCurrent & menuMainTdCurrent";
	}
	else
		$class="menuMainLink";
	

	echo"<td  align=center valign=middle class='$class' nowrap >
			<a href='$link' title="".text_from_sql($row[menu_desc])."">
				<span class='$class'> ".text_from_sql($row[menu_name])." </span>
			</a></td>";
	echo"<td class=menuMainLink width=1>|</td>";
	
	$i++;
	}
	
		echo"<td width=100%>&nbsp;</td>";
		echo"</tr></table>";
}
?>
User avatar
Derfel Cadarn
Forum Contributor
Posts: 193
Joined: Thu Jul 17, 2003 12:02 pm
Location: Berlin, Germany

Re: can anyone tell me what is this script

Post by Derfel Cadarn »

kujtim wrote:can anyone tell me what is this script doing on general....
Well, in GENERAL: not much, since it uses deprecated variable-names like $HTTP_SESSION_VARS[language_id], you should use $_SESSION[] instead.

The goal of the script you gave was:
1. read all data from a MySQL-table 'menu_main';
2. show all data in a HTML-table, with the data from the row 'menu-name' are shown as a link (referring to the data in row 'menu_desc'. The rest is shown using different kinds of mark-up (CSS-Classes are used).

Is that enough? :lol:
kujtim
Forum Commoner
Posts: 35
Joined: Sat Oct 25, 2003 4:00 am
Location: kosovo
Contact:

$HTTP_SESSION_VARS

Post by kujtim »

halo
i am a new in php and i dont now why is this script:$HTTP_SESSION_VARS wroted what is this script doing ......


please ...
User avatar
Derfel Cadarn
Forum Contributor
Posts: 193
Joined: Thu Jul 17, 2003 12:02 pm
Location: Berlin, Germany

Post by Derfel Cadarn »

I'm sorry, but I don't understand your last question. Have you read the manual at php.net and especially about reserved variables?
Post Reply