2010-08-15, 08:54 PM
2010-08-15, 10:10 PM
I just wanna know if the array actually contains data.
Can you run print_r on $tmp too?
Can you run print_r on $tmp too?
2010-08-15, 10:51 PM
everything is fine, i think it needs to pull the (uid) from the $arr and not the $user
When i did that, i got random output of a bunch of c's, r's z's, well, look lol: http://www.tgs.webege.com/forum/testphpdb.php
When i did that, i got random output of a bunch of c's, r's z's, well, look lol: http://www.tgs.webege.com/forum/testphpdb.php
2010-08-15, 11:01 PM
There's one too many foreach loop I think. I think the one I added might not be needed. Try taking it out and could you send me the print_r output of $tmp?
I'll have a look at it tomorrow.
I'll have a look at it tomorrow.
2010-08-16, 04:25 AM
Ok, I have this working... kind of. Here is the code:
and the page: http://www.tgs.webege.com/forum/testphpdb.php
What is causing it to show the same name multiple times and space it like that?
<?php
define("IN_MYBB", 1);
$templatelist = "adLog";
require_once './global.php';
require_once './rsslib.php';
add_breadcrumb("Adventurer's Log", "adLog.php");
$output = '';
// $usergroup['clan_member']
if ($mybb->user['usergroup'] == 7) {
error_no_permission();
} else {
$que =$db->query("SELECT * FROM mybb_users WHERE usergroup=8");
$output .= '<center><table width="100%">
<tr colspan="2">
<th colspan="2" class="thead"><div style="float:left; color:white;">The
Great Spiritz Adventurer\'s Log</div><div style="float:right;"><input
type="text" value="Search players"><input type="button" value="Search"></th>
</tr>
<tr>
<td style="width:50%;" class="trow2 page_content"><center>Choose a clan
member\'s name to view their Adventurer\'s Log.<br><br><div>';
while ($arr =$db->fetch_array($que)) {
foreach($arr as $user) {
$answer = $db->query("SELECT * FROM mybb_userfields WHERE ufid=".$arr['uid']);
while($tmp = $db->fetch_array($answer)){
//foreach($tmp as $users){
$output .= $tmp['fid5']."<br>\n";
}
}
}
$output .= '</div></center></td><td style="width:50%;" class="trow2 page_content">
<center>Search for a player\'s Adventurer\'s Log.<br><br></center></td>
</tr>
<tr colspan="2"><td colspan="2" class="tcat"></td></tr>
</table></center>';
eval("\$adLog_home = \"".$templates->get("adLog"). "\";");
output_page($adLog_home);
}
?>
and the page: http://www.tgs.webege.com/forum/testphpdb.php
What is causing it to show the same name multiple times and space it like that?
2010-08-16, 12:22 PM
I don't think the while loop is needed either. Because $answer should only return one record.
This might solve the problem:
Have that instead of the second while loop and it should fix the problem.
This might solve the problem:
$tmp = $db->fetch_array($answer);
$output .= $tmp['fid5']."<br>\n";
Have that instead of the second while loop and it should fix the problem.
2010-08-16, 03:08 PM
It didn't really make much of a difference .
Code:
Code:
<?php
define("IN_MYBB", 1);
$templatelist = "adLog";
require_once './global.php';
require_once './rsslib.php';
add_breadcrumb("Adventurer's Log", "adLog.php");
$output = '';
// $usergroup['clan_member']
if ($mybb->user['usergroup'] == 7) {
error_no_permission();
} else {
$que =$db->query("SELECT * FROM mybb_users WHERE usergroup=8||1");
$output .= '<center><table width="100%">
<tr colspan="2">
<th colspan="2" class="thead"><div style="float:left; color:white;">The
Great Spiritz Adventurer\'s Log</div><div style="float:right;"><input
type="text" value="Search players"><input type="button" value="Search"></th>
</tr>
<tr>
<td style="width:50%;" class="trow2 page_content"><center>Choose a clan
member\'s name to view their Adventurer\'s Log.<br><br><div>';
while ($arr =$db->fetch_array($que)) {
foreach($arr as $user) {
$answer = $db->query("SELECT * FROM mybb_userfields WHERE ufid=".$arr['uid']);
$tmp = $db->fetch_array($answer);
$output .= $tmp['fid5']."<br>\n";
}
}
$output .= '</div></center></td><td style="width:50%;" class="trow2 page_content">
<center>Search for a player\'s Adventurer\'s Log.<br><br></center></td>
</tr>
<tr colspan="2"><td colspan="2" class="tcat"></td></tr>
</table></center>';
eval("\$adLog_home = \"".$templates->get("adLog"). "\";");
output_page($adLog_home);
}
?>
2010-08-16, 03:16 PM
Try this:
I might be missing a } or have an extra one, but run it and see.
<?php
define("IN_MYBB", 1);
$templatelist = "adLog";
require_once './global.php';
require_once './rsslib.php';
add_breadcrumb("Adventurer's Log", "adLog.php");
$output = '';
// $usergroup['clan_member']
if ($mybb->user['usergroup'] == 7) {
error_no_permission();
} else {
$que =$db->query("SELECT * FROM mybb_users WHERE usergroup=8||1");
$output .= '<center><table width="100%">
<tr colspan="2">
<th colspan="2" class="thead"><div style="float:left; color:white;">The
Great Spiritz Adventurer\'s Log</div><div style="float:right;"><input
type="text" value="Search players"><input type="button" value="Search"></th>
</tr>
<tr>
<td style="width:50%;" class="trow2 page_content"><center>Choose a clan
member\'s name to view their Adventurer\'s Log.<br><br><div>';
$arr =$db->fetch_array($que);
foreach($arr as $user) {
$answer = $db->query("SELECT * FROM mybb_userfields WHERE ufid=".$user['uid']);
$tmp = $db->fetch_array($answer);
$output .= $tmp['fid5']."<br>\n";
}
$output .= '</div></center></td><td style="width:50%;" class="trow2 page_content">
<center>Search for a player\'s Adventurer\'s Log.<br><br></center></td>
</tr>
<tr colspan="2"><td colspan="2" class="tcat"></td></tr>
</table></center>';
eval("\$adLog_home = \"".$templates->get("adLog"). "\";");
output_page($adLog_home);
}
?>
I might be missing a } or have an extra one, but run it and see.
2010-08-16, 03:52 PM
MyBB SQL Error
MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1054 - Unknown column 'C' in 'where clause'
Query:
SELECT * FROM mybb_userfields WHERE ufid=C
thats just what i got right off the bat, i didn't look for anything missing
2010-08-16, 03:56 PM
Damn, ok, the while loop needs to go back. Next try this:
Sorry to mess you about like this, but I can't test it myself lol.
<?php
define("IN_MYBB", 1);
$templatelist = "adLog";
require_once './global.php';
require_once './rsslib.php';
add_breadcrumb("Adventurer's Log", "adLog.php");
$output = '';
// $usergroup['clan_member']
if ($mybb->user['usergroup'] == 7) {
error_no_permission();
} else {
$que =$db->query("SELECT * FROM mybb_users WHERE usergroup=8||1");
$output .= '<center><table width="100%">
<tr colspan="2">
<th colspan="2" class="thead"><div style="float:left; color:white;">The
Great Spiritz Adventurer\'s Log</div><div style="float:right;"><input
type="text" value="Search players"><input type="button" value="Search"></th>
</tr>
<tr>
<td style="width:50%;" class="trow2 page_content"><center>Choose a clan
member\'s name to view their Adventurer\'s Log.<br><br><div>';
while ($arr =$db->fetch_array($que)) {
$answer = $db->query("SELECT * FROM mybb_userfields WHERE ufid=".$arr['uid']);
$tmp = $db->fetch_array($answer);
$output .= $tmp['fid5']."<br>\n";
}
$output .= '</div></center></td><td style="width:50%;" class="trow2 page_content">
<center>Search for a player\'s Adventurer\'s Log.<br><br></center></td>
</tr>
<tr colspan="2"><td colspan="2" class="tcat"></td></tr>
</table></center>';
eval("\$adLog_home = \"".$templates->get("adLog"). "\";");
output_page($adLog_home);
}
?>
Sorry to mess you about like this, but I can't test it myself lol.