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

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo

Files in current folder. Should be an easy fix.
Never mind. I've asked about this before and just found my answer. Anyway to delete this?

mysql VARCHAR acting like INT
Hi, All.

I have a table that contains a varchar(10) column named weird_field. In this column

private constructor
Hello,

Can we create a constructor as private? If yes, what is the use of it? If no, why can'

Locking mysql tables with php
Hi

BACKGROUND:
I have multiple instances of the same php script running in a WAMP environ

is this the proper use of mysql_real_escape_string() to prevent sql injections?
i was wondering is this the proper use of mysql_real_escape_string() to prevent sql injections? any

System copy error in RUN ABAP REPORT PHASE
Hi,
I am performing system copy on my test server. I have previously taken export of JAVA + A

distinct rows
Hi
version 10.2.0.3

I have a query output something like the following

ID

php web service error
hey guys,
I'm working on a project requires the use of web services. I've been trying a few tutor

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