Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
need minor code assistance
Old 03-30-2010, 06:46 PM need minor code assistance
Novice Talker

Posts: 10
Name: Travis Bales
Trades: 0
i want the following code to output a list to 500.

PHP Code:
<?
include 'header.php';
function 
Get_Explevel($level){
$level1 $level;
$exp $level1 600;
return 
"".$level1." ".$exp."";
}
?>
<tr><td class="contenthead">EXP Guide</tr></td>
<tr><td class="contentcontent">
<table width='100%'>
<tr>
<td><?= Get_Explevel(//need to list 500//) ?></td>
</tr>
</tr></td>
<?
include 'footer.php';
?>
tbales is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-31-2010, 05:38 AM Re: need minor code assistance
Super Talker

Posts: 139
Name: John Davis
Trades: 0
can't understand.
Describe you aim in details
__________________
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
»
Please login or register to view this content. Registration is FREE
for web developers
MapMaster is offline
Reply With Quote
View Public Profile Visit MapMaster's homepage!
 
Old 03-31-2010, 09:27 AM Re: need minor code assistance
Experienced Talker

Posts: 41
Name: Adam B
Trades: 0
Are all experience levels just the level number * 600?

If so you can just use a loop:

PHP Code:
for ($i 1$i <= 500$i++)
{
    echo 
'Level ' $i ' - ' . ($i*600) . 'xp required<br />';

If not but you're levels follow a formula (as would be recommended) then you should be able to modify the loop to fit your formula.

Last edited by adam89; 03-31-2010 at 11:48 AM..
adam89 is offline
Reply With Quote
View Public Profile
 
Old 03-31-2010, 11:45 AM Re: need minor code assistance
Andy Pugh's Avatar
Extreme Talker

Posts: 203
Name: Andy
Location: N.Ireland
Trades: 0
Hi Trevor,

Taking on board Adams advice, I would do it as follows, I would recommend splitting the returned data as follows, for design purposes.

PHP Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>
</head>

<body>

<? 
function Get_Explevel($level){
$level1 $level;
$exp $level1 600;
return 
$level1;
}

function 
Get_ExplevelCount($level){
$level1 $level;
$exp $level1 600;
return 
$exp;
}
?>


<h1>EXP Guide</h1>
<table width="22%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="53%"><strong>Level</strong></td>
    <td width="47%"><strong>Exp</strong></td>
  </tr>
  
  <? for ($i 1$i <= 500$i++)
{  
?>
  <tr>
    <td><?=Get_Explevel($i?></td>
    <td><?=Get_ExplevelCount($i?></td>
  </tr>
  
  <? ?>
</table>




</body>
</html>
__________________

Please login or register to view this content. Registration is FREE
Andy Pugh is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to need minor code assistance
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.79777 seconds with 12 queries