balkan7 Posted January 23, 2008 Share Posted January 23, 2008 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>";?> Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/ Share on other sites More sharing options...
cooldude832 Posted January 23, 2008 Share Posted January 23, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447271 Share on other sites More sharing options...
balkan7 Posted January 23, 2008 Author Share Posted January 23, 2008 (dbarray, dbcount dbquery) are functions like dbarray = mysql_fetch_array, whatever code working propertly but rowspan not working, where i wrong whit tables? Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447276 Share on other sites More sharing options...
rbrown Posted January 23, 2008 Share Posted January 23, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447278 Share on other sites More sharing options...
balkan7 Posted January 23, 2008 Author Share Posted January 23, 2008 yes but if you can example to my code. Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447290 Share on other sites More sharing options...
rbrown Posted January 23, 2008 Share Posted January 23, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447312 Share on other sites More sharing options...
balkan7 Posted January 23, 2008 Author Share Posted January 23, 2008 soryy i need whit php looping if you can do that. Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447320 Share on other sites More sharing options...
rbrown Posted January 23, 2008 Share Posted January 23, 2008 you are MISSING the point... SHOW me what you want and I'll add the looping to it. Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447334 Share on other sites More sharing options...
balkan7 Posted January 23, 2008 Author Share Posted January 23, 2008 i think is better idea ti view my code to picture: Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447344 Share on other sites More sharing options...
rbrown Posted January 24, 2008 Share Posted January 24, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/87453-wrong-whit-rowspan-help/#findComment-447506 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.