Click to See Complete Forum and Search --> : Where's the mistake?


Perfidus
11-25-2003, 09:17 AM
I get the following error message processing this page, but I can't see where's the mistake:
Parse error: parse error in /chs/p1/costa4seasons.com/home/html/renamesession.php on line 19

<?php
session_start();
$oldsession=session_id();
$link = mysql_connect('', '', '');
mysql_select_db("",$link);
$result = mysql_query("SELECT Inmo FROM Sesiones WHERE (Sesion='$oldsession')", $link);
while($row = mysql_fetch_array($result)) {
$Inmo=$row["Inmo"];
$rs = mysql_query($result,$link);
if (mysql_num_rows($rs)!=0){
}
session_regenerate_id();
$session=session_id();
$Fecha = date("Y-d-m h:i:s");
$sql = "INSERT INTO Sesiones ( Fecha, Inmo, Sesion)" .
"VALUES ('$Fecha', '$Inmo', '$session')";
$result2 = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');
header ("Location: panelcontrol.html");
}else { ///ERROR SUPOSED TO BE HERE!!!
header("Location: acceso6.html?errorusuario=si");
}
mysql_close($link);
?>

DaiWelsh
11-25-2003, 09:29 AM
if (mysql_num_rows($rs)!=0){
}


I suspect that close bracket is a rogue?

Perfidus
11-25-2003, 09:36 AM
Removing the bracket was quite a good idea, but now error have moved to line 21:

Parse error: parse error in /chs/p1/costa4seasons.com/home/html/renamesession.php on line 21
And is just the ?> tag of closing the code!

DaiWelsh
11-25-2003, 09:44 AM
It neeeded to be in there somewhere, just not where it was - you should know best where it belongs as I cannot tell from this sample what the code is intended to do.

Perfidus
11-25-2003, 11:52 AM
Should this close a session?
I have this to close a session in my web, but after this, when you are taken to acceso6.html it still recognise the session.
:(
<?php
session_start();
session_unset();
session_destroy();
header("Location: /acceso6.html");
?>

diamonds
11-25-2003, 05:55 PM
try indenting your code with tabs or even better 4 spaces--it makes it easer to find out where you are missing a bracket, if you are.

if you aren't, it just makes it easer to read.

unless the froum likes to eat those trailing spaces. are you indenting, or is the forum eating them?