help with insert


Posted on 16th Feb 2014 07:03 pm by admin

Hi there,

I am trying to insert some data into a database, but for some reason, it is not inserting.

Can anyone see anything wrong with my code:


<?php

$host = "***";
$username = "***";
$password = "***";


$connection = mysql_connect($host, $username, $password);
mysql_select_db("***, $connection");

mysql_query("INSERT INTO events14 (name)
VALUES ('$_POST[name]')");

?>


I have also set up an ID field which auto increments and this seems to be working, but nothing is being entered into the "name" field.

This is my form:


<form action="add_event.php" method="post">
<input type="text" name="name" id="textfield" />
<input type="submit" name="button" id="button" value="Submit" />
</form>



The file with the php code is called add_event.php, so everything is on one page.

Any ideas what I have wrong

No comments posted yet

Your Answer:

Login to answer
241 Like 17 Dislike
Previous forums Next forums
Other forums

duplicate record notification
In my database, after insertion of records, I want to know if the record inserted is duplicate or no

Backflush
I am looking for a report in SAP that would give me a list of all parts that are populated with a ba

help with contest script
I would like to code a contest script to my site but i don't know how. Could someone just give me pu

$_FILES array
Ok,

I just started experimenting with PHP today. My goal right now is to have people be able

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and ex

Dynamically allocating the number of rows in a table based on a variable value
Hi,
I have situation here which i cannot resolve, I have a variable temp which stores the num

PHP header help!
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 48

Get to know your fellow coder
I think it's time we got personal around here. There's a lot of code swapping and a few members kno

captcha error
I have been trying to implement a captcha in php...

here is the code..
Code: (php) [Select

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash