Go Back   Web Server Hosting Forum by BODHost > Support > MySQL Issues.
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-03-07, 10:35
BOD Member
 
Join Date: Nov 2005
Posts: 131
Default How to insert Data into MySQL Database?

It is mainly done through mysql_query().


The following will add a new <a href="http://www.bodhosting.com/ " target="_blank" title=" MYSQL " style="color:#000000;text-decoration:none;">MYSQL</a> user by inserting a new row into table user in MySQL Database -

include 'library/config.php';
include 'library/opendb.php';

mysql_select_db($mysql);
$query = "INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y')";

mysql_query($query) or die('Error, insert query failed');

$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');

include 'library/closedb.php';
?>

Cheers
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 02:22.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.