Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 09-07-2006, 05:02 AM Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
Hi people
I am designing the website for Nanyang Technological University's Model United Nations Programme and I have a small problem in front of me.

We have to create an online registration system wherin a team could submit their particulars . I want it to be added to a database so that it could be conveniently converted to an excel spreadsheet quickly and without much labour. Can anyone please offer good solutions to this problem

Thanks in advance
Sparsh
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-07-2006, 07:42 AM Re: Help needed
Extreme Talker

Posts: 246
Trades: 3
How about PHP and MySQL?

To capture the data, a simple HTML form would work. Something like this:
Code:
<form method="post" action="savedata.php">
First Particular:<input type="text" name="particular1">
Second Particular:<input type="text" name="particular2">
<input type="submit" name="submitbutton" value="Submit Particulars">
</form>
To save the data to a MySQL table, make a page called savedata.php that looks something like this:
Code:
<?
   mysql_connect("db_host","db_user","db_pass")); 
   mysql_select_db("db_name");
   sql = "insert into table_name (particular1, particular2) values ('".$_POST["particular1"]."','".$_POST["particular2"]."')";
   mysql_query($sql);
?>
To export the data to Excel, you can use the following: PHP Help: Exporting MySQL To Excel
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-07-2006, 08:55 AM Re: Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
Thanks a lot dude... you really made my day... wont forget to thank you on the website if this works out...
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
Old 09-07-2006, 08:56 AM Re: Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
just one more thing.. in addition to adding the data to the mysql can the form also send a copy of the submission to some email address...
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
Old 09-07-2006, 09:39 AM Re: Help needed
Extreme Talker

Posts: 246
Trades: 3
Naturally.

Code:
<?
   mail("youremail@yourdomain.com", "The Subject", "The Body");
?>
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 02:30 PM Re: Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
I am using the page http://ntudebsoc.org/Registration.html

and the php code of savedata.php is
Quote:
<?php
include 'config.php';

$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];

$query = ("INSERT INTO `ntu_deb_society` VALUES ('$name','$email','$p1','$p2','$contact',)");
mysql_query($query) or die('Error, insert query failed');

$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');

?>
Everytime i am getting the error Error, insert query failed
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 02:44 PM Re: Help needed
Extreme Talker

Posts: 246
Trades: 3
You probably need to get rid of the comma after '$contact'
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 02:46 PM Re: Help needed
Extreme Talker

Posts: 246
Trades: 3
And possibly you need to put the field names in the sql query:

Code:
$query = ("INSERT INTO `ntu_deb_society` (fieldname1,fieldname2,fieldname3,fieldname4,fieldname5) VALUES ('$name','$email','$p1','$p2','$contact')");
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 03:01 PM Re: Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
same error again

here is the corrected code

Quote:
<?php
include 'config.php';

$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];
$query = ("INSERT INTO `ntu_deb_society` (Team,Email,P1,P2,Contact) VALUES ('$team','$email','$p1','$p2','$contact')");
mysql_query($query) or die('Error, insert query failed');

$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');

?>
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 03:05 PM Re: Help needed
Extreme Talker

Posts: 246
Trades: 3
You don't necessarily need the parentheses () around the string when you assign $query.
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 03:08 PM Re: Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
failed again..
code is
Quote:

<?php
include 'config.php';

$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];
$query = "INSERT INTO `ntu_deb_society` (Team,Email,P1,P2,Contact) VALUES ('$team','$email','$p1','$p2','$contact')";
mysql_query($query) or die('Error, insert query failed');

$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');

?>

__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 03:28 PM Re: Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
oh .. i was mentioning the name of the table wrong... dumb error

the final code

Quote:
<?php
include 'config.php';

$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];
$query = "INSERT INTO `Team Name` (Team,Email,P1,P2,Contact) VALUES ('$team','$email','$p1','$p2',$contact)";
mysql_query($query) or die($query);

?>
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
Old 09-08-2006, 03:29 PM Re: Help needed
sparshpolly's Avatar
Extreme Talker

Posts: 178
Name: Sparsh
Location: India
Trades: 0
and ya the Flush Privileges was giving an error so i removed it.. works fine

Special thanks to the coupon guy for all his valuable help
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
sparshpolly is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help needed
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34950 seconds with 12 queries