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["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?

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

Ads









Related Tutorials/Questions & Answers:
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
Advertisements
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 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
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
ftp connection error php
ftp connection error php  Getting a ftp connection error in php
Upgrading a PHP/MYSQL application?
Upgrading a PHP/MYSQL application?  Upgrading a PHP/MYSQL application
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
php form post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
connection with MySQL to java.
connection with MySQL to java.   how to connect MySQL database with jsp
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
PHP MYSQL Interview Questions
PHP MYSQL Interview Questions  What kind of questions can be asked in an PHP, MYSQL interview? Can anyone post the PHP interviews questions with well explained answers?   PHP, MYSQL Interview Questions Please tell me
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
drop down php mysql - PHP
drop down php mysql  PHP Script required to show the similar drop down item in each menu without refreshing the page. Is it possible if yes how
Import MYSQL file in PHP - PHP
Import MYSQL file in PHP  i wanted to import the mysql file in PHP5 on button click. is it possible to do it? Is there any possibility of data security
php mysql fetch array example
php mysql fetch array example  How to fetch data from mysql and store it into an array in PHP? Please post an example. Thanks in Advance
php mysql web application tutorial
php mysql web application tutorial  How to create a simple php mysql web application? Please post an example or tutorial
login page php mysql example
login page php mysql example  How to create a login page for user in PHP Mysql? Please provide me a complete tutorial. Thanks in Advance
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
PHP Mysql Group By
PHP Mysql Group By       PHP Mysql Group By is used to establish a relation between the PHP... The Tutorial illustrate an example from PHP Mysql Group By. To understand and grasp
Mysql PHP Select
Mysql PHP Select       Mysql PHP is used to execute the select statement using mysql_query ( ) function. The function send a query or command to a MySQL connection
SQL PHP
; Mysql database. Once the connection is built, PHP server side scripting.... The function is used to send a query or command to a MySQL connection. Understand...;; $database = "komal"; $connection = mysql_connect($host,$user,$password
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
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using mysql
MySQL PHP Insert
MySQL PHP Insert       Mysql PHP Insert is used to execute the Mysql function ( ) insert.... Understand with Example The Tutorial illustrate an example on MySQL PHP Insert
sql php code
; SQL PHP code executes the statement using the mysql_query ( ) function. The function is used to send a query or command to a MySQL connection. Understand.... Once the connection is built, PHP server side scripting is used to execute
how to post data in mysql php form
how to post data in mysql php form  how to post data in mysql php form
Charset problem upon publishing PHP + MySQL website
Charset problem upon publishing PHP + MySQL website  Charset problem upon publishing PHP + MySQL website
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
return all rows mysql php
return all rows mysql php  How to find or return results that are not available in another table .. using join method in PHP and MYSql.   SELECT * FROM Declined LEFT JOIN Request ON Declined.RequestID
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
PHP MySQL on Centos 5.x
PHP MySQL on Centos 5.x This Tutorial show you how to install MySQL support... MySQL support into your php application. In this tutorial I will show you how you can install MySQL support and install using MySQL database from your php
how to connect to database in php using mysql
how to connect to database in php using mysql  how to connect to database in php using mysql
PHP Chat Systems A MySQL Driven
PHP Chat Systems A MySQL Driven Chat Script Tutorial This article will show you how to create a simple chat script using PHP and MySQL database...; <?php $link=mysql_connect("localhost","root","
PHP MySQL Connect to a Database
PHP MySQL Connect to a Database:       In WAMP software stack, php and mysql are bundled together and we can use... with MySQL server. Following piece of code will help you to check whether your PHP
Todd oracle DB connection through PHP
Todd oracle DB connection through PHP  Can u please explain how to connect Todd oracle DB using PHP & What are the setups we need to perform? Thanks
php loging form connecitivity with mysql
php loging form connecitivity with mysql  my loging form is not connect
Why are MySQL Routines and Views not used with PHP?
Why are MySQL Routines and Views not used with PHP?  I've been looking at a number of web sites, frameworks, and scripts written in PHP and noticed NONE of them make use of MySQL Views or Routines. Alarmingly very very few even
MySQL PHP Query delete
MySQL PHP Query delete       Mysql PHP Query delete is used to execute Mysql function ( ) delete query from a database table. MySQL PHP Query is used to delete the records
Mysql PHP Where
Mysql PHP Where       Mysql PHP Where is used to insert the records from database and print... The Tutorial illustrate an example from 'Mysql PHP Where'. To understand and grasp
MySQL PHP Query delete
MySQL PHP Query delete       Mysql PHP Query delete is used to execute Mysql function ( ) delete query from a database table. MySQL PHP Query is used to delete the records
Fetch the data from mysql and display it on php form
Fetch the data from mysql and display it on php form  when i press on login button, after succesful login the related data of that person should be display in other textbox
MySQL PHP Update
MySQL PHP Update       MySQL PHP Update uses mysql_update function ( ) that is used to update... The Tutorial illustrate an example from 'MySQL PHP Update'. To understand and grasp
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

Ads