Jump to content

session


kusal

Recommended Posts

<?php
session_start();
ob_start(); //Turn on output buffering
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="root123"; // Mysql password
$db_name="test"; // Database name

$tbl=$_POST['rating'];

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="describe $tbl";
$result=mysql_query($sql);

$count=mysql_num_rows($result);


global $x;

for($x=0; $x<$count; $x++){         
$newArray = mysql_fetch_array($result);
$aa=$newArray['Field'];

$_SESSION[$x]=$aa;
}



?>
<a href="dynamic2.php">dynamic2</a>



//dynamic2.php

<?php

session_start();
$one=$_SESSION['0'];

echo "$one";

?>


Notice: Undefined offset: 0 in c:\Inetpub\wwwroot\test\dynamic2.php on line 4



what is the problem here?
Link to comment
https://forums.phpfreaks.com/topic/14448-session/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.