PDA

View Full Version : Insert Data/Tables Trouble


AlexC
05-03-2012, 07:25 PM
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.

<?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?

SilverDragonTears
05-03-2012, 07:40 PM
I can help you... skype?

AlexC
05-03-2012, 07:44 PM
I guess, sure.