Page 1 of 2
AHH MY CODE IS MESSED UP HELP!
Posted: Wed Jun 04, 2003 5:53 pm
by I3lade
My code is:
Code: Select all
<?php
session_start();
if($logged==1){
?>
<?
mysql_connect("localhost","bladegames", "*****");
mysql_select_db("bladegames");
echo "<table>
<tr><td>Number</td><td>Username</td><td>Email</td></tr>
";
$query = mysql_query("SELECT * FROM members ORDER BY id");
while($row=mysql_fetch_array($query))
{
echo "<tr><td>$rowїid]</td><td>$row
<a href="lookup.php?id=<?=row->id>" target="right"> $row їlogin] </a></td><td>
$rowїemail] </td></tr>";
}else{
printf("Your not logged in, plz login again");
}
?>
Whats wrong? i keep getting erros please help!!!
Posted: Wed Jun 04, 2003 6:08 pm
by I3lade
Someone anyone?
Posted: Wed Jun 04, 2003 6:55 pm
by JPlush76
what errors are you getting?
is $logged supposed to be a session variable? if so it should be $_SESSION['logged']
Posted: Wed Jun 04, 2003 7:05 pm
by I3lade
Im getting some errors with the }else{ dont know why, it says prase error to
Posted: Thu Jun 05, 2003 2:55 am
by volka
I reformated your code a bit, so you'll the error more clearly
Code: Select all
<?php
session_start();
if($logged==1) {
mysql_connect("localhost","bladegames", "*****");
mysql_select_db("bladegames");
echo "---some output---";
$query = mysql_query("SELECT * FROM members ORDER BY id");
while($row=mysql_fetch_array($query))
{
echo "---some output---";
}else{
printf("Your not logged in, plz login again");
}
?>
Posted: Thu Jun 05, 2003 2:56 am
by r337ard
looks like your missing semicolon at the end of that statement in my amature opintion.
Code: Select all
}else{
printf("Your not logged in, plz login again");
};
?>
Posted: Thu Jun 05, 2003 2:58 am
by []InTeR[]
volka wrote:I reformated your code a bit, so you'll the error more clearly
Code: Select all
<?php
session_start();
if($logged==1) {
mysql_connect("localhost","bladegames", "*****");
mysql_select_db("bladegames");
echo "---some output---";
$query = mysql_query("SELECT * FROM members ORDER BY id");
while($row=mysql_fetch_array($query))
{
echo "---some output---";
}else{
printf("Your not logged in, plz login again");
}
?>
Hint mode: it's a }
Posted: Thu Jun 05, 2003 4:06 pm
by I3lade
So what do i add?
Posted: Thu Jun 05, 2003 4:10 pm
by Galahad
Come on. Look at the {}'s. Volka's indenting shows what matches up with what pretty well.
Posted: Thu Jun 05, 2003 4:14 pm
by JPlush76
use the force
Posted: Thu Jun 05, 2003 4:18 pm
by I3lade
Ok ill try, im really new to php like 1 week lol thats why im havin so much problems with simple code, so its going to be hard for me to see where the error is
+EIDIT+
Oh i think i see it, is it a { before echo?
Posted: Thu Jun 05, 2003 4:24 pm
by I3lade
Can someone help me out, which {} i cant tell im new to this
Posted: Thu Jun 05, 2003 4:25 pm
by delorian
Count { and then } you have one missing.
BTW: Like JPlush76 said "use the force"
OK, and I will give you the clue, the one that is missing fits perfect before "else" clause
Posted: Thu Jun 05, 2003 4:35 pm
by I3lade
I finnaly got it ! Thanks everyone for your help!
Posted: Thu Jun 05, 2003 4:41 pm
by JPlush76
you're welcome
I'm glad "the force" was able to help you