[英]Upload database without Cpanel
I have completed a WordPress project(localhost) and uploaded to web using core FTP LE.The issue is I am not getting any cpnael detail from the client to to import the database which I created in Localhost...Is there any way to proceed ?[Tried in google but did not find suitable solution]I am getting error 我已经完成了一个WordPress项目(localhost),并使用核心FTP LE上传到Web。问题是我没有从客户端获取任何cpnael详细信息来导入我在Localhost中创建的数据库...有什么方法可以进行?[在Google中尝试过,但找不到合适的解决方案]我遇到了错误
Error establishing a database connection probably bcaz of that
建立数据库连接时出错,可能是bcaz
Note:I received only FTP details and Database details.But did not get cPanel detail 注意:我仅收到FTP详细信息和数据库详细信息,但未获取cPanel详细信息
Kindly do help me.Thanks in Advance.. 请帮我。谢谢提前。
You can run this code on server attach the file and here you go with import. 您可以在服务器附加文件上运行此代码,然后在此处进行导入。
<html>
<head>
<style type="text/css">
body {
background: #E3F4FC;
font: normal 14px/30px Helvetica, Arial, sans-serif;
color: #2b2b2b;
}
a {
color:#898989;
font-size:14px;
font-weight:bold;
text-decoration:none;
}
a:hover {
color:#CC0033;
}
h1 {
font: bold 14px Helvetica, Arial, sans-serif;
color: #CC0033;
}
h2 {
font: bold 14px Helvetica, Arial, sans-serif;
color: #898989;
}
#container {
background: #CCC;
margin: 100px auto;
width: 945px;
}
#form {padding: 20px 150px;}
#form input {margin-bottom: 20px;}
</style>
</head>
<body>
<div id="container">
<div id="form">
<?php
include "inc/database.php"; //Connect to Database
//Upload File
if (isset($_POST['submit'])) {
if (is_uploaded_file($_FILES['filename']['tmp_name'])) {
echo "<h1>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "</h1>";
echo "<h2>Displaying contents:</h2>";
readfile($_FILES['filename']['tmp_name']);
}
//Import uploaded file to Database
$handle = fopen($_FILES['filename']['tmp_name'], "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$import="INSERT into awards (award_name, award_level, award_description, award_photo) values('$data[0]','$data[1]','$data[2]','$data[3]')";
mysql_query($import) or die(mysql_error());
}
fclose($handle);
print "Import done";
//view upload form
}else {
print "Upload new csv by browsing to file and clicking on Upload<br />\n";
print "<form enctype='multipart/form-data' action='import-award.php' method='post'>";
print "File name to import:<br />\n";
print "<input size='50' type='file' name='filename'><br />\n";
print "<input type='submit' name='submit' value='Upload'></form>";
}
?>
</div>
</div>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.