Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Programming Help > PHP Programming Help

PHP Programming Help Post any question relating to PHP Programming here and hopefully someone can help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2007-11-13, 08:32 PM
Junior Member
 
Join Date: Nov 2007
Posts: 2
going under is on a distinguished road
Default problem with showing search results

developed php website connected to mysql database , when the client make a new search the results show in a table like this





look at the colume total time in hr the result appears at the first row i want it to be in the last row for that lawyer like this



i hope any one can help me . and i will include the code i used :

PHP Code:
$tempLawName="";  
$tempsumName=""; 
 
$mysql_query1 = ("SELECT * FROM `invoice` ORDER BY lawname ASC, date ASC"); 
$result = mysql_query($mysql_query1) or die(mysql_error()); 
while($row=mysql_fetch_array($result)){ 
      $lawname = stripslashes($row['lawyername']);    
 
 
if($tempLawName!=$lawname)  
{  
    $tempLawName=$lawname;  
    ?> <div align="center"><font color="#000000" size="2"        
face="arial"><b><?php echo $lawname ;?></b></font></div></td>  
<? }  
 
$sum1mysql_query(" SELECT SUM(timeinhr)as totalhr FROM `invoice`"); 
 
$my_sum1=mysql_fetch_array($sum1); 
?>  
 
<td><?php 
if($tempsumName!="$my_sum1[totalhr]")  

 
$tempsumName="$my_sum1[totalhr]";?> 
<div align="center"><b><font color="#0000FF" size="2"        
face="arial"><?php echo "<input type='text' name='totalhr[]' size='2' value='$my_sum1[totalhr]'>"?></font></b></div></td>  
 <? ?>
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2007-12-02, 05:19 PM
Senior Member
 
Join Date: Dec 2004
Posts: 199
strasm is an unknown quantity at this point
Default

it would be easier to store the data in a more "normalized" fashion. break your invoice table into 2 tables, one with all the main details for the invoice, lawyer, client etc. the other table will have the time break downs. Then you query the invoice table, put it in a loop, then query the time table. it makes this sort of task really easy.
Reply With Quote
  #3 (permalink)  
Old 2007-12-02, 05:25 PM
Junior Member
 
Join Date: Nov 2007
Posts: 2
going under is on a distinguished road
Default

i really appreciate your help strasm and i solved the problem using rowspan=$rownumber['lawyer']

where $rownumber['lawyer'] equal number of rows for that lawyer, and it worked.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 10:41 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.