1 Replies - 629 Views - Last Post: 07 October 2012 - 07:18 PM

#1 smaboud  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 119
  • Joined: 22-April 12

dynamic table doesn't show all the records.

Posted 07 October 2012 - 07:26 AM

Hi

I have generated a dynamic table using javascript,

the table wont show all the existing record in my table.

it shows like

1
2
3
4
5
7
8
9
10
11
13
Whats wrong with the code?
here is the code

     $query = "SELECT * FROM $table_select ";

     $result = mysql_query($query);
     $num = mysql_num_rows($result);


     $i=0;
     while ($i < $num) {
     	$orderId = mysql_result($result,$i,"order_id");
     	@setcookie("orderId",$orderId);
	$row = mysql_result($result,$i,"product_id");
	$linkUrl=mysql_result($result,$i,"link");
	$pic=mysql_result($result,$i,"photo");
	
	$unitPR=mysql_result($result,$i,"unit_price");
	$QTY=mysql_result($result,$i,"qty");
	$totao_unit_price = $unitPR*$QTY;
	$expressFEE=mysql_result($result,$i,"express");
	$comm=mysql_result($result,$i,"comission");
	$customerDESC=mysql_result($result,$i,"customer_st");
	
	if(strpos($linkUrl, 'http://') !== 0) {
       $linkUrl =  'http://'.$linkUrl;
     }
     ?>
     <script language="javascript">
     var x=document.getElementById("myTable");

       var row=x.insertRow(-1);
  
       var cell1=row.insertCell(0);
       var cell2=row.insertCell(0);
       var cell3=row.insertCell(0);
       var cell4=row.insertCell(0);
       var cell5=row.insertCell(0);
       var cell6=row.insertCell(0);
       var cell7=row.insertCell(0);
       var cell8=row.insertCell(0);
       var cell13=row.insertCell(0);
       var cell14=row.insertCell(0);



       cell1.innerHTML="<?php echo $customerDESC ?>";
       cell2.innerHTML="<?php echo $comm ?>";
       cell3.innerHTML="<?php echo $expressFEE ?>";
     cell4.innerHTML="<?php echo $totao_unit_price ?>";
     cell5.innerHTML="<?php echo $QTY ?>";
     cell6.innerHTML="<?php echo $unitPR ?>";
     cell7.innerHTML="<img src='<?php echo '../'.$pic; ?>' width='50' height='50' align='middle'/>";
     cell8.innerHTML="<a href=\"<?php echo $linkUrl ?>\" target='_blank'>Link</a>";
     cell13.innerHTML="<?php echo $row ?>";
     cell14.innerHTML="<b><input name='edit' type='button' onclick='editRow(this)' value='Изменить' /><input name='del' type='button' onclick='delRow(this)' value='удалить' />          </b>";
     var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "url", {validateOn:["blur"], hint:"Http://www."});
     var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "real", {validateOn:["blur"], hint:"0.00"});     
     var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer", {validateOn:["blur"], hint:"How many ?"});
     var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "currency", {validateOn:["blur"], hint:"0.00", format:"dot_comma"});
     var sprytextarea2 = new Spry.Widget.ValidationTextarea("sprytextarea2", {validateOn:["blur"], maxChars:200, hint:"Descripe what you need to buy.", isRequired:false});
     </script>
     <?php
     $i++;
     }
     ?>




Is This A Good Question/Topic? 0
  • +

Replies To: dynamic table doesn't show all the records.

#2 sas1ni69  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 85
  • View blog
  • Posts: 431
  • Joined: 04-December 08

Re: dynamic table doesn't show all the records.

Posted 07 October 2012 - 07:18 PM

Hello there,

You might want to check your database to see if you're getting the right name. Also test something like this

cell6.innerHTML="<?php echo 'test' . $unitPR; ?>";



You'll be able to know if it's a problem with the variable or the string itself.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1