通过php连接到mySQL [英] Connecting to mySQL through php

查看:80
本文介绍了通过php连接到mySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$name = $_GET['txtName'];
	$email = $_GET['txtEmail'];
	$phone = $_GET['txtPhone'];
	$message = $_GET['txtMessage'];
	
	$host = 'localhost';
	$user = 'root';
	$password = '07E41A0516';
	$dbSelect = 'gcmas';
	echo $dbc = mysqli_connect($host, $user, $password) or die('Error connecting to database server');
	
	echo $db = mysql_select_db($dbSelect) or die('Database Not Selected');
	
	echo $query = "INSERT INTO enquiryform (Name, EmailID, Phone, Message) VALUES ('$name', '$email', '$phone', '$message');";
	
	echo $result = mysql_query($query, $db) or die( 'Error queriying database'.mysql_error() );
	
	mysql_close();





我得到''未选择数据库 ''错误请帮忙...



我试了很多页面代码是一样但是它在我的xampp服务器上没有...



I am getting ''Database Not Selected'' error please help...

I tried a lot pages the code is the same but it''s not working in my xampp server...

推荐答案

name =
name =


_GET [' < span class =code-string> txtName'];
_GET['txtName'];


email =
email =


这篇关于通过php连接到mySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