Skip to forum content
Code The World
We are a group of graphic designers and web developers trying to create a social network for the people, and not for the commercialization of said social network.
You are not logged in. Please login or register.
Pages 1
You must login or register to post a reply
- Registered: 2007-11-19
- Posts: 12
Topic: Add data to a MySQL database
Description
How to insert and save information into a MySQL database table using PHP.
The code
<?php
/**
* Change the first line to whatever
* you use to connect to the database.
*
* We're using two values, title and
* text. Replace these with whatever
* you want to add to the database.
*
* Finally, change tablename to the
* name of your table.
*/
// Your database connection code
db_connect();
$query = "INSERT INTO tablename(title, text) VALUES('$title','$text')";
$result = mysql_query($query);
echo "The data has been added to the database.";
?>
Posts: 1
Pages 1
You must login or register to post a reply
Powered by PunBB, supported by Informer Technologies, Inc.
Currently used extensions: pun_admin_manage_extensions_improved, pun_poll, pun_quote, pun_bbcode, pun_repository, pun_tags, pun_admin_add_user, google_analytics, pun_eggdrop, pun_recaptcha.
Copyright © 2007 - 2025 CodeTheWorld