kusal Posted July 13, 2006 Share Posted July 13, 2006 <?phpsession_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<?phpsession_start();$one=$_SESSION['0'];echo "$one";?>Notice: Undefined offset: 0 in c:\Inetpub\wwwroot\test\dynamic2.php on line 4what is the problem here? Quote Link to comment https://forums.phpfreaks.com/topic/14448-session/ Share on other sites More sharing options...
tomfmason Posted July 13, 2006 Share Posted July 13, 2006 What exactly is this supposed to do. Can you explain what you are wanting to accomplish. Quote Link to comment https://forums.phpfreaks.com/topic/14448-session/#findComment-57133 Share on other sites More sharing options...
kusal Posted July 13, 2006 Author Share Posted July 13, 2006 print attribute names one by one Quote Link to comment https://forums.phpfreaks.com/topic/14448-session/#findComment-57135 Share on other sites More sharing options...
kenrbnsn Posted July 13, 2006 Share Posted July 13, 2006 The array index '0' is different from the array index 0. Remove the single quotes from the line [code]<?php $one=$_SESSION['0']; ?>[/code]. Also, why are you buffering your output when you're not doing any output?Ken Quote Link to comment https://forums.phpfreaks.com/topic/14448-session/#findComment-57262 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.