在虚拟主机上PHP连接MYSQL
我用DW在本地编辑,测试没问题。<?phprequire_once('Connections/igey.php');mysql_query("SETNAMES'UTF8'...
我用DW在本地编辑,测试没问题。
<?php require_once('Connections/igey.php'); mysql_query("SET NAMES'UTF8'"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_igey, $igey);
$query_Recordset1 = "SELECT * FROM food";
$Recordset1 = mysql_query($query_Recordset1, $igey) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="index.css" rel="stylesheet" type="text/css" />
<link href="nav.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div id="nav"><?php include( "nav.php" ); ?></div>
<div id="content">
<div id="con_left">
<div id="row1">
<?php include( "scroll.php" ); ?>
</div>
<div id="row2">
</div>
<div class="row3"><?php include( "tab.php" ); ?>
</div>
</div>
<div id="con_right"><?php include( "login.php" ); ?><?php include( "article.php" ); ?></div>
</div>
<div id="foot"><?php include( "foot.php" ); ?></div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
上传了虚拟主机,在虚拟主机上并列:wwwroot,databases,other几个文件夹,我把index.php放在wwwroot,把在本地的数据库文件igey文件夹放在databases下(我也把.sql文件导进去了也不行),会出现以下问题:Warning: require_once(Connections/igey.php) [function.require-once]: failed to open stream: No such file or directory in D:\wwwroot\igey\wwwroot\index.php on line 1
请问应该要怎么处理? 展开
<?php require_once('Connections/igey.php'); mysql_query("SET NAMES'UTF8'"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_igey, $igey);
$query_Recordset1 = "SELECT * FROM food";
$Recordset1 = mysql_query($query_Recordset1, $igey) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="index.css" rel="stylesheet" type="text/css" />
<link href="nav.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div id="nav"><?php include( "nav.php" ); ?></div>
<div id="content">
<div id="con_left">
<div id="row1">
<?php include( "scroll.php" ); ?>
</div>
<div id="row2">
</div>
<div class="row3"><?php include( "tab.php" ); ?>
</div>
</div>
<div id="con_right"><?php include( "login.php" ); ?><?php include( "article.php" ); ?></div>
</div>
<div id="foot"><?php include( "foot.php" ); ?></div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
上传了虚拟主机,在虚拟主机上并列:wwwroot,databases,other几个文件夹,我把index.php放在wwwroot,把在本地的数据库文件igey文件夹放在databases下(我也把.sql文件导进去了也不行),会出现以下问题:Warning: require_once(Connections/igey.php) [function.require-once]: failed to open stream: No such file or directory in D:\wwwroot\igey\wwwroot\index.php on line 1
请问应该要怎么处理? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询