Php echo help please

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

Post Reply
alcapone
Forum Newbie
Posts: 3
Joined: Wed Apr 07, 2010 7:10 pm

Php echo help please

Post by alcapone »

Hello Everyone,


I need a little help with a php page were i want a page to show this text until a job is done.Im working on a game and this is for the job page.

when you look at the page it will say this

Complete jobs to gain experience, earn money, and level up.

Remember, the bigger your family, the more experience and money you'll receive. Unlock harder jobs by leveling up.
(Reach level 9 to unlock more jobs)

And in same area after you do the job i want the job done to appear in same area


here is the code im working with

Code: Select all

<TD width="760" style="PADDING-RIGHT: 30px"><H1>
            
            <span class="paragraph2" style="PADDING-TOP: 5px"><?php
    if($error!="")
    {
    ?> </span><?php echo $err = ErrorMessage($error);?>

    <?php
    }
    ?>
            Complete jobs to <STRONG>gain experience, earn money, and level 
            up.</STRONG></H1>
              <P style="FONT-SIZE: 13px">Remember, the bigger your family, the more 
                experience and money you'll receive. Unlock harder jobs by leveling 
                up.</P> 
            <?php
        $level = $user["level"];
        $nextLevelRow = mysql_fetch_array(db_execute_return("Select level from jobs where level>".$level." Order by level DESC Limit 1;"));
    $nextLevel = $nextLevelRow["level"];
    
        ?>
              <P style="PADDING-TOP: 5px" class=paragraph2>(Reach <?php echo "level " . $nextLevel = $level+1;?> to unlock more 
                jobs)              </P>
       
</TABLE>
now im sure i can echo it but im not sure on how to do it any help would be great
Trahb
Forum Commoner
Posts: 36
Joined: Sat Jan 30, 2010 9:09 pm

Re: Php echo help please

Post by Trahb »

I could be wrong, but I see two instances where you use an = sign in an echo, and I'm pretty sure that'll give you an error.

Code: Select all

<?php echo $err = ErrorMessage($error);?>
should probably be

Code: Select all

<?php echo ErrorMessage($error);?>
and

Code: Select all

<?php echo "level " . $nextLevel = $level+1;?> 
should probably be

Code: Select all

<?php echo "level " . $level+1;?> 
alcapone
Forum Newbie
Posts: 3
Joined: Wed Apr 07, 2010 7:10 pm

Re: Php echo help please

Post by alcapone »

i just want the first part to vanish from the page after the jobs are done witch shows up in the code here

Code: Select all

 <?php
    if($error!="")
    {
    ?> </span><?php echo $err = ErrorMessage($error);?>

    <?php
    }
    ?> 
tells me about the jobs


this part shows when job is done or not the rest i just dont want o be able to see unless its when you first go to the page before you do a job. This is the part i want gone when you are doing job

Code: Select all

 Complete jobs to <STRONG>gain experience, earn money, and level  
            up.</STRONG></H1> 
              <P style="FONT-SIZE: 13px">Remember, the bigger your family, the more  
                experience and money you'll receive. Unlock harder jobs by leveling  
                up.</P>  
            <?php 
        $level = $user["level"]; 
        $nextLevelRow = mysql_fetch_array(db_execute_return("Select level from jobs where level>".$level." Order by level DESC Limit 1;")); 
    $nextLevel = $nextLevelRow["level"]; 
     
        ?> 
              <P style="PADDING-TOP: 5px" class=paragraph2>(Reach <?php echo "level " . $nextLevel = $level+1;?> to unlock more  
                jobs)
this is always there and want it to vanish when job is being done
Trahb
Forum Commoner
Posts: 36
Joined: Sat Jan 30, 2010 9:09 pm

Re: Php echo help please

Post by Trahb »

Dunno? Just create a variable that is 0 when the job isn't being done, and is 1 when the job is being done.

Code: Select all

if ($var == 0) {
    echo "Reach level blah blah blah etc etc to unlock more jobs.";
} else {
 doJobs(); //?
}
alcapone
Forum Newbie
Posts: 3
Joined: Wed Apr 07, 2010 7:10 pm

Re: Php echo help please

Post by alcapone »

Would it help if i posted the whole page for you ?

Cuase im not real sure how todo that
Post Reply