$rs = mysql_query($sql)
while ($row = mysql_fetch_array($rs))
{
$data[] = $row//需要保存到2维数组中才可以调用的
}
echo "这是第一条记录。ID=".$data[0][0].",title=".$data[0][2]
运行这个看看 有不明白的请看我给的参考资料 和PHP手册
sprintf(query, "SELECT *FROM history WHERE serialnumber='%s' AND adtcode='%s' LIMIT 1", dataStr,modulename)if (!mysql_real_query(mysql, query, (unsigned long)strlen(query))) {
res = mysql_use_result(mysql)
numfields = mysql_field_count(mysql)
while (row=mysql_fetch_row(res)) {
fprintf(outfile, "\r\n")
lengths = mysql_fetch_lengths(res)
fields=mysql_fetch_fields(res)
for (i=0i<numfieldsi++) {
fprintf(outfile, "%.*s ", (int)lengths[i], row[i])
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)