Problems with my script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

HaVoC
New php-forum User
New php-forum User
Posts: 35
Joined: Thu Nov 27, 2003 6:22 am
Contact:

Problems with my script

Postby HaVoC » Mon Dec 01, 2003 1:45 pm

Code: Select all

<?php
require("connect.php");
$sql = mysql_query("SELECT * FROM members WHERE rank='$rank'")
$row = mysql_fetch_array($sql)
if ($rank == 1) {
echo "Leaders";
print $row['name'];
?>



Error on line 4...I've been stuck on this for about 1 day. Someone please help me!

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Mon Dec 01, 2003 2:43 pm

You're missing the semicolon at the end of this line:

Code: Select all

$row = mysql_fetch_array($sql)


And for future reference, next time tell us what error you're getting, as "I'm getting errors" isn't very informative.

User avatar
Skeletor
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio
Contact:

Postby Skeletor » Mon Dec 01, 2003 3:35 pm

Also make sure you close your {} after your if statement. I imagine you have additional code below what you posted, but that may lead to errors like the one you received.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest