lux55 Posted September 21, 2009 Share Posted September 21, 2009 script: <?php $newfirstname=$_POST["newfirstname"]; $newlastname=$_POST["newlastname"]; $newphone=$_POST["newphone"]; $newoccupation=$_POST["newoccupation"]; $newdob=$_POST["newdob"]; $newmm=$_POST["newmm"]; $newdd=$_POST["newdd"]; $newyyyy=$_POST["newyyyy"]; $newemailaddy=$_POST["newemailaddy"]; $newaddress1=$_POST["newaddress1"]; $newaddress2=$_POST["newaddress2"]; $newcity=$_POST["newcity"]; $newtstate=$_POST["newtstate"]; $newzip=$_POST["newzip"]; $newcountry=$_POST["newcountry"]; $newlastenetered=$_POST["newlastenetered"]; $newmembertype=$_POST["newmembertype"]; $newfeepaid=$_POST["newfeepaid"]; $newappdate=$_POST["newappdate"]; $newappseven=$_POST["newappseven"]; $newenrolldate=$_POST["newenrolldate"]; $newexpires=$_POST["newexpires"]; $newsponsor=$_POST["newsponsor"]; $newlicnumber=$_POST["newlicnumber"]; $newsex=$_POST["newsex"]; $newlicexp=$_POST["newlicexp"]; $newcomments=$_POST["newcomments"]; $newcompsb4mid=$_POST["newcompsb4mid"]; $newempcomps=$_POST["newempcomps"]; $newempreduced=$_POST["newempreduced"]; $newonlinecomp=$_POST["newonlinecomp"]; $newindustry=$_POST["newindustry"]; $newonlinereduced=$_POST["newonlinereduced"]; $newflyerreduced=$_POST["newflyerreduced"]; $newt12thstreduced=$_POST["newt12thstreduced"]; $newfullcovb4mid=$_POST["newfullcovb4mid"]; $newfullcovlate=$_POST["newfullcovlate"]; $newlastaltered=$_POST["newlastaltered"]; $newcreatedby=$_POST["newcreatedby"]; $Host = "localhost"; $User = ""; $Password = ""; $DBName = "news2_voyeurmembers"; $TableName = "members"; $Link = mysql_connect ($Host, $User, $Password); //build query $query = "INSERT INTO `news2_voyeurmembers`.`members` ( `id` , `firstname` , `lastname` , `phone` , `occupation` , `dob` , `mm` , `dd` , `yyyy` , `emailaddy` , `address1` , `address2` , `city` , `tstate` , `zip` , `country` , `lastentered` , `membertype` , `feepaid` , `appdate` , `appseven` , `enrolldate` , `expires` , `sponsor` , `licnumber` , `sex` , `licexp` , `comments` , `compsb4mid` , `empcomps` , `empreduced` , `onlinecomp` , `industry` , `onlinereduced` , `flyerreduced` , `t12thstreduced` , `fullcovb4mid` , `fullcovlate` , `lastaltered` , `createdby` ) VALUES (NULL , '$newfirstname', '$newlastname', '$newphone', '$newoccupation', '$newdob', '$newmm', '$newdd', '$newyyyy', '$newemailaddy', '$newaddress1', '$newaddress2', '$newcity', '$newtstate', '$newzip', '$newcountry', '$newlastenetered' , '$newmembertype', '$newfeepaid', '$newappdate', '$newappseven', '$newenrolldate' , '$newexpires', '$newsponsor', '$newlicnumber', '$newsex', '$newlicexp', '$newcomments', '$newcompsb4mid' , '$newempcomps' , '$newempreduced' , '$newonlinecomp' , '$newindustry' , '$newonlinereduced' , '$newflyerreduced' , '$newt12thstreduced' , '$newfullcovb4mid' , '$newfullcovlate' , '$newlastaltered' , '$newcreatedby' )" ; $result = mysql_query($query); //success if (mysql_query($query)) { //inform of this success print "&statust=Update successful."; } else { //otherwise report error print "&statust=Information NOT Updated please call us"; } mysql_close ($Link); ?> Link to comment https://forums.phpfreaks.com/topic/174943-query-insert-into-is-making-double-records/ Share on other sites More sharing options...
ozestretch Posted September 21, 2009 Share Posted September 21, 2009 Make sure to Is a SQL not php question... unless your php script is being looped? <?php $query = "INSERT INTO `news2_voyeurmembers`.`members` ( `id` , `firstname` , `lastname` , `phone` , `occupation` , `dob` , `mm` , `dd` , `yyyy` , `emailaddy` , `address1` , `address2` , `city` , `tstate` , `zip` , `country` , `lastentered` , `membertype` , `feepaid` , `appdate` , `appseven` , `enrolldate` , `expires` , `sponsor` , `licnumber` , `sex` , `licexp` , `comments` , `compsb4mid` , `empcomps` , `empreduced` , `onlinecomp` , `industry` , `onlinereduced` , `flyerreduced` , `t12thstreduced` , `fullcovb4mid` , `fullcovlate` , `lastaltered` , `createdby` ) VALUES (NULL , '$newfirstname', '$newlastname', '$newphone', '$newoccupation', '$newdob', '$newmm', '$newdd', '$newyyyy', '$newemailaddy', '$newaddress1', '$newaddress2', '$newcity', '$newtstate', '$newzip', '$newcountry', '$newlastenetered' , '$newmembertype', '$newfeepaid', '$newappdate', '$newappseven', '$newenrolldate' , '$newexpires', '$newsponsor', '$newlicnumber', '$newsex', '$newlicexp', '$newcomments', '$newcompsb4mid' , '$newempcomps' , '$newempreduced' , '$newonlinecomp' , '$newindustry' , '$newonlinereduced' , '$newflyerreduced' , '$newt12thstreduced' , '$newfullcovb4mid' , '$newfullcovlate' , '$newlastaltered' , '$newcreatedby' ) LIMIT 1" ; ?> Link to comment https://forums.phpfreaks.com/topic/174943-query-insert-into-is-making-double-records/#findComment-921992 Share on other sites More sharing options...
redarrow Posted September 21, 2009 Share Posted September 21, 2009 Need to add mysql_real_escaspe_string() first to all variables. <?php $redarrow=mysql_real_escape_string($_POST['redarrow']); ?> also add anything other contribute you got loads to go...... Link to comment https://forums.phpfreaks.com/topic/174943-query-insert-into-is-making-double-records/#findComment-921993 Share on other sites More sharing options...
ozestretch Posted September 21, 2009 Share Posted September 21, 2009 Not to mention you are calling the query twice $result = mysql_query($query); //success if (mysql_query($query)) { //inform of this success print "&statust=Update successful."; } else { //otherwise report error print "&statust=Information NOT Updated please call us"; } Link to comment https://forums.phpfreaks.com/topic/174943-query-insert-into-is-making-double-records/#findComment-921995 Share on other sites More sharing options...
redarrow Posted September 21, 2009 Share Posted September 21, 2009 yes well spotted if (mysql_query($query)) { to if ($query) { and validate all them variables come on lol Link to comment https://forums.phpfreaks.com/topic/174943-query-insert-into-is-making-double-records/#findComment-921997 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.