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

gmdate() - want 1 hr before time
Hi,
I am using php gmdate().
Now I am entering all dates in my dbase using gmdate("Y-m-d

Got A Free Server :(
So I was given a free server

http://shopping.yahoo.com/p:Compaq%20ProLiant%201500%20Server:1

Array help
Hello i got this code to fetch data from database but it is not working it displays
7
Array

TemplatePower & AJAX
Hi all,



I'm currently implementing some AJAX features in my PHP-framework (which is b

Php WordPress help
I am writing the following code for making a plugin

<?php
header("Content-Type

matching numbers inside ( )
I know I can match numbers by just [0-9]+, so I thought matching numbers inside ( ) would be somethi

PHP Multiples of 2, Show posts...not working (wordpress)
I have been using this code to show div.example with 6 li columns inside it, each li is a post with

php mysql query from input textbox
Hi,

I have a text box, in that i have given the mysql query. I can able to get the query in v

Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :

Simple AND question
Hello,

I've got following code:

Code: if(strpos($row[13],"http://")

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