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.

Did you know?Explore Trending and Topic pages for more stories like this.
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

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

How to read CSS message data
Hi,
I have a requirement here. When working as a Dev angel for multiple customers its really di

Converting from one format to another
"I have got a date in DD/MM/YYYY but I need it in MM-DD-YYYY. Help!"

Check if another session of the page is running?
I want to keep people from opening multiple tabs, or sessions of my Facebook app. Is it possible to

Java API in PHP?
I have an application that we use internally here at the office.

The software company provide

GET vs SUBMIT Button to show sections on one index.php page?
Just curious if one of these ways is better (i.e. more efficient) than the other.

I have a

Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make

SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

Preventing SQL Injection
I have a question about SQL Injection, In some of our code we use this: view plaincopy to clipboa

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