|  | 
	                
  
    | 
	 
        ช่วยหน่อยนะค่ะกำลังจะสอบแล้วต้องการโค็ดค่ะเพื่อนจะเอาไปสอบใครก็ได้ช่วยทีค่ะ     |  
    |  |  
 
              
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | $query = mysql_query("select comID, comBrand, cpuBrand, cpuClockSpeed, price FROM tbl_product where price >20000 ORDER BY price ASC"); 
 คำสั่งคิวรี่ ส่วนจะให้ออกมาเป็นอะไร ก็ว่ากันไปครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 03:10:35 | By :
                            deawx |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณจะจะลองศึกษาทำดู 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 13:56:51 | By :
                            ninjaKMU |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 <?
$hostname = "localhost";
$username = "myusername";
$password = "mypassword";
$database = "mydatabase";
mysql_connect($hostname,$username,$password) or die("Error Connect to Database");
mysql_select_db($database) or die("Error Database");
$sql="select comID, comBrand, cpuBrand, cpuClockSpeed, price FROM tbl_product where price >20000 ORDER BY price ASC";
?>
<TABLE>
            <TR >               
                <td>comID</td>              
                <td>comBrand</td>
                <td>cpuBrand</td>               
                <td>cpuClockSpeed</td>
                <td>price</td>             
               
          </TR>
          <?php
while($rs=mysql_fetch_array($sql)){
		?>
        <TR>
        	<TD><?=$rs['comID'];?></TD> 
            <TD><?=$rs['comBrand'];?></TD>
            <TD><?=$rs['cpuBrand'];?></TD>
            <TD><?=$rs['cpuClockSpeed'];?></TD>
            <TD><?=$rs['price'];?></TD>
        </TR>
<?php }  
?>           
</TABLE>
 ลองดูครับ น่าจะได้ ต่อไปก็ศึกษาแต่เนิ่นๆ อย่ารีบแบบนี้ครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 14:14:02 | By :
                            chon2008 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 <?	
print "<table width=437 border=0 align=center cellpadding=0 cellspacing=0 bordercolor=666666>";
	print "<tr>";
		print "<td width=500>";
			print "<table width=500 align=center>";
			
		$host ="202.55.55.55";
		$username"aratar";
		$password="hahaha";
		$dbname="myDatabase";
		$tblComputer="Computer";
$query = mysql_query("select comID, comBrand, cpuBrand, cpuClockSpeed, price FROM tbl_product where price >20000 ORDER BY price ASC");
$result =  mysql_query($query);
$num =  mysql_num_rows($result);
echo"<table border='1' bgcolor=999999>
<tr>
<th>comID</th>
<th>comBrand</th>
<th>cpuBrand</th>
<th>cpuClockSpeed</th>
</tr>";
$i = 0;
while($i < $num)
{
	$comID = mysql_result($result,$i,"comID");
	$comBrand = mysql_result($result,$i,"comBrand");
	$cpuBrand = mysql_result($result,$i,"cpuBrand");
	$cpuClockSpeed = mysql_result($result,$i,"cpuClockSpeed");
	echo"<tr>
	<td>$comID</td>
	<td>$comBrand</td>
	<td>$cpuBrand</td>
	<td>$cpuClockSpeed</td>
	</tr>";
	$i++;
}
mysql_close();
 ?>   
ถูกป่าวค่ะๆๆๆๆๆๆๆ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 14:25:05 | By :
                            ninjaKMU |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอคุณมากๆๆค่ะ ขอบคุณจารจัย 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 14:56:10 | By :
                            ninjaKMU |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | แล้วที่ นู๋ ทำ ถูก ป่าวคร้า 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 14:58:17 | By :
                            ninjaKMU |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | คือว่ามีตารางข้อมูลแบบนี้ Computer ( comID, comBrand, cpuID, price )
 comID คือ รหัสคอมพิวเตอร์
 comBrand คือ ยี่ห้อคอมพิวเตอร์
 cpuID คือ รหัส CPU
 price คือ ราคา ( บาท )
 
 CPU ( cpuID, cpuBrand, cpuClockSpeed )
 cpuID คือ รหัส CPU
 cpuBrand คือ ผู้ผลิต CPU
 cpuClockSpeed คือ ความเร็วสัญญาณนาฬิกาของ CPU (GHz)
 
 
 ให้มัน  natural join ตารางงันคร้าาาาา
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 15:19:14 | By :
                            ninjaKMU |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 <?	
		print "<table width=437 border=0 align=center cellpadding=0 cellspacing=0 bordercolor=666666>";
				print "<tr>";
					print "<td width=500>";
						print "<table width=500 align=center>";
		include"config.php";
		$query ="select comID, comBrand, cpuBrand, cpuClockSpeed, price FROM  computer natural join cpu where price > 20000";
		$result =  mysql_query($query);
		$num =  mysql_num_rows($result);
						echo"<table border='1' bgcolor=999999>
												<tr>
														<th>comID</th>
														<th>comBrand</th>
														<th>cpuBrand</th>
														<th>cpuClockSpeed</th>
														<th>price</th>
												</tr>";
					$i = 0;
					while($i < $num)
					{
						$comID = mysql_result($result,$i,"comID");
						$comBrand = mysql_result($result,$i,"comBrand");
						$cpuBrand = mysql_result($result,$i,"cpuBrand");
						$cpuClockSpeed = mysql_result($result,$i,"cpuClockSpeed");
						$price = mysql_result($result,$i,"price");
						echo"<tr>
						<td>$comID</td>
						<td>$comBrand</td>
						<td>$cpuBrand</td>
						<td>$cpuClockSpeed</td>
						<td>$price</td>
						</tr>";
						$i++;
}
echo"</table>";
mysql_close();
		print "</td> ";
	print "</tr>";                 
print"</table>";
 ?>   
ใครก็ได้ช่วยทีมันไม่แสดงผลออกมา นะ
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2010-09-19 17:43:44 | By :
                            ninjaKMU |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |