Author Topic: [SOLVED] Else Help  (Read 1099 times)

0 Members and 1 Guest are viewing this topic.

Offline hunna03Topic starter

  • Enthusiast
  • Posts: 302
    • View Profile
Re: Else Help
« Reply #15 on: September 08, 2007, 07:58:30 PM »
I will but it's not solved. He said he was going to look at the code a little bit more.

 ;)

Offline darkfreaks

  • Fanatic
  • Posts: 4,306
  • Gender: Male
    • View Profile
    • Site Security
Re: Else Help
« Reply #16 on: September 08, 2007, 08:01:28 PM »
oh and about the else thing you say it gives you "unexpected end", thats because you need an extra curly close bracket at the end so its like


Code: [Select]
<?php if ($url) { ?>



///html

<?php }else{ more code }; ?>

Offline hunna03Topic starter

  • Enthusiast
  • Posts: 302
    • View Profile
Re: Else Help
« Reply #17 on: September 08, 2007, 08:09:08 PM »
I do.

My Code is:

<?
$db=mysql_connect ("localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("anderse_inventory");

$rn=("SELECT Status FROM users WHERE
username='" . $_SESSION['username']."'");

$rz=mysql_query($rn);

while($row=mysql_fetch_array($rz))
{
if($row["Status"]=="0"){
echo;("The Administrator has not yet approved your account. You will be notified when this occurs");
}else{
?>

HTML HERE

<?
}
?>

And I am still getting that error

Offline hunna03Topic starter

  • Enthusiast
  • Posts: 302
    • View Profile
Re: Else Help
« Reply #18 on: September 08, 2007, 08:10:14 PM »
By the way, how do you get that pretty code box?

Offline darkfreaks

  • Fanatic
  • Posts: 4,306
  • Gender: Male
    • View Profile
    • Site Security
Re: Else Help
« Reply #19 on: September 08, 2007, 08:11:07 PM »
make sute your <? syntax has php after the ? then highlight the code and hit the code button

Offline darkfreaks

  • Fanatic
  • Posts: 4,306
  • Gender: Male
    • View Profile
    • Site Security
Re: Else Help
« Reply #20 on: September 08, 2007, 08:12:49 PM »
Code: [Select]
<?php
$db
=mysql_connect ("localhost""""") or die ('I cannot connect to the database because: ' mysql_error());
mysql_select_db ("anderse_inventory");

$rn=("SELECT Status FROM users WHERE
username='" 
$_SESSION['username']."'");

$rz=mysql_query($rn);

while(
$row=mysql_fetch_array($rz))
{
if(
$row["Status"]=="0"){
echo;(
"The Administrator has not yet approved your account. You will be notified when this occurs");
}else{
?>


HTML HERE

<?php
}} ///keepadding curly close until it goes away
?>

Offline hunna03Topic starter

  • Enthusiast
  • Posts: 302
    • View Profile
Re: Else Help
« Reply #21 on: September 08, 2007, 08:24:23 PM »
You're the man. Thanks!