Jump to content

PHP ['uid'] Errors


Waleed Baig

Recommended Posts

Hey there,I am new to PHP scripting,I was following a Youtube PHP News system tutorial,But then In codes me and others are having errors i.e Undifined index:uid.

The code is:

<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("news_system");


?>

<html>
<head>
<title>News System</title>
<link href='Stylesheet1.css' type='text/css' rel='stylesheet'
</head>
<body>
<center>
<table> 
	<tr>
	<td id='body'>
	<h1>New System</h1>	
	<td id='nav'>
	<?php
	if(!$_SESSION['uid'])
	{
	?> <a href="?page=login">Login</a>

	<?php}

	else
	{
	?> <a href="?page=logout">Logout</a>
	<?php
	}
	?>
	</td>
	</td>
	</tr>	
</table>
</center>
</body>
</html>

If any body like to help,We would be glad for that help

Link to comment
Share on other sites

ur $_SESSION['uid'] doesn't isset , u should check it

<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("news_system");
        if (!isset($_SESSION['uid'])) $_SESSION['uid'] = null;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.