• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Website Help....Database

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Fuzion

Member
Joined
Oct 3, 2003
I would like users of my site to be able fill out a form regarding their 3DMark scores, and then submit it to a database. Also, I would them to be able to pull info from the database if they wish (lookup scores). Is this hard to do? I'm using PHP, any help would be greatly appreciated.
 
SUPER easy to do


you want a config file to connect to your DB

maybe db.php
Code:
<?php
mysql_pconnect("localhost","username","password");
mysql_select_db("DBname");
?>
[code]

then on all your pages that need to access your DB,  you would put this line at the top

[code]
<?php include("db.php"); ?>

<!--then you can put some discriptive HTML-->
<form method=post action=pagename.php?action=submit>
<input type=text size=3 value=0 name=3dmark> 
<input type=submit value=submit>
</form>

<?php
if ($action == submit) {
        $3dmark =floor($3dmark);  //  this will keep people from imputting improper scores 
         $3dmark = str_replace("--","", $3dmark);
         mysql_query("INSERT INTO Tablename  (columb)  Values $3dmark");  // this is your DB connection,  saying what to put into your DB
         print "Thank you for submitting your score of $3dmark";
?>


thats for submitting, viewing them is a bit different but you shoudl beable to figure it out form the example above
 
Back