SlideShare a Scribd company logo
PHP-MYSQLScript
PHP FORM<?phprequire_once ('mysql/mysql_connect.php'); if (isset($_POST['submit'])) { // Handle the form. {// Add name to the database.$query = "INSERT INTO your_table (first_name) VALUES ('$first_name')";if ($result = @mysql_query ($query)) { // Worked.echo '<p>The name has been saved.</p>';} else { // If the query did not run OK.echo '<p><font color="red">Your submission could not be processed due to a system error.</font></p>'; }} else { // Failed a test.echo '<p><font color="red">Please click "back" and try again.</font></p>';}} else { // Display the form.?>
PHP FORM CONTINUATION<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><div id="content">  <h2> Add Name</h2></div><table>   <tr>    <td>First Name:</td>    <td><input type="text" name="first_name" size="30" maxlength="30" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /></td>    </tr></table><div align="center"><input type="submit" name="submit" value="Submit" /></div> </form><!-- End of Form --><?php} // End of main conditional.?>
Mysql Connect<?php// This file contains the database access information for the database. This file also establishes a connection to MySQL and selects the database. define ('DB_USER', 'root');define ('DB_PASSWORD', '');define ('DB_HOST', 'localhost');define ('DB_NAME', ''); // Make the connnection and then select the database.$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() ); // Function for escaping and trimming form data.function escape_data ($data) { 	global $dbc;	if (ini_get('magic_quotes_gpc')) {		$data = stripslashes($data);	}	return mysql_real_escape_string (trim ($data), $dbc);} // End of escape_data() function.?>
Ad

Recommended

WordPress as a Content Management System
WordPress as a Content Management System
Valent Mustamin
 
Building scalable products with WordPress - WordCamp London 2018
Building scalable products with WordPress - WordCamp London 2018
Elliot Taylor
 
Codigo principal
Codigo principal
Jhilder Atencia Montiel
 
More Php
More Php
Digital Insights - Digital Marketing Agency
 
07 Php Mysql Update Delete
07 Php Mysql Update Delete
Geshan Manandhar
 
Login and Registration form using oop in php
Login and Registration form using oop in php
herat university
 
06 Php Mysql Connect Query
06 Php Mysql Connect Query
Geshan Manandhar
 
Php tutorial
Php tutorial
Prof.Dharmishtha R. Chaudhari
 
R2 b12 función raíz cuadrada
R2 b12 función raíz cuadrada
Yussel Ruiz
 
R2 b14 función racional
R2 b14 función racional
Yussel Ruiz
 
R3 b16 trigonométricas
R3 b16 trigonométricas
Yussel Ruiz
 
Padarias normas
Padarias normas
Luis Araujo
 
R1 b6
R1 b6
Yussel Ruiz
 
R3 b15 valor absoluto
R3 b15 valor absoluto
Yussel Ruiz
 
Estrategias competitivas básicas
Estrategias competitivas básicas
LarryJimenez
 
Coding for php with mysql
Coding for php with mysql
Rajamanickam Gomathijayam
 
Php Basic Security
Php Basic Security
mussawir20
 
PHP MySQL
PHP MySQL
Md. Sirajus Salayhin
 
Introtodatabase 1
Introtodatabase 1
Digital Insights - Digital Marketing Agency
 
Download It
Download It
webhostingguy
 
Mysql
Mysql
lotlot
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
webhostingguy
 
Raj mysql
Raj mysql
firstplanet
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivity
Mouli Chandira
 
Basics of Working with PHP and MySQL.pptx
Basics of Working with PHP and MySQL.pptx
jensas21
 
4.3 MySQL + PHP
4.3 MySQL + PHP
Jalpesh Vasa
 
Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9
isadorta
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQL
kalaisai
 
SQL -PHP Tutorial
SQL -PHP Tutorial
Information Technology
 
Php 3 1
Php 3 1
Digital Insights - Digital Marketing Agency
 

More Related Content

Viewers also liked (7)

R2 b12 función raíz cuadrada
R2 b12 función raíz cuadrada
Yussel Ruiz
 
R2 b14 función racional
R2 b14 función racional
Yussel Ruiz
 
R3 b16 trigonométricas
R3 b16 trigonométricas
Yussel Ruiz
 
Padarias normas
Padarias normas
Luis Araujo
 
R1 b6
R1 b6
Yussel Ruiz
 
R3 b15 valor absoluto
R3 b15 valor absoluto
Yussel Ruiz
 
Estrategias competitivas básicas
Estrategias competitivas básicas
LarryJimenez
 
R2 b12 función raíz cuadrada
R2 b12 función raíz cuadrada
Yussel Ruiz
 
