PDA

View Full Version : Solve my PHP Problem



Halting
11-06-2006, 12:47 PM
I'm working on a Staff Page for my new website and I have put together my own PHP Staff System allowing administrators to add users into categorys of the page without cPanel access.

I'm having problems with the Staff Page itself though. As you will be able to see in my code below; where echo is in the second while function - I am showing the users infomation which has been collected from the database. My page can only contain a few of these pages before it makes the content box bigger.


<font class="heading">The Team</font><br>
<?
$forum_names = mysql_query("SELECT * FROM staffcategorys");
while($name = mysql_fetch_array($forum_names))
{
?>
<b><? echo"$name[name]"; ?></b> - <? echo"$name[description]"; ?><br><br>
<?
echo'<table width="100%" align="center"><tr>';
$staff_names = mysql_query("SELECT * FROM staffmembers WHERE fid = $name[id]");
while($staff = mysql_fetch_array($staff_names))
{
?>
<td align="center" width="25%" style="padding-bottom: 10px;"><img src="<? echo"$staff[avatar]"; ?>" border="0" alt="<? echo"$staff[habboname]"; ?>"><div style="padding-top: 4px;"><b><? echo"$staff[habboname]"; ?></b><br><? echo"$staff[jobtitle]"; ?></div></td>
<?
}
echo'</tr></table>';
}

I've been searching Google for a long time trying to firgure out how I could make it so:

For every Third, Sixth, Ninth, Tewlth and so on (3 times table) <td displaying the details* (that is created from:



$staff_names = mysql_query("SELECT * FROM staffmembers WHERE fid = $name[id]");
while($staff = mysql_fetch_array($staff_names))
{

)

* a </tr><tr> is inserted so my content box does not expand.

If you do not understand me, please let me know. This is not an easy think to explain.

Heinous
12-06-2006, 03:33 AM
From memory, on double (and single) quotes that aren't a part of the php code in itself, but in the code, you need to put a / before it?

Tomm
12-06-2006, 06:10 AM
Change:

echo'<table width="100%" align="center"><tr>';
To:

echo"<table width=\"100%\" align=\"center\"><tr>";

Luckyrare
12-06-2006, 02:56 PM
As Tom didnt explain, I shall

When using " in print, echo and so on you must use a \ before.

\"

Thanks,
Danny

Halting
12-06-2006, 03:10 PM
Change:

echo'<table width="100%" align="center"><tr>';
To:

echo"<table width=\"100%\" align=\"center\"><tr>";

My script works fine. You don't have to be a PHP nerd to know that if you use echo' and '; to start/end your echo, it will allow "'s inside and vice versa.

Placeeee
14-06-2006, 08:20 PM
Hey everyone from the nerdy part of the forum. :D

I wish I was a web designing nerd hehe~~~~~~~~

Flauvo
14-06-2006, 08:26 PM
Hey everyone from the nerdy part of the forum. :D

I wish I was a web designing nerd hehe~~~~~~~~
Well, that was spam

Luckyrare
14-06-2006, 08:42 PM
Hey everyone from the nerdy part of the forum. :D

I wish I was a web designing nerd hehe~~~~~~~~

A NERD AHEM? RUDE!

Anyway.

Want to hide these adverts? Register an account for free!