• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP: What's wrong with this code?

QReyes

New Member
PHP:
<?php

$link = mysql_connect("localhost","root","") or die("Connection Error: ".mysql_error());

mysql_select_db("thecofc_ama",$link) or die ("Database Error: 	".mysql_error());

$result = mysql_query('INSERT INTO `sc_nom` (`stud`, `studnum`, `email`, `pres`, `vice`, `sec`, `treas`, `proe`, `proi`, `sgt`, `strep`, `ndrep`, `rdrep`, `datetime`) VALUES (`$stud`, `$studnum`, `$email`, `$pres`, `$vice`, `$sec`, `$treas`, `$proe`, `$proi`, `$sgt`, `$strep`, `$ndrep`, `$rdrep`, NOW())',$link) or die("Query Error: ".mysql_error());

mysql_free_result($result);

mysql_close($link);

?>
You can try it out at http://thecofclub.distanthost.com/AMA/sc_nom.php
 
PHP:
<?php

mysql_connect("localhost","root","") or die("Connection Error: " . mysql_error());

mysql_select_db("thecofc_ama") or die ("Database Error:     " . mysql_error());

$result = mysql_query('INSERT INTO `sc_nom` (`stud`, `studnum`, `email`, `pres`, `vice`, `sec`, `treas`, `proe`, `proi`, `sgt`, `strep`, `ndrep`, `rdrep`, `datetime`) VALUES (`$stud`, `$studnum`, `$email`, `$pres`, `$vice`, `$sec`, `$treas`, `$proe`, `$proi`, `$sgt`, `$strep`, `$ndrep`, `$rdrep`, NOW())',$link) or die("Query Error: ".mysql_error());

mysql_free_result($result);

mysql_close($link);

?>

Try that
 
Try this then:
PHP:
<?php

mysql_connect("localhost","root","") or die("Connection Error: " . mysql_error());

mysql_select_db("thecofc_ama") or die ("Database Error:     " . mysql_error());

$result = mysql_query("INSERT INTO sc_nom (stud, studnum, email, pres, vice, sec, treas, proe, pro1, sgt, strep, ndrep, rdrep, datetime) VALUES (`$stud`, `$studnum`, `$email`, `$pres`, `$vice`, `$sec`, `$treas`, `$proe`, `$proi`, `$sgt`, `$strep`, `$ndrep`, `$rdrep`, NOW())") or die("Query Error: ".mysql_error());

mysql_free_result($result);

mysql_close($link);

?>
 
Back
Top