Insert Data/Tables Trouble

Forum
Last Post
Threads / Messages

AlexC

Moderator
Moderator
Joined
Dec 17, 2009
Messages
742
Points
0
Age
28
Location
Canada
Mysidian Dollar
43,036
So somedays I'm a total noob with coding. I need to have someone enter info into a form, have the info put into a database, and then I'll pull it and display it.

I have the form done (I think) and the pulling part I /think/ I'm good with. I'm having trouble getting the info into the table though. Mostly because I don't know how to set up a table.

Code:
<?php
$con = mysql_connect("localhost","gloometh_me","**********"); //Replace with your actual MySQL DB Username and Password
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gloometh_adopts", $con);
$code=mysql_real_escape_string($_POST['code']);
$sql="INSERT INTO clicks (code) VALUES ('$code')";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
echo "The form data was successfully added to your database.";
mysql_close($con);
?>

This is my submitting page - I think its alright. I just need some help setting up a table to hold the data. Help please?
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top