About_AJAX_03
以为AJAX只可以获取一个值呢,原来也是可以拼接的:
function sendTopic(){ if(window.ActiveXObject){ xmlHttp = new ActiveXObject("MICROSOFT.XMLHTTP"); }else if(window.XMLHttpRequest){ xmlHttp = new XMLHttpRequest(); } var user = document.getElementById("user").value;//得到id var content = document.getElementById("content").value; var title = document.getElementById("title").value; xmlHttp.open("GET","save.php?title="+title+"&content="+content+"&user="+user,true); xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState == 4){ if(xmlHttp.status == 200){ var str = xmlHttp.responseText; var newTopic = document.getElementById("newTopic"); newTopic.innerHTML += str + "<br/>"; } } } xmlHttp.send(null); }
mysql_fetch_array和mysql_fetch_row的区别是:
mysql_fetch_array属性和序号一起显示;
mysql_fetch_row显示序号,相当于键值对,返回一行数据;
eg:
加入SQL是:
$sql="select abc,def from a";
$res=mysql_query($sql);
那么:$row=mysql_fetch_row($res);
$row结果是两个:$row[0]和$row[1]
那么:$row=mysql_fetch_array($res);
$row结果是4个:$row[0]、$row[1]、$row["abc"]和$row["def"]