  | 
              
	              
	                
  
    
	 
        ในหน้านี้เป็นหน้าขายหนังสือ  พอคลิกรูปหนังสือ จะมีการGet id_prd,ref_id_typeจากตาราง ผมเลยอยากเพิ่ม prd_grp     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                ในหน้านี้เป็นหน้าขายหนังสือ  พอคลิกรูปหนังสือ จะมีการGet id_prd,ref_id_typeจากตาราง ผมเลยอยากเพิ่ม prd_grp เพื่อระบุประเภทวิชาของหนังสือเล่มนั้นๆ พอเพิ่ม     if($_GET[group_prd_grp] != \){             $TypeID1 = $_GET[group_prd_grp];             $str 
 
ในหน้านี้เป็นหน้าขายหนังสือ  พอคลิกรูปหนังสือ จะมีการGet id_prd,ref_id_typeจากตาราง 
ผมเลยอยากเพิ่ม prd_grp เพื่อระบุประเภทวิชาของหนังสือเล่มนั้นๆ 
พอเพิ่ม   
  if($_GET['group_prd_grp'] != ''){ 
            $TypeID1 = $_GET['group_prd_grp']; 
            $str1 .= "  and prd_grp =  '$TypeID1' "; 
         } 
ในบรรทัดที่16-19  
และ 
$str2 .= "  and prd_grp  = ".$_GET['group_prd_grp']." "; 
ในบรรทัดที่178 
 
ก็EROR    อยากทราบว่าผมเขียนผิดตรงไหนครับ ขอผู้รู้ชีแนะทีครับ 
Code (PHP) 
<?  ob_start(); ?>
<? session_start(); ?>
<? include_once "Menu.php" ?>
  <?
$str1 = " select   id_prd , name_prd , ref_id_type ,prd_grp, price_prd , price , photo_prd
          , cast(replace(cast(detail_prd as nvarchar(Max)),'<br>','') as text) as detail_prd1
          , cast((cast(detail_prd as nvarchar(Max))) as text) as detail_prd
          ,ProductSize , PageCount as NumPage ,ProductExample
          from tb_product where status = 1";
if($_GET['id_pre'] != ''){
     $id = $_GET['id_pre'];
       $str1 .= "   and id_prd =  '$id' ";
	   
	         if($_GET['group_prd_grp'] != ''){
            $group_prd_grp1 = $_GET['group_prd_grp'];
            $str1 .= "  and prd_grp =  '$group_prd_grp1' ";
         }  
		 
		 
         if($_GET['TypeID'] != ''){
            $TypeID1 = $_GET['TypeID'];
            $str1 .= "  and ref_id_type =  '$TypeID1' ";
         }
}else{
     if($_GET['TypeID'] != ''){
       $TypeID1 = $_GET['TypeID'];
       $str1 .= "  and ref_id_type =  '$TypeID1' ";
     }  
	
}
    $str1 .= " order by id_prd DESC ";
//
//echo $str1;
    $querystr = mssql_query($str1);
    $resuft1 = mssql_fetch_array($querystr);
    $name = $resuft1['name_prd'];
    $price = $resuft1['price'];
    $price_prd = $resuft1['price_prd'];
    $details = trim($resuft1['detail_prd']);
    $ProductSize = $resuft1['ProductSize'];
    $NumPage = $resuft1['NumPage'];
    $DocDownload = $resuft1['ProductExample'];
    $photo = $resuft1['photo_prd'];
    $id_prd = $resuft1['id_prd'];
    $code=sprintf("%05d",$id_prd);
?>
  <html>
  <head>
  <style>
    .img2{
    /*  text-overflow: ellipsis;*/
         overflow:hidden;
         text-overflow:ellipsis;
         white-space: nowrap;
          height:20px;
          color: rgb(238, 119, 10);
          font-weight: bold;
          font-size: 16px;
        }
        .text1{
          font-size: 14px;
          overflow: hidden;
          overflow-y: hidden;
          text-overflow: ellipsis;
          height:60px;
          font-weight: bold;
        }
        .img {
            overflow: hidden;
            height: 280px;
            width: 290px;
        }
     .col-md-4:nth-child(3n+1){
            clear: left;
        }
    </style>
  </head>
  
  <body>
  
  <!--start-single-->
  <div class="single contact">
    <div class="container">
      <div class="single-main">
        <div class="col-md-9 single-main-left">
          <div class="sngl-top">
            <div class="col-md-4 single-top-left">
              <div class="flexslider">
                <ul class="slides">
                  <li data-thumb="<? echo $photo;?>">
                    <center>
                      <img src="../Xa/photo/<?echo $photo;?>"/>
                    </center>
                  </li>
                </ul>
              </div>
              <!-- FlexSlider --> 
              <script defer src="js/jquery.flexslider.js"></script>
              <link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" />
              <script>
                // Can also be used with $(document).ready()
                      $(window).load(function() {
                        $('.flexslider').flexslider({
                          animation: "slide",
                          controlNav: "thumbnails"
                        });
                      });
                </script> 
            </div>
            <div class="col-md-7  col-sm-7 single-top-right">
              <div class="details-left-info simpleCart_shelfItem" style="color:rgb(1, 11, 4); font-size:20px; font-weight:bold;">
                <h3 style="overflow:visible;"><? echo iconv( 'TIS-620','UTF-8',$name);   ?></h3>
                <!--	<p class="availability">สถานะ:
               <span class="color">In stock</span></p>-->
                
                <div class="price_single">
                  <p class="quick_desc" style="font-size:16px;"> รหัสหนังสือ : <? echo $code;?> </p>
                  <p class="quick_desc" style="font-size:16px;">
                    <?
                                if($price !=  $price_prd ){
                            ?>
                    <span class="reducedfrom">ราคา <? echo $price;?>.00  บาท</span>
                    <?
                                }
                            ?>
                    <span class="actual item_price">ราคา <? echo $price_prd ;?>.00  บาท</span> </p>
                  <!--<a href="#">click for offer</a>--> 
                  
                </div>
                <h2 class="quick" style="font-size:20px; font-weight:bold;">รายละเอียด</h2>
                <div style="width:100%;" style="font-size:20px;">
                <p class="quick_desc" style=" text-overflow: ellipsis-word;white-space: nowrap;overflow: scroll;">
                  <?
                        echo  iconv('TIS-620','UTF-8',$details);
                    ?>
                </p>
              </div>
              <p  class="quick_desc" style="font-weight:bold;">ขนาด: <? echo iconv('TIS-620','UTF-8',$ProductSize);?></p>
              <p  class="quick_desc" style="font-weight:bold;">ปก / จำนวนหน้า : <? echo iconv('TIS-620','UTF-8',$NumPage);?></p>
              <?
                   $myFile = "../Xa/photo/".$DocDownload;
                  if(is_file($myFile)){
              ?>
              <p  class="quick_desc">ตัวอย่าง <a href="../Xa/photo/<?echo iconv("TIS-620", "UTF-8",$DocDownload);?>" target="_blank"> <img src="images/pdf-icon.png"> </a>
                <?
                }
                ?>
              <div class="single-but item_add"> <a href="order.php?id_prd=<? echo $id_prd?>">
                <input type="button" class="btn btn-warning" value="หยิบใส่ตะกร้า"/>
                </a> </div>
              </p>
              <div class="clearfix"> </div>
            </div>
          </div>
          <div class="clearfix visible-md"></div>
        </div>
        <div class="row">
          <div class="latest products">
            <div class="product-one">
              <?
                $str2 = "select id_prd , name_prd , price, price_prd , photo_prd ,ref_id_type,prd_grp
                          from tb_product where  status  = 1  ";
                if($_GET['TypeID'] != ""){
                    $str2 .= "  and ref_id_type  = ".$_GET['TypeID']."  ";
 					
					$str2 .= "  and prd_grp  = ".$_GET['group_prd_grp']." ";
                   $str2 .= "  order by id_prd DESC " ;
                    $query2 = mssql_query($str2);
                }
                while($row = mssql_fetch_array($query2)){
                          $photo_prd  = $row['photo_prd'];
                          $id = $row['id_prd'];
              ?>
              <div class="col-xs-6 col-sm-4 col-md-4 product-left single-left ">
                <div class="p-one simpleCart_shelfItem">
                  <div class="hidden-xs hidden-sm img2">
                    <?  echo iconv('TIS-620','UTF-8',$row['name_prd']) ?>
                  </div>
                  <br>
                  <a href="single.php?id_pre=<? echo $row['id_prd']?>&TypeID=<? echo $row['prd_grp']?>&TypeID=<? echo $row['ref_id_type']?>"> <img  src="../Xa/photo/<?echo $row['photo_prd'];?>" alt="" />
                  <div class="mask mask1"> <span>รายละเอียด</span> </div>
                  </a>
                  <p style="font-size: 16px;"> <a class="item_add" href="order.php?id_prd=<? echo $row['id_prd']?>"><i></i> ราคา <? echo $row['price'] ?> บาท<span class=" item_price"> </span></a>
                    <?
                                             echo "<div class= 'text1' >";
                                                if($row['price'] != $row['price_prd']){
                                                  echo "<font style='color:rgb(236, 39, 5);'>ลดเหลือ ";
                                                  echo $row['price_prd'];
                                                  echo " บาท</font><br>";
                                                }
                                                    $dis3  =  $row['price'] - $row['price_prd'];
                                                    if($dis3 != $row['price_prd']){
                                                        if($dis3 != 0){
                                                            echo "<u><font style='color:rgb(29, 119, 11);'> ประหยัด " ;
                                                            echo $dis3;
                                                            echo "  บาท </u> </font>";
                                                        }
                                                    }else{
                                                           echo '<p><a class="item_add" href="#"><i></i>
                                                                 <span class=" item_price"> :';
                                                             echo $row['price_prd'];
                                                            echo '</span></a></p>';
                                                    }
                                          echo "</div>";
                                        ?>
                    <?  echo "หมวดวิชา" ?>
                    <?PHP echo $row['prd_grp']  ?> </p>
                </div>
              </div>
              
              <!--
  				<div class="col-xs-6 col-md-4 col-sm-4 product-left single-left">
					 <div class="p-one simpleCart_shelfItem">
                          <div class="hidden-xs hidden-sm img2">
                                   <? // echo iconv('TIS-620','UTF-8',$row['name_prd']) ?>
                            </div>
                            <br>
  					    <a href="single.php?id_pre=<? echo $row['id_prd']?>&TypeID=<? echo $row['ref_id_type']?>">
                          <img src="../Xa/photo/<?echo $row['photo_prd'];?>" alt="" />
        								<div class="mask mask1">
        									<span>รายละเอียด</span>
        								</div>
  							     </a>
                       <!--
  									    <p style="font-size:14px;" >
                          <? //echo iconv('TIS-620','UTF-8',$row['name_prd']) ?></p>
                        <p style="font-size:14px; text-align:center; color:rgb(236, 92, 11) ">
                           <a class="item_add" href="order.php?id_prd=<? echo $row['id_prd']?>"><i></i>
                           <span class=" item_price">$<? // echo $row['price_prd'] ?></span></a>
                        </p>--> 
              <!--
                           <p style="font-size:14px; text-align:center; color:rgb(236, 92, 11) ">
                           <a class="item_add" href="order.php?id_prd=<? echo $id?>"><i></i>
                            ราคา
                            <span class=" item_price" ><? echo $row['price'] ?></span> บาท</a>
                            <?
                                /*
                              echo "<div class= 'text1' >";
                                    if($row['price'] != $row['price_prd']){
                                      echo "<font style='color:rgb(236, 39, 5);'>ลดเหลือ ";
                                      echo $row['price_prd'];
                                      echo "</font><br>";
                                    }
                                        $dis3  =  $row['price'] - $row['price_prd'];
                                        if($dis3 != $row['price_prd']){
                                            if($dis3 != 0){
                                                echo "<u><font style='color:rgb(29, 119, 11);'> ประหยัด " ;
                                                echo $dis3;
                                                echo "  บาท </u> </font>";
                                            }
                                        }else{
                                               echo '<p><a class="item_add" href="#"><i></i>
                                                     <span class=" item_price"> :';
                                                 echo $row['price_prd'];
                                                echo '</span></a></p>';
                                        }
                              echo "</div>";
                          ?>
                        </p>
  								</div>
  							</div>
                <?
                }*/
                ?>
                -->
              
              <?
                   }
                ?>
              <div class="clearfix visible-md"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!--tabs-->
    <div class="col-md-3 col-sm-3 single-right">
      <center>
        <h3 style="color: #ff6a00;">สินค้า</h3>
      </center>
      <?
            $string = "select ref_id_type , count(id_prd) as amount
                      ,(select name_type from tb_type where tb_type.id_type = tb_product.ref_id_type ) as name_type
                       from tb_product where status = 1
                       and ref_id_type in (1,2,3,4,5)
                       group by ref_id_type order by ref_id_type desc";
            $query = mssql_query($string);
            while($resutf = mssql_fetch_array($query)){
          ?>
      <ul class="product-categories" >
        <li > <a href="single.php?TypeID=<?= $resutf['ref_id_type']?>" style="color:rgb(231, 93, 5); font-weight:bold;"> <? echo iconv('TIS-620','UTF-8',$resutf['name_type']) ?> </a>
          <?
                        if($resutf['ref_id_type']==5){
                          echo "<img src='images/star.gif' class='hidden-xs hidden-sm' width='48' height='48'/>";
                        }
                    ?>
          <span class="count" style="color:rgb(14, 12, 112); font-weight:bold;">(<? echo $resutf['amount']?>)</span> </li>
      </ul>
      <?
           }
          ?>
    </div>
    <div class="clearfix"> </div>
  </div>
</div>
</div>
<!--end-single--> 
<? echo include("Footer.php") ?>
</body>
</html>
 
 
 
 
db 
  
 
 
 
  Tag : PHP               
                        | 
           
          
            
		
  ประวัติการแก้ไข 2018-02-24 11:32:21 2018-02-26 14:21:31	
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2018-02-24 11:30:21 | 
                      By :
                          yag00za | 
                      View :
                          748 | 
                      Reply :
                          5 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 รายละเอียดเยอะไปเลยไม่มีคนช่วยตอบ  รึป่าวครับ  อิอิ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-02-26 09:56:31 | 
                        By :
                            yag00za | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 สาระสำคัญคือ message error ไม่เห็นมี                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-02-26 10:57:35 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 แจ่ม อ่านเออเร่อร์ ก็แก้ได้เอง  
 
ข้อเสียคือไม่ค่อยอ่านกัน                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-02-26 22:58:28 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |