I am using the following code. Why it does not insert record in the MySQL Table through php script: -
<?php
-
$dbhost='localhost';
-
$dbuser='root';
-
$dbpass='newpass';
-
$mysqldb='mysql';
-
-
if(isset($_POST['add'])){
-
-
$username=$_POST['username']; // echo test for $username is OK
-
$password=$_POST['password']; // echo test for $password is OK
-
-
$conn=mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting MySQL'); mysql_select_db($mysqldb) or die ('Error connecting database');
-
-
$query = "INSERT INTO user (host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', '$username', PASSWORD ('password'), 'Y', 'Y', 'Y')";
-
-
//more code to close database and html form
-
?>
Plz help me regarding this.
Regards
2 2140 pbmods 5,821
Recognized Expert Expert
Heya, Servo.
You need to execute your query using mysql_query().
Please use CODE tags when posting source code:
[CODE=php]
PHP code goes here.
[/CODE]
pbmods 5,821
Recognized Expert Expert
While you're at it, check out this article for more information on creating MySQL User accounts.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jack |
last post by:
I have a text file of data in a file (add2db.txt) where the entries are
already entered on separate lines in the following form:
INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere.
Good food.", " (Harry Houdini - 03/01/2004)");
INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada",
" (Herbert Hoover - 03/03/2004)");
INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
|
by: Alexander Newald |
last post by:
------=_NextPart_000_003E_01C34934.FBC032B0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Hello,
I'm looking for a solution to write a sql query that inserts a set of =
data if the data id is not present and otherwise update the set.
|
by: Randell D. |
last post by:
Folks,
I have a table of addresses and a seperate table with contact names -
All addresses tie to one or more names - I would like to keep track of
the number of names 'belonging' to an address and have thus included a
column in my address table called num_of_contacts. Everytime I add a
new contact, I would like to increment the num_of_contacts column in the
address table.
Is this possible?
|
by: Rajesh Kapur |
last post by:
I have a master slave configuration on linux machines running MySQL 4.0.21.
Once every hour, a process deletes about 9000 rows and re-inserts fresh data
on the master. The master process completes processing under a minute. The
updates arrive on the slave within seconds. However, the slave takes about
15-20 minutes to post the same updates. Both master and slave have InnoDB
tables. The master and the slave are almost identical in capacity...
|
by: Python_it |
last post by:
Python 2.4
MySQL-python.exe-1.2.0.win32-py2.4.zip
How can I insert a NULL value in a table (MySQL-database).
I can't set a var to NULL? Or is there a other possibility?
My var must be variable string or NULL.
Becaus i have a if statement:
if ....
cursor.execute(".................insert NULL ..............")
if ....
| |
by: David Eades |
last post by:
Hi all
Complete newbie here, so apologies if this is the wrong forum.
I've been asked to use mysql and asp to make a simple bidding system (rather
like a simple ebay), whereby users can use a web browser to view a highest
bid and can make a bid.
My question is; how can I be sure that when a user submits a bid, that
another user isn't also currently submittimg a bid, i.e i can tell user A
|
by: Bonzol |
last post by:
Hello, PHP n00b here.
Using SQL just working off some examples, I have no problem selecting
data, but I cant seem to be able to insert. If someone could see where
im going wrong
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
|
by: Ben |
last post by:
I don't know whether anyone can help, but I have an odd problem. I have
a PSP (Spyce) script that makes many calls to populate a database. They
all work without any problem except for one statement.
I first connect to the database...
self.con = MySQLdb.connect(user=username, passwd =password)
self.cursor = self.con.cursor()
self.cursor.execute("SET max_error_count=0")
|
by: dongletran06 |
last post by:
Hi,
Please help me find out what wrong with my codes in inputting from my form to mysql database using drop down menu. Below is the codes I used. Only the drop down is not working but the "input text" are successfully adding data to mysql. I just try first using the month as drop down. The month data type I used in mysql database is varchar. Im new in PHP please help me. Thanks
<?php /* Created on: 10/12/2006 */ ?>
<html>
<body>
<?php...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |