我正在尝试与XAMPP和MySQL服务器进行简单的连接,但每当我尝试输入数据或连接到数据库时,我都会收到此错误.
致命错误:未捕获Error:调用在C未定义函数mysql_connect()函数:\ XAMPP\htdocs中\ register.php:22
堆栈跟踪:#0 {主}扔在C:\ XAMPP\htdocs中\上线22 register.php
第22行的例子:
$link = mysql_connect($mysql_hostname , $mysql_username);
Run Code Online (Sandbox Code Playgroud) 我知道这已经被问过了。香港专业教育学院看到的问题和答案,但找不到我可以得到帮助的东西。
我正在尝试将简单数据传递到数据库中。到目前为止,一切都很好。我认为当我尝试添加userID时会出现问题,因为必须从Auth中提取该ID。所以这是我的控制器代码。
端节点,userID来自称为用户的外部表。和userID将用作外键。在userstable中称为“ id”
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ShopController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
return view('/shop/addShop');
}
protected function validator(array $data)
{
return Validator::make($data, [
'userid' => ['required', 'string', 'max:255'],
'shopname' => ['required', 'string', 'max:255'],
'address' => ['required', 'string', 'max:255'],
'postal' => ['required', 'string', 'max:255'],
'city' => ['required', 'string', 'max:255'],
'phone' => ['required', 'string', 'max:255'],
]);
}
/** …
Run Code Online (Sandbox Code Playgroud) 我试图检查文本框中的值是否在4到80之间,但我不能这样做,但它不是我需要的
final String checkage = age.getText().toString();
if(checkage.equals(4) || checkage.equals(80) ) {
Toast.makeText(this, "You must be older than 4 and younger than 80", Toast.LENGTH_SHORT).show();
return;
}
Run Code Online (Sandbox Code Playgroud)