/home/bjcompany/domains/benjabhorn.com/public_html/BJconcrete/control/sort_reference.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
            
require_once("config.inc.php");
            
//---------------------------------------------------------------------------------------------------------------------------------------------------
            
$link mysql_connect($cfgServers['host'],$cfgServers['stduser'],$cfgServers['stdpass'])or die("Can't connect Server");
            
mysql_select_db($cfgServers['selectdb']) or die("Can't connect databases");

              
$query="SELECT  * FROM tbl_portfolio_category WHERE mainCateId='0'   ORDER BY num ASC ";    
              
$resultCate=mysql_query($query);
        
        
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
 <?php while($cate=mysql_fetch_assoc($resultCate)){ ?>
       <p>
            -<?php echo $cate['cate_name']?>    <br />
                    <?php
                    $query
="SELECT * FROM tbl_portfolio_data WHERE  mainCateId='".$cate['id']."' ORDER BY id DESC  ";
                    
                    
$resultData=mysql_query($query);
                    
$n=1;
                    while(
$data=mysql_fetch_assoc($resultData)){
                             
$query="UPDATE tbl_portfolio_data SET num='".$n."' WHERE id='".$data['id']."' ";
                             
mysql_query($query);
                             echo 
$data['product_name_th']." "$query."<br>";
                        
$n++;
                        }
                    
?>
            
            
            
       </p>
 <?php }?>


</body>
</html>