Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-26-2008, 02:08 AM   PM User | #1
masterofollies
Senior Coder

 
Join Date: May 2005
Posts: 2,137
Thanks: 96
Thanked 72 Times in 72 Posts
masterofollies can only hope to improve
2 While loops, one doesnt work

Can someone tell me why both of these won't run on the same page? It only displays the second one.


Code:
function cheatlog()
{
  $numbers = "50000000";
	$page = '<center><p><b><u>If any users are listed below, it means they have cheats on their account.<br>Contact an administrator right away.</u></b><br /><br />';
	$page .= '<hr>Number Cheat<hr><table width="50%">';
	$result = doquery("SELECT number FROM {{table}} WHERE number > '$numbers' ORDER BY username", 'regusers');

		$page .= '<tr><td><b>User Name</b></td><td><b>Number</b></td></tr>';

		while($row = mysql_fetch_array($result))
                 {
			$page .=  "<tr><td>".$row["username"]."</td><td>".$row["number"]."</td></tr>";
 }

    $page .= '</table></center>';
    
    $points = "5000";
	$page = '<center><p><br /><br />';
	$page .= '<hr>Points Cheat<hr><table width="50%">';
	$ptsresult = doquery("SELECT points FROM {{table}} WHERE points > '$points' || maxpoints > '$points' ORDER BY username", 'regusers');

		$page .= '<tr><td><b>User Name</b></td><td><b>Current Points</b></td><td><b>Maximum Points</b></td></tr>';

		while($ptsrow = mysql_fetch_array($ptsresult))
                 {
			$page .=  "<tr><td>".$ptsrow["username"]."</td><td>".$ptsrow["points"]."</td><td>".$ptsrow["maxpoints"]."</td></tr>";
	}

    $page .= '</table></center>';


    display($mainpage, 'Cheat Log');
}
masterofollies is offline   Reply With Quote
Old 07-26-2008, 02:17 AM   PM User | #2
rafiki
Senior Coder

 
rafiki's Avatar
 
Join Date: Aug 2006
Location: Floating around somewhere...
Posts: 2,034
Thanks: 18
Thanked 42 Times in 42 Posts
rafiki will become famous soon enough
Comment the 2nd one out and see if the first one works then. If not there is buggy code in your first statement.
__________________
Get Firefox Now
rafiki is offline   Reply With Quote
Old 07-26-2008, 02:33 AM   PM User | #3
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,751
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
I'm guessing that there are no results from you're query. If you are on a local environment, or have PHPMyAdmin Access, filter that query into its sql string and run that through the direct sql entry.
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
masterofollies (07-26-2008)
Old 07-26-2008, 02:51 AM   PM User | #4
masterofollies
Senior Coder

 
Join Date: May 2005
Posts: 2,137
Thanks: 96
Thanked 72 Times in 72 Posts
masterofollies can only hope to improve
Ok if I comment out the second while loop, the first one works perfect. But if I uncomment it, then the first one disappears. Regardless of entries, it should at least comes up with <hr>Number Cheat<hr> on the page.
masterofollies is offline   Reply With Quote
Old 07-26-2008, 05:49 AM   PM User | #5
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,751
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Sorry, I missed this one: $page = '<center><p><br /><br />';.
Should be $page .= .
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
masterofollies (07-26-2008)
Old 07-26-2008, 11:55 AM   PM User | #6
rafiki
Senior Coder

 
rafiki's Avatar
 
Join Date: Aug 2006
Location: Floating around somewhere...
Posts: 2,034
Thanks: 18
Thanked 42 Times in 42 Posts
rafiki will become famous soon enough
Hmmm seems we all missed it :O
Wow that was strange
__________________
Get Firefox Now
rafiki is offline   Reply With Quote
Old 07-26-2008, 02:13 PM   PM User | #7
masterofollies
Senior Coder

 
Join Date: May 2005
Posts: 2,137
Thanks: 96
Thanked 72 Times in 72 Posts
masterofollies can only hope to improve
Ah yeah I've missed that before in scripts. It's possibly the smallest thing you can miss.

I tested it and sure enough that was the problem. There was 2 missing the periods. Thanks Fou!
masterofollies is offline   Reply With Quote
Old 07-26-2008, 07:19 PM   PM User | #8
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,751
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
NP mate, I hate missing these .'s; they can take awhile to debug.
I used to hear horror stories from back-in-the-day programmers. They spent weeks punching their cards out and placing them outside of their dormroom doors to have compiled and run, and a week later they get their results - Syntax error -_-. I'm glad I'm not from those days... lol.
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
masterofollies (07-26-2008)
Old 07-26-2008, 10:22 PM   PM User | #9
masterofollies
Senior Coder

 
Join Date: May 2005
Posts: 2,137
Thanks: 96
Thanked 72 Times in 72 Posts
masterofollies can only hope to improve
Wow seriously, that would be horrible.
masterofollies is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 08:42 PM.


Advertisement
Log in to turn off these ads.