我有一个项目正在准备中,我正在将解决方案放在USB闪存上,以便在学校PC上传输它,以向教授展示,该应用程序使用标准的Access数据库,我的问题是我应该如何运行?在学校PC上运行应用程序而无需通过代码修改连接?它如何始终保持连接状态?
<?php
$server="localhost";
$username ="root";
$password ="";
$database ="you_database";
$connection =mysqli_connect($server ,$username ,$password,$database); //start connection
if ($connection==TRUE) // test connection
{
echo "connected succefull";
}
if (isset($_POST['submit'])) //test submit name in form
{
// declare parameter to initialized in text fild in form
// and those fild should appear in serve (apache mysql)
$username =$_POST['username'];
$lastname =$_POST['lastname'];
$query ="INSERT INTO your_table VALUES(NULL, '$username' ,'$lastname' ");
$result =mysqli_query($connection ,$query);
if ($result == TRUE) {
echo "data insert succefull";
}else{
echo "failed to insert";
}
}
mysqli_error($connection);
?>
这是我用于运行查询和打开连接的类,可能对您有用
感谢您的帮助!