我在mysql中有"date"列,用这种格式保存日期
17-09-2014(DD-MM-YYYY)
我需要按升序排序,所以我使用了这个命令:
SELECT * FROM table ORDER BY date ASC
Run Code Online (Sandbox Code Playgroud)
但我发现了这个结果:
17-09-2014
18-09-2015
19-09-2014
Run Code Online (Sandbox Code Playgroud)
它应该是:
17-09-2014
19-09-2014
18-09-2015
Run Code Online (Sandbox Code Playgroud)
它只对ASC进行排序,而不是完整日期
我想发送'ID'到JS函数然后再从JS函数发送相同的ID到PHP函数.请告诉我我的代码有什么问题!
<script type="text/javascript">
function deleteclient(ID){ //I receive the ID correctly until now!
var x = "<?php deleteclient11('ID');?>";
return false;
}
</script>
<?php
function deleteclient11($x)
{
echo "$x";
}
?>
Run Code Online (Sandbox Code Playgroud) 当while循环为真时,如何在while循环和for循环中断开?
<?php
for($i=0; $i<4; $i++){
$result = mysql_query("SELECT * FROM table WHERE weight='$i'");
while($row = mysql_fetch_array($result)){
echo $row['cell'];
break; //I need to break the while loop and the for loop too in this line exactly, when he find and echo the "cell"!
}
}
?>
Run Code Online (Sandbox Code Playgroud)