Share on Google+Share on Google+

Rohan Dua
connection of php to MySQL.
2 Answer(s)      3 years and 6 months ago
Posted in : PHP

I have a query on connection of php to MySQL. Website's serverspace by godaddy and provides phpmyadmin(interface of MySQL) for Database

I have a page admin.php

<?php
if (isset($_POST["submitted"]))
{
include('connect-mysql.php');
$username=$_POST['username'];
$password=$_POST['password'];
$sqlinsert="INSERT INTO adminlogin (username,password) VALUES ('$username','$password');";
if(!mysqli_query($link,$sqlinsert))
{
die('error in inserting data');
}
$newrecord="1 record updated in database";
}
?>
<html>
<form action="admin.php" method="post" id="admin-login">    
          <input type="hidden"    name="submitted" value="true"/>
                        <fieldset>
<td><span class="text-form">Username:<td><input name="username" type="text" /></td>
<td><span class="text-form">Password:</span></td>
<td><input name="password" type="text" /></td>                             
    <div class="buttons">
      <a href="#" onclick="document.getElementById('admin-login').reset()">Clear</a>
     <a href="#" onclick="document.getElementById('admin-login').submit()">Send</a>

</form>

<?php
echo $newrecord
?>
</html>  

According to this code on clicking the send button should call the above written php code, make the connection and run the query..

Connection is made perfectly 'connect-mysql.php' but the data is not getting inserted into the table(in phpmyadmin).

Can u give a resolution on this?

Ads

View Answers

September 22, 2013 at 5:22 PM


Hi,

Please check the tutorial Check PHP MySQL Connectivity.

Thanks



September 23, 2013 at 8:58 PM


Hey as i mentioned i am able to make an connection. But I was not able to fetch and insert data from/to the database and also i am using mysqli version










