Jump to content

php and mysql - inserting data into sentinel


gingercrock

Recommended Posts

hey,
i am currently building a basic website to get the feel for using mySql and so on.. i have a registration form from which i wish the data entered by the user to enter into a database i have.. however, i have tried various different attempts to get this working but i am failing each time.. here is my code:

[i]<?php

$connection = mysql_connect("sentinel.cs.cf.ac.uk","scm5sjc","my_password_here");
mysql_select_db("sjcdb",$connection)or die("failed!");

$title="title";
$first="first";
$last="last";
$age="age";
$subject="subject";
$year="year";
$email="email"

mysql_query("INSERT INTO info values('NULL', '$title','$last','$age',$subject','$year','$email')",$connection);

mysql_close(connection);
?>[/i]

This page is named 'display.php' and is linked up by the registration form 'main.php'.. once the submit button is pressed, however on the website "https://www.cs.cf.ac.uk/phpMyAdmin/index.php" where my database is, no data is entered.. any help would be great!!!

thanks

Steven
Link to comment
Share on other sites

change:
mysql_query("INSERT INTO info values('NULL', '$title','$last','$age',$subject','$year','$email')",$connection);
for:
mysql_query("INSERT INTO info values('NULL', '$title','$last','$age',$subject','$year','$email')",$connection) OR die(mysql_error());

and paste what error it has..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.