View Single Post
  #1  
Old 05-03-2012, 07:25 PM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 67,309
AlexC is an unknown quantity at this point
Default Insert Data/Tables Trouble

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?
__________________
Reply With Quote