Related Tutorials/Questions & Answers:
secure php mysql connection
secure php mysql connection  secure php mysql connection script
MySql PHP Connection String - PHP
MySql PHP Connection String  i need a MySql PHP Connection String, is it possible to do pooling in between
Advertisements
connection of php to MySQL.
connection of php to MySQL.  I have a query on connection of php to MySQL. Website's serverspace by godaddy and provides phpmyadmin(interface of MySQL) for Database I have a page admin.php <?php if (isset($_POST
PHP Mysql Database Connection
PHP Mysql Database Connection       PHP Mysql Database Connection is used to build a connection... The Tutorial illustrate an example from PHP Mysql Database Connection
connection in php
connection in php  <?php include("include/db.php"); ?> <...;categories</div> <ul id="cate"> <?php $get_cate="select * from categories"; $run_cate= mysql_query($con
connection in php
connection in php  <?php include("include/db.php"); ?> <...;categories</div> <ul id="cate"> <?php $get_cate="select * from categories"; $run_cate= mysql_query($con
connection in php
connection in php  <?php include("include/db.php"); ?> <...;categories</div> <ul id="cate"> <?php $get_cate="select * from categories"; $run_cate= mysql_query($con
PHP SQL Connection
PHP SQL Connection       PHP SQL Connection is used to access and return the records from PHP... the host, user, password and database that connects the PHP server side to MySQL
connection with MySQL to java.
connection with MySQL to java.   how to connect MySQL database with jsp
ftp connection error php
ftp connection error php  Getting a ftp connection error in php
connection to mysql in jsp
connection to mysql in jsp  please i got this error message when trying to connect to mysql database in jsp. Unknown character set: 'utf8mb4
PHP SQL close connection
PHP SQL close connection       PHP SQL close connection is used to close a connection between the PHP... 'PHP SQL close Connection'. To understand and grasp the example we include
DriverClass hibernate mysql connection.
DriverClass hibernate mysql connection.  What is DriverClass in Hibernate using mysql connection?   DriverClass implements java.sql.Driver.... the connection url as- <property name="connection.url">jdbc:mysql://localhost
jsp/mysql connection
jsp/mysql connection  I am puttng the following files in the lib folder of jdk to connect jsp and mysql and in the lib folder of tomacat and in the lib folder of project of netbeans but I am unable to to connect jsp and mysql
jsp/mysql connection
jsp/mysql connection  I am puttng the following files in the lib folder of jdk to connect jsp and mysql and in the lib folder of tomacat and in the lib folder of project of netbeans but I am unable to to connect jsp and mysql
php mysql
php mysql  automatically insert a value in the month field at the last date of current month in mysql database
php mysql
php mysql  automatically insert a value in the month field at the last date of current month in mysql database
JSP - MySQL - Connection
JSP - MySQL - Connection  I can't connect mysql using jsp in my... to resolve this problem.I set classpath for the mysql connector jar (/home/aghiltu/apache-tomcat-6.0.26/lib/mysql-connector-java-5.1.8-bin.jar)..... And i also tried
connection of jsp with mysql - JSP-Servlet
Example of connection between JSP and MYSQL  Need an example of connection between JSP and MYSQL
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using mysql
why php and mysql - PHP
why php and mysql  I noticed in most of the application that developer always use mysql with PHP. Why they do so,, as there are money other database are too available
connection of jsp with mysql - JSP-Servlet
connection of jsp with mysql  can anybody tell me about connection of JSP with MYSQL? and also tell me which version is compatible with tomcat 4.1 i am using tomcat 4.1, MYSQL 5.0 but i have problem with connection
Upgrading a PHP/MYSQL application?
Upgrading a PHP/MYSQL application?  Upgrading a PHP/MYSQL application
connection with mysql with jstl - JSP-Servlet
connection with mysql with jstl  hi, i m working on jstl . i hv done connection in MS -Access with JSTL . The code is working well. but when i am trying to connect database with mysql 5.0 it is creating problem. Plz tell me
enum php mysql
enum php mysql  How to use mysql enum in php
MySQL Connection String
MySQL Connection String       This section gives you brief description of MySQL connection string. For the connection in mysql, we need some information about database like server
php form post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
ide php mysql
ide php mysql  what is ide for php and mysql   Hi, You can use Eclipse to develop your PHP project. The easist way is to download the Eclipse having PHP support from eclipse download site. The Eclipse PHP plugin
Mysql-Php code
Mysql-Php code  I want to mysql script for query data from two tables in the mysql database trough php code. Can you help me   Hi Friend, Please visit the following link: Php Mysql Thanks   Hi Friend
PHP MySQL query
PHP MySQL query  I have 11 tables and have to do the CRUD operations keeping userid as a reference key
php inserting date into mysql
php inserting date into mysql  php inserting date into mysql   Here is a php code that inserts date into mysql database. In the given code, data is a database table. <?php table $query_manual = "INSERT INTO data
Tutorials   
Java Spring Hibernate Struts Training I am Java programmer. Should I learn Java Script or Python? Delete multiple records with pagination by selecting checkboxes How to add one hour in php date? connection in php connection in php connection in php PHP magento how to make previous and next Button Display Data in php session written exam display database results question create a simple form Magento Strings in PHP Zend Framework Installation in xampp? How to prevent adding duplicate items to the shopping cart php problem maximum execution time of 30 seconds exceeded in php Call-time pass-by-reference has been removed in HTTP_POST_VARS is deprecated $_GET[] index is not defined Function mysql_db_query() is deprecated Function mysql_db_query() is deprecated Function split() is deprecated Fatal error: Call to undefined function session_register() in .php file php tag not working Error reporting in PHP Why are MySQL Routines and Views not used with PHP? How to add Click to copy function to my wordpres blog? connection of php to MySQL. loan calculator Datepicker not getting called through include function of php change url string integrate login in php Installation of wamp server Display PHP clock with user input date and time value in div from php, reloading form pre-populate form developing a system using php n mysql Configure apache Tomcat to work with Eclipse and PDT in php How to display a file for 24 hours? LOGIN ERROR LOGIN FAILED", $_SESSION['login fail']='0',}?> I GOT ERROR FOR MY PROJECT PHP Sending emails and insert into trable Tutorial college Student Admission System PLZ HELP ME. i need php code.

Ads

 
Advertisement null

Ads