R2 b14 función racional
R2 b14 función racional
Yussel Ruiz
 
R3 b16 trigonométricas
R3 b16 trigonométricas
Yussel Ruiz
 
R3 b15 valor absoluto
R3 b15 valor absoluto
Yussel Ruiz
 
Estrategias competitivas básicas
Estrategias competitivas básicas
LarryJimenez
 

Similar to Mysql Script (20)

Coding for php with mysql
Coding for php with mysql
Rajamanickam Gomathijayam
 
Php Basic Security
Php Basic Security
mussawir20
 
PHP MySQL
PHP MySQL
Md. Sirajus Salayhin
 
Introtodatabase 1
Introtodatabase 1
Digital Insights - Digital Marketing Agency
 
Download It
Download It
webhostingguy
 
Mysql
Mysql
lotlot
 
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
webhostingguy
 
Raj mysql
Raj mysql
firstplanet
 
Ex[1].3 php db connectivity
Ex[1].3 php db connectivity
Mouli Chandira
 
Basics of Working with PHP and MySQL.pptx
Basics of Working with PHP and MySQL.pptx
jensas21
 
4.3 MySQL + PHP
4.3 MySQL + PHP
Jalpesh Vasa
 
Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9
isadorta
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQL
kalaisai
 
SQL -PHP Tutorial
SQL -PHP Tutorial
Information Technology
 
Php 3 1
Php 3 1
Digital Insights - Digital Marketing Agency
 
Database presentation
Database presentation
webhostingguy
 
Ubi comp27nov04
Ubi comp27nov04
mohamed ashraf
 
Php summary
Php summary
Michelle Darling
 
Db function
Db function
JIGAR MAKHIJA
 
The HyperText Markup Language or HTML is the standard markup language
The HyperText Markup Language or HTML is the standard markup language
Lovely Professional University
 
Ad

More from lotlot (10)

Pseudocode-Flowchart
Pseudocode-Flowchart
lotlot
 
Form Script
Form Script
lotlot
 
Mysql Aggregate
Mysql Aggregate
lotlot
 
Php Form
Php Form
lotlot
 
Php Loop
Php Loop
lotlot
 
Php Condition Flow
Php Condition Flow
lotlot
 
Php-Continuation
Php-Continuation
lotlot
 
Hariyali - India
Hariyali - India
lotlot
 
The Province Of Davao Oriental
The Province Of Davao Oriental
lotlot
 
Annual Review
Annual Review
lotlot
 
Pseudocode-Flowchart
Pseudocode-Flowchart
lotlot
 
Form Script
Form Script
lotlot
 
Mysql Aggregate
Mysql Aggregate
lotlot
 
Php Form
Php Form
lotlot
 
Php Loop
Php Loop
lotlot
 
Php Condition Flow
Php Condition Flow
lotlot
 
Php-Continuation
Php-Continuation
lotlot
 
Hariyali - India
Hariyali - India
lotlot
 
The Province Of Davao Oriental
The Province Of Davao Oriental
lotlot
 
Annual Review
Annual Review
lotlot
 
Ad

Recently uploaded (20)

Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Improving Data Integrity: Synchronization between EAM and ArcGIS Utility Netw...
Safe Software
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 

Mysql Script

  • 2. PHP FORM<?phprequire_once ('mysql/mysql_connect.php'); if (isset($_POST['submit'])) { // Handle the form. {// Add name to the database.$query = "INSERT INTO your_table (first_name) VALUES ('$first_name')";if ($result = @mysql_query ($query)) { // Worked.echo '<p>The name has been saved.</p>';} else { // If the query did not run OK.echo '<p><font color="red">Your submission could not be processed due to a system error.</font></p>'; }} else { // Failed a test.echo '<p><font color="red">Please click "back" and try again.</font></p>';}} else { // Display the form.?>
  • 3. PHP FORM CONTINUATION<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><div id="content"> <h2> Add Name</h2></div><table> <tr> <td>First Name:</td> <td><input type="text" name="first_name" size="30" maxlength="30" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /></td> </tr></table><div align="center"><input type="submit" name="submit" value="Submit" /></div> </form><!-- End of Form --><?php} // End of main conditional.?>
  • 4. Mysql Connect<?php// This file contains the database access information for the database. This file also establishes a connection to MySQL and selects the database. define ('DB_USER', 'root');define ('DB_PASSWORD', '');define ('DB_HOST', 'localhost');define ('DB_NAME', ''); // Make the connnection and then select the database.$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() ); // Function for escaping and trimming form data.function escape_data ($data) { global $dbc; if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } return mysql_real_escape_string (trim ($data), $dbc);} // End of escape_data() function.?>