Jump to content


Photo

php and mysql - inserting data into sentinel


  • Please log in to reply
1 reply to this topic

#1 gingercrock

gingercrock
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 01 March 2006 - 01:45 PM

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:

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


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...dmin/index.php" where my database is, no data is entered.. any help would be great!!!

thanks

Steven

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 01 March 2006 - 02:28 PM

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..
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users