1、%s 格式化成一个串。见手册printf一节
2、没有现成的
类似于ODBC函数库的odbc_result_all函数,调试mysql应用很有用的。function mysql_result_all($result,$format="") {
echo "<table $format><tr>";
for($i=0;$i<mysql_num_fields($result);$i++) {
echo "<th>".mysql_field_name($result,$i)."</th>";
}
echo "</tr>";
while($row = mysql_fetch_row($result)) {
echo "</tr>";
for($i=0;$i<mysql_num_fields($result);$i++) {
echo "<td>".$row[$i]."</td>";
}
echo "</tr>";
}
echo "</table>";
}
2、没有现成的
类似于ODBC函数库的odbc_result_all函数,调试mysql应用很有用的。function mysql_result_all($result,$format="") {
echo "<table $format><tr>";
for($i=0;$i<mysql_num_fields($result);$i++) {
echo "<th>".mysql_field_name($result,$i)."</th>";
}
echo "</tr>";
while($row = mysql_fetch_row($result)) {
echo "</tr>";
for($i=0;$i<mysql_num_fields($result);$i++) {
echo "<td>".$row[$i]."</td>";
}
echo "</tr>";
}
echo "</table>";
}
b - the argument is treated as an integer, and presented as a binary number.
c - the argument is treated as an integer, and presented as the character with that ASCII value.
d - the argument is treated as an integer, and presented as a (signed) decimal number.
u - the argument is treated as an integer, and presented as an unsigned decimal number.
f - the argument is treated as a float, and presented as a floating-point number.
o - the argument is treated as an integer, and presented as an octal number.
s - the argument is treated as and presented as a string.
x - the argument is treated as an integer and presented as a hexadecimal number (with lowercase letters).
X - the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters).
<?
if ($username == "" || $userpass == "")
{
echo "请填入用户名和密码!";
}
else
{
$add = mysql_query(insert into table temp(id,name,pass) valus("","$username","$userpass"));
}
?>
在这段语句前已经能保证连接上数据库了,,2个文本框的名字分别是username和userpass
表中的字段是id,name,pass
if ($username == "" || $userpass == "")
{
echo "请填入用户名和密码!";
}
else
{
$add = mysql_query(insert into temp(name,pass) values("$username","$userpass"));
}
?>
这个怎么不行?怎么往数据库加数据?
<?
if ($username == "" || $userpass == "")
{
echo "请填入用户名和密码!";
}
else
{
$add = mysql_query(insert into table temp(id,name,pass) valus("","$username","$userpass"));
}
?>
在这段语句前已经能保证连接上数据库了,,2个文本框的名字分别是username和userpass
表中的字段是id,name,pass
if ($username == "" || $userpass == "")
{
echo "请填入用户名和密码!";
}
else
{
$add = mysql_query("insert into temp(name,pass) values('$username','$userpass')");
}
?>
$add = mysql_query(insert into table temp(id,name,pass) valus("","$username","$userpass"));
mysql_query的第一个参数是串
中文手册最好到www.phpe.net去看在线的
我的意思是在加如数据时,只要一列中有一个字段增加,那这列的ID是不是也自动增加呢?
<?
if ($username == "" || $userpass == "")
{
echo "请填入用户名和密码!";
}
else
{
$add = mysql_query("insert into temp values(null,'$username','$userpass')");
}
?>
{
echo "请填入用户名和密码!";
}
else
{
if($name==$username)
{
echo "该用户名已经被使用";
}
else
{
$add = mysql_query("insert into temp(name,pass) values('$username','$userpass')");
echo "信息增加成功!"
}
}检测注册时的用户名是不是已经存在能这样吗?我怎么不能运行?
我也不知道学PHP改怎么学,只能一点点弄,想起什么就问什么