未定义的索引年份|未定义的变量年份 [英] Undefined index year | undefined variable year

查看:97
本文介绍了未定义的索引年份|未定义的变量年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我不断得到这么多错误,说明未定义的变量和索引在我已经初始化的地方。我不知道错误在哪里说的是真正的错误。



我尝试过:



<?php $ actual_link = basename($ _ SERVER ['PHP_SELF']);?> 
<?php
if(isset($ _ GET ['id']))
{
$ oinkid =oink =。$ _ GET ['id'];
}
其他
{
$ oinkid =;
}
?>
< style>
#oink:悬停{
背景:无;
}

#oink1 {
background:none;
border:0px;
颜色:白色;
}
< / style>
< div class =header_btm1>
< div class =wrap>
< div class =header_sub1>
< div class =h_menu1>
< ul style =display:block>
< li>< a id =oink1>图表:< / a>< / li>
< li
<?php
$ theyear = $ _GET ['year'];
echo $ theyear;

if( $ typetype ==hits)
{
echo'class =active' ;
}
?>
>< a href =analytics.php?type = hits& year =<?php echo $ theyear。$ hello;?>> Hits< / a>< / li>
< li
<?php
if( $ typetype ==dl)
{
echo'class =活性';
}
?>
>< a href =analytics.php?type = dl& year =<?php echo $ theyear。$ hello;?>> Downloads< / a>< / li>
< li
<?php
if($ typetype ==read)
{
echo'class =active';
}
?>
>< a href =analytics.php?type = read& year =<?php echo $ theyear。$ hello;?>> Read< / a>< / li>
< / ul>
< ul style =display:block>
< li>< a id =oink1>年:< / a>< / li>
<?php
// $ query = mysql_query(SELECT DISTINCT YEAR(treg)as $ theyear FROM count ORDER BY treg);
$ query = mysql_query(SELECT DISTINCT YEAR(treg)FROM count);
if(mysql_num_rows($ query)> 0){
while($ row = mysql_fetch_assoc($ query))
{
$ myyear = $ row ['YEAR(treg) )'];
echo< li;
if($ theyear == $ myyear)
{
echoclass ='active';
}
< pre>

echo> $ myyear ;



}

}

?>

< br $>


解决方案

actual_link = basename(

_SERVER [ 'PHP_SELF']);?>
<?php
if(isset(


_GET ['id']))
{


Hello i keeps getting this lots of error saying undefined variable and indexes where in i already been initialized it. i don't know where the error been said is the real error or not.

What I have tried:

<?php $actual_link = basename($_SERVER['PHP_SELF']);?>
<?php
if(isset($_GET['id']))
	{
	$oinkid = "oink=".$_GET['id'];
	}
else
	{
	$oinkid = "";
	}
?>
<style>
#oink:hover{
background: none;
}

#oink1{
background: none;
border: 0px;
color: white;
}
</style>
<div class="header_btm1">
<div class="wrap">
	<div class="header_sub1">
		<div class="h_menu1">
			<ul style="display: block">
				<li><a id="oink1">Chart: </a></li>
				<li 
				<?php
				$theyear = $_GET['year'];
				echo $theyear;
				if($typetype == "hits")
					{
				echo 'class="active"';
					}
				?>
				><a href="analytics.php?type=hits&year=<?php echo $theyear.$hello; ?>">Hits</a></li>
				<li
				<?php
				if($typetype == "dl")
					{
				echo 'class="active"';
					}
				?>
				><a href="analytics.php?type=dl&year=<?php echo $theyear.$hello; ?>">Downloads</a></li>
				<li
				<?php
				if($typetype == "read")
					{
				echo 'class="active"';
					}
				?>
				><a href="analytics.php?type=read&year=<?php echo $theyear.$hello; ?>">Read</a></li>
				</ul>
				<ul style="display: block">
				<li><a id="oink1">Years: </a></li>
				<?php
					//$query = mysql_query("SELECT DISTINCT YEAR(treg) as $theyear FROM count ORDER BY treg");
					$query = mysql_query("SELECT DISTINCT YEAR(treg) FROM count");
					if (mysql_num_rows($query) > 0) {
						while($row = mysql_fetch_assoc($query))
						{
							$myyear = $row['YEAR(treg)'];
							echo "<li";
							if($theyear == $myyear)
								{
									echo " class='active'";
								}
					<pre>

echo">$myyear";

}
}
?>


解决方案

actual_link = basename(


_SERVER['PHP_SELF']);?> <?php if(isset(


_GET['id'])) {


这篇关于未定义的索引年份|未定义的变量年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