Help - Search - Members - Calendar
Full Version: Top Forum Posters Integration
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
Louis W
Hello guys, just need a hand with a small php code integrated for ipb2.#

here is the simple code

CODE
<?php


//Database Info
$host = "#######";
$dbname = "#######";
$dbuser = "#######";
$dbpass = "########";
//Forum Url Must include 'index.php?showuser=' or link will not go to user profile
$url = "http://www.#########.com/forums/index.php?showuser=";
//Don't Edit Below
$con = mysql_connect($host,$dbuser,$dbpass);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  mysql_select_db($dbname, $con);
  $result = mysql_query("SELECT * from ibf_members order by posts desc LIMIT 0, 10 ");
while($row = mysql_fetch_array($result))
  {
  echo "<a href=\"$url".$row['id']."\">".$style;
  echo $row['members_display_name'] . "</span></td><td>" . $row['posts'];
  echo "</a>";
  }
  mysql_close($con);
?>



Basically it works fine, however it show the forum names like this

name1name34

and i want it to show like this

name 1
name 34

i would highly apreciate the help
Autistic Elephant
You have some variables that I don't know exactly what they're doing (like style) because (I'm assuming) they're defined elsewhere... But I'm guessing it's something like "$style=<span bla bla bla>" because otherwise you've got an open span tag...


But anyway, you're doing </td><td> but I'm not even seeing the table? I'm not quite sure why you're doing that...
But if you were using a table, it'd be

<table>
while(bla bla)
{
echo "<tr><a href=\"$url".$row['id']."\">".$style;
echo "middle stuff bla bla bla"
echo "</tr></a>";
}
</table>

If you weren't using a table, just use a <br /> at the end of your echos inside the while...
echo "</a><br />";
}
Louis W
its just a script i found on invisionise i havnt made it, il give it a go now, thanks.

Worked. Thanks alot!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.