问两个初级问题,希望帮忙,明天一定结贴!

时间:2023-01-12 19:51:47
1/ 连接数据库的问题, PHP Warning:  mysql_connect(): Access denied for user: 'zsw@localhost' (Using password: YES) in e:\my web\test.php on line 9 我服务器:文化中心(机器名),数据库dbs中用户有 zsw,并且密码也是,就是连接不上, 数据库用的sql server,连接代码如下:
    $mysql_database = "zwww";
    $mysql_user     = "zsw";
    $mysql_password = "zsw";
    $mysql_host     = "127.0.0.1";

    /* 连接选择数据库 */
    $link = mysql_connect ($mysql_host, $mysql_user, $mysql_password)
        or die ("Could not connect(无法连接数据库)");
2 zen怎么在同一个网页中,根据不同的按钮,进入不同的处理页面中
如按钮有:1增加  对应 aa.php 2 详细内容bb.php 3 查询 cc.php

3\  我下面的代码为什么打不开adok.php<<center>
<fieldset>
<legend>添加服务中心</legend>
<table cellspacing="0" cellpadding="0" style="margin: 5px;">
<tr><td colspan="2" height=20></td></tr>
<form>
<div align="center">
<center><form action="adok.php" name="form1" method="POST" >

<tr>
<td align="right">省:</td>
<td>
<input type="text" name="sheng" class="textInput" maxlength="6" style="width:20;"> </td>

<tr>
<td align="right">服务机构总人数</td>
<td>
<input type="text" name="zrs" class="textInput" style="width: 80;">
</td>
</tr>

<tr><td colspan="2" height=8></td></tr>
<input type="submit"  name='rd1' value="添加">
//<input type="button"  name='rd2' value='详细人员状况' onClick="reg()" >//    这里怎么打开xxry.php
</td></tr>
</form>
</table>
</fieldset>
</center>
</div>
</body>
谢谢各位!!

5 个解决方案

#1


数据库用的sql server
------------
拜托,用mssql_函数去连,不要用mysql

#2


1、既然是“数据库用的sql server”,那么怎么用mysql的函数呢?

2、
switch($_POST['按钮对象名']) {
  case "1增加":
    include "aa.php";
    break;
  case "2 详细内容":
    include "bb.php";
    break;
  case "3 查询":
    include "cc.php";
    break;
  default:
    echo "请选择...";
}

#3


前两个问题都解决了,我就回答第三个吧:
代码:
<script language="JavaScript">
function reg(){//打开xxry.php;
window.location.href="xxry.php";
}
</script>
<fieldset>
<legend>添加服务中心</legend>
<table cellspacing="0" cellpadding="0" style="margin: 5px;">
<tr><td colspan="2" height=20></td></tr>
<form action="adok.php" name="form1" method="POST" >

<tr>
<td align="right">省:</td>
<td>
<input type="text" name="sheng" class="textInput" maxlength="6" style="width:20;"> </td>
<tr>
<td align="right">服务机构总人数</td>
<td>
<input type="text" name="zrs" class="textInput" style="width: 80;">
</td>
</tr>

<tr><td colspan="2" height=8></td></tr>
<input type="submit"  name='rd1' value="添加">
<input type="button"  name='rd2' value='详细人员状况' onClick="reg();" >//    这里怎么打开xxry.php
</td></tr>
</form>
</table>
</fieldset>
</body>


#4


1\告诉我无法连接服务器127.0.0.1
3 不能打开addok.php

希望高手指点,mssql上面写法有什么错误??

等待中

#5


数据库用的sql server,但是你用的数据库操作函数都是MYSQL的。。。。会不出错吗?

#1


数据库用的sql server
------------
拜托,用mssql_函数去连,不要用mysql

#2


1、既然是“数据库用的sql server”,那么怎么用mysql的函数呢?

2、
switch($_POST['按钮对象名']) {
  case "1增加":
    include "aa.php";
    break;
  case "2 详细内容":
    include "bb.php";
    break;
  case "3 查询":
    include "cc.php";
    break;
  default:
    echo "请选择...";
}

#3


前两个问题都解决了,我就回答第三个吧:
代码:
<script language="JavaScript">
function reg(){//打开xxry.php;
window.location.href="xxry.php";
}
</script>
<fieldset>
<legend>添加服务中心</legend>
<table cellspacing="0" cellpadding="0" style="margin: 5px;">
<tr><td colspan="2" height=20></td></tr>
<form action="adok.php" name="form1" method="POST" >

<tr>
<td align="right">省:</td>
<td>
<input type="text" name="sheng" class="textInput" maxlength="6" style="width:20;"> </td>
<tr>
<td align="right">服务机构总人数</td>
<td>
<input type="text" name="zrs" class="textInput" style="width: 80;">
</td>
</tr>

<tr><td colspan="2" height=8></td></tr>
<input type="submit"  name='rd1' value="添加">
<input type="button"  name='rd2' value='详细人员状况' onClick="reg();" >//    这里怎么打开xxry.php
</td></tr>
</form>
</table>
</fieldset>
</body>


#4


1\告诉我无法连接服务器127.0.0.1
3 不能打开addok.php

希望高手指点,mssql上面写法有什么错误??

等待中

#5


数据库用的sql server,但是你用的数据库操作函数都是MYSQL的。。。。会不出错吗?