Jæja hérna er kóðinn:session_start();
if(!session_is_registered(“color”)) {
$query = “SELECT * FROM color”;
$result = mysql_query($query) or die(mysql_error());
$getrowcount = mysql_num_rows($result);
$random = (rand()%$getrowcount + 1);
$query = “SELECT * FROM color WHERE colorID = $random”;
$litur = mysql_query($query) or die(mysql_error());
while ($stada = mysql_fetch_array($litur)) {
extract($stada);
session_register(“color”,“html”);
}
}
else {
}
echo $_SESSION['color'];
Vandamálið er þetta:
Fyrst þegar síðan er keyrð þá skilar echo $_SESSION['color']; engu, en þegar ég refresh-a þá kemur rétt gildi. Hefur einhver hugmynd hvernig ég get fengið rétt gildi strax?
kv.
<br><br><font face=“Arial” size=“2”><font color=“#808080”>Valur </font><font color=“#FF0000”> | </font><font color=“#808080”></font><a href=“mailto:valur@hamstur.is”><font color=“#808080”>valur@hamstur.is</font></a><font color=“#808080”></font><font color=“#FF0000”> | </font><font color=“#808080”></font><a href="http://www.hugi.is/forsida/bigboxes.php?box_type=userinfo&user=valligu&syna=msg“><font color=”#808080">Sendu mér skilaboð</font></a></font