Jump to content

wrong whit rowspan help


balkan7

Recommended Posts

i dont know where i wrong whit this code, why rowspan not wroking ?

 

<?php
echo "<table cellpading='0' cellspacing='1' width=100%' class='tbl-border'>\n<tr>\n";
echo "<td class='tbl1'>poster</td>\n<td class='tbl1'>stats</td>\n<td class='tbl1'>last</td>\n</tr>\n<tr>";
$result = dbquery("SELECT * FROM ".$db_prefix."joke ORDER BY joke_nick DESC LIMIT 0,5");
$i = 0;
while($data = dbarray($result)){
	$i++;
	$posts = dbcount("(joke_nick)", "joke", "joke_nick='".$data['joke_nick']."'");
	$cats = dbcount("(joke_cat_id)", "joke_cat");
	$jokes = dbcount("(joke_id)", "joke");
	echo "<tr>\n<td class='tbl2'>";
	echo "\n".$i.". ".$data['joke_nick']." - <span class='small2'>".$posts."</span>\n</td>\n";
  }
	echo "<td rowspan='5' class='tbl2'>Total Category: <span class='small2'>".$cats."</span>\n<br />\nTotal Jokes: <span class='small2'>".$jokes."</span>\n</td>\n";
	$result1 = dbquery("SELECT * FROM ".$db_prefix."joke ORDER BY joke_id DESC LIMIT 0,1");
	while($data1 = dbarray($result1)){
	echo "<td rowspan='5' class='tbl2'>".$data1['joke_description']."</td>\n";
}
echo "</tr>\n</table>";?>

Link to comment
Share on other sites

lets organize a few things first

 

1) you should never have a query in a query result loop that is just a bad thing to do

2) Explain these unquie functions you use (dbarray, dbcount dbquery)  I have no clue what you are replacing the defaults?

3) Did you verify the output source code looks correct?

Link to comment
Share on other sites

plus in the last rowspan you are looping over it.

 

the table, after all the looping should look something like this:

 

<table cellspacing="2" cellpadding="2" border="0">

<tr>

    <td></td>

    <td></td>

    <td></td>

    <td rowspan="5"></td>

</tr>

<tr>

    <td></td>

    <td></td>

    <td></td>

</tr>

<tr>

    <td></td>

    <td></td>

    <td></td>

</tr>

<tr>

    <td></td>

    <td></td>

    <td></td>

</tr>

<tr>

    <td></td>

    <td></td>

    <td></td>

</tr>

</table>

 

Get your table design down first then look at it and figure out how to loop the table and vars.

Link to comment
Share on other sites

I can't figure out what you want

I can't tell because it is all messed up

 

You have three columns but you are looping only one column

and then you have two rowspans at the end which are incorrect.

So without all the code what do you want the table to look like?

 

So send a table like this:

 

<table cellspacing="2" cellpadding="2" border="0">

<tr>

    <td>column header1</td>

    <td>column header2</td>

    <td>column header3</td>

    <td rowspan="5">the data you want here</td>

</tr>

<tr>

    <td>loop data 1</td>

    <td>loop data 2</td>

    <td>loop data 3</td>

</tr>

<tr>

    <td>loop data 1</td>

    <td>loop data 2</td>

    <td>loop data 3</td>

</tr>

<tr>

    <td>loop data 1</td>

    <td>loop data 2</td>

    <td>loop data 3</td>

</tr>

<tr>

    <td>loop data 1</td>

    <td>loop data 2</td>

    <td>loop data 3</td>

</tr>

</table>

 

 

 

Link to comment
Share on other sites

And what is supposed to be in that big grey hole?

And what is deal the admin row 5?

Why does it have totals in it?

 

The table doesn't make sense

I'm assuming it should be something like this:

 

poster |    stats      |        last

 

user1  | user1 stats |user1 last post

user2  | user2 stats |user2 last post

user3  | user3 stats |user3 last post

user4  | user4 stats |user4 last post

user5  | user5 stats |user5 last post

 

empty | totals        | nnn

cell

 

Right?

 

Next question is what fields are what?

is joke_nick the poster?

What is the stats field?

What is the last post field?

 

Plus with your limit you are only getting the count for five fields.

So your totals will incorrect.

 

Maybe what we should do is start from scratch and you tell me what this display is supposed to do. And what you are trying to get out of the database. And what are the fields I have to work with.

 

 

Short of that... I would suggest since you seem like you are a newbie you should buy a prewritten php joke site script. they are out there starting at $9.00.

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.