PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
I3lade
Forum Commoner
Posts: 70 Joined: Wed Jun 04, 2003 4:20 pm
Post
by I3lade » Wed Jun 04, 2003 5:53 pm
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!!!
I3lade
Forum Commoner
Posts: 70 Joined: Wed Jun 04, 2003 4:20 pm
Post
by I3lade » Wed Jun 04, 2003 6:08 pm
Someone anyone?
JPlush76
Forum Regular
Posts: 819 Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:
Post
by JPlush76 » Wed Jun 04, 2003 6:55 pm
what errors are you getting?
is $logged supposed to be a session variable? if so it should be $_SESSION['logged']
I3lade
Forum Commoner
Posts: 70 Joined: Wed Jun 04, 2003 4:20 pm
Post
by I3lade » Wed Jun 04, 2003 7:05 pm
Im getting some errors with the }else{ dont know why, it says prase error to
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Thu Jun 05, 2003 2:55 am
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");
}
?>
Last edited by
volka on Thu Jun 05, 2003 2:56 am, edited 1 time in total.
r337ard
Forum Commoner
Posts: 29 Joined: Tue Apr 15, 2003 6:14 am
Contact:
Post
by r337ard » Thu Jun 05, 2003 2:56 am
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");
};
?>
[]InTeR[]
Forum Regular
Posts: 416 Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands
Post
by []InTeR[] » Thu Jun 05, 2003 2:58 am
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 }
I3lade
Forum Commoner
Posts: 70 Joined: Wed Jun 04, 2003 4:20 pm
Post
by I3lade » Thu Jun 05, 2003 4:06 pm
So what do i add?
Galahad
Forum Contributor
Posts: 111 Joined: Fri Jun 14, 2002 5:50 pm
Post
by Galahad » Thu Jun 05, 2003 4:10 pm
Come on. Look at the {}'s. Volka's indenting shows what matches up with what pretty well.
JPlush76
Forum Regular
Posts: 819 Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:
Post
by JPlush76 » Thu Jun 05, 2003 4:14 pm
use the force
I3lade
Forum Commoner
Posts: 70 Joined: Wed Jun 04, 2003 4:20 pm
Post
by I3lade » Thu Jun 05, 2003 4:18 pm
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?
I3lade
Forum Commoner
Posts: 70 Joined: Wed Jun 04, 2003 4:20 pm
Post
by I3lade » Thu Jun 05, 2003 4:24 pm
Can someone help me out, which {} i cant tell im new to this
delorian
Forum Contributor
Posts: 223 Joined: Sun May 04, 2003 5:20 pm
Location: Olsztyn, Poland
Post
by delorian » Thu Jun 05, 2003 4:25 pm
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
I3lade
Forum Commoner
Posts: 70 Joined: Wed Jun 04, 2003 4:20 pm
Post
by I3lade » Thu Jun 05, 2003 4:35 pm
I finnaly got it ! Thanks everyone for your help!
JPlush76
Forum Regular
Posts: 819 Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:
Post
by JPlush76 » Thu Jun 05, 2003 4:41 pm
you're welcome
I'm glad "the force" was able to help you