Php, ajax ve jquery kullanarak sıralama mysql tablo

1 Cevap php

Hello Everyone Ok here is the deal i am building a messaging system by php,ajax,jquery and mysql i add the new message and i add in 2 rows now what i want to do is to send an ajax request to server and recieve an updated version of the table but sorted So how can i do so

/ / Burada i mesaj eklemek ve mesaj çağrı

function addMsg()
	{
      //alert(post);
		$.get("db.php",$('form').serialize(),
		   function(data){
			getMsg(data);},"html");
}

function getMsg(data) { alert(data); $("#t1").append(data); } //php

	$sql="INSERT INTO -----

mysql_query($sql) or die(mysql_error()); 


$result = mysql_query("SELECT ----");

    while($row = mysql_fetch_assoc($result))
   {     
   echo "<tbody><tr><td>".""."</td><td>".$row["col"]."</td><td>".$row["col"]."</td><td></td><td></td><tr><td></td><td colspan='4'>".$row["col"]."</td></tr></tbody>"; 
   }

>

//Now for sorting //javascript

function sort()
	{
		$.ajax({
		  url: "sort.php",
		  dataType: "text",
		  success: function(data){
		  $("t1").text(data);
		      }

		});

	}

//php

$ Result = mysql_query ("col azalan BY tablo ORDER SELECT * from");

			while($row = mysql_fetch_array($result))
	       {	 
		   echo "<tbody><tr><td>"."&#8226;"."</td><td>".$row["col"]."</td><td>".$row["col"]."</td><td></td><td></td><tr><td></td><td colspan='4'>".$row["col"]."</td></tr></tbody>"; 
		   }

>

1 Cevap

Eğer SELECT yaptığınızda ORDER BY kullanın. Bu kontrol: http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html