PHP - Code To Edit Mysql Entry
I wrote a site for work that holds employee schedule. By demand of my manager she would like an edit function with out having to re-enter the hole thing. She is very BLOND!! the layout has to stay the same other wise she will never figure it out. i need to be query the db pull the info, edit it and send it back or get it info and then delete then enter new.
this is the code i already use to query the info from the db: Code: [Select] <? ini_set("display_errors", "1"); error_reporting(E_ALL); include("dbinfo.php"); mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM schedule ORDER BY date DESC LIMIT 2"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $date=mysql_result($result,$i,'date'); $urn=mysql_result($result,$i,'urn'); $date0=mysql_result($result,$i,'date0'); $date1=mysql_result($result,$i,'date1'); $date2=mysql_result($result,$i,'date2'); $date3=mysql_result($result,$i,'date3'); $date4=mysql_result($result,$i,'date4'); $date5=mysql_result($result,$i,'date5'); $date6=mysql_result($result,$i,'date6'); $date7=mysql_result($result,$i,'date7'); $day=mysql_result($result,$i,"day"); $day1=mysql_result($result,$i,"day1"); $day2=mysql_result($result,$i,"day2"); $day3=mysql_result($result,$i,"day3"); $day4=mysql_result($result,$i,"day4"); $day5=mysql_result($result,$i,"day5"); $day6=mysql_result($result,$i,"day6"); $day7=mysql_result($result,$i,"day7"); $row1=mysql_result($result,$i,"row1"); $row2=mysql_result($result,$i,"row2"); $row3=mysql_result($result,$i,"row3"); $row4=mysql_result($result,$i,"row4"); $row5=mysql_result($result,$i,"row5"); $row6=mysql_result($result,$i,"row6"); $row7=mysql_result($result,$i,"row7"); $row8=mysql_result($result,$i,"row8"); $row9=mysql_result($result,$i,"row9"); $row10=mysql_result($result,$i,"row10"); $row11=mysql_result($result,$i,"row11"); $row12=mysql_result($result,$i,"row12"); $row13=mysql_result($result,$i,"row13"); $row14=mysql_result($result,$i,"row14"); $row15=mysql_result($result,$i,"row15"); $row16=mysql_result($result,$i,"row16"); $row17=mysql_result($result,$i,"row17"); $row18=mysql_result($result,$i,"row18"); $row19=mysql_result($result,$i,"row19"); $row20=mysql_result($result,$i,"row20"); $row21=mysql_result($result,$i,"row21"); $row22=mysql_result($result,$i,"row22"); $row23=mysql_result($result,$i,"row23"); $row24=mysql_result($result,$i,"row24"); $row25=mysql_result($result,$i,"row25"); $row26=mysql_result($result,$i,"row26"); $row27=mysql_result($result,$i,"row27"); $row28=mysql_result($result,$i,"row28"); $row29=mysql_result($result,$i,"row29"); $row30=mysql_result($result,$i,"row30"); $row31=mysql_result($result,$i,"row31"); $row32=mysql_result($result,$i,"row32"); $row33=mysql_result($result,$i,"row33"); $row34=mysql_result($result,$i,"row34"); $row35=mysql_result($result,$i,"row35"); $row36=mysql_result($result,$i,"row36"); $row37=mysql_result($result,$i,"row37"); $row38=mysql_result($result,$i,"row38"); $row39=mysql_result($result,$i,"row39"); $row40=mysql_result($result,$i,"row40"); $row41=mysql_result($result,$i,"row41"); $row42=mysql_result($result,$i,"row42"); $row43=mysql_result($result,$i,"row43"); $row44=mysql_result($result,$i,"row44"); $row45=mysql_result($result,$i,"row45"); $row46=mysql_result($result,$i,"row46"); $row47=mysql_result($result,$i,"row47"); $row48=mysql_result($result,$i,"row48"); $row50=mysql_result($result,$i,"row50"); $row51=mysql_result($result,$i,"row51"); $row52=mysql_result($result,$i,"row52"); $row53=mysql_result($result,$i,"row53"); $row54=mysql_result($result,$i,"row54"); $row55=mysql_result($result,$i,"row55"); $row56=mysql_result($result,$i,"row56"); $row57=mysql_result($result,$i,"row57"); $row58=mysql_result($result,$i,"row58"); $row59=mysql_result($result,$i,"row59"); $row60=mysql_result($result,$i,"row60"); $row61=mysql_result($result,$i,"row61"); $row62=mysql_result($result,$i,"row62"); $row63=mysql_result($result,$i,"row63"); $row64=mysql_result($result,$i,"row64"); $row65=mysql_result($result,$i,"row65"); $drive1=mysql_result($result,$i,"drive1"); $drive2=mysql_result($result,$i,"drive2"); $drive3=mysql_result($result,$i,"drive3"); $drive4=mysql_result($result,$i,"drive4"); $drive5=mysql_result($result,$i,"drive5"); $drive6=mysql_result($result,$i,"drive6"); $drive7=mysql_result($result,$i,"drive7"); $drive8=mysql_result($result,$i,"drive8"); $drive9=mysql_result($result,$i,"drive9"); $drive10=mysql_result($result,$i,"drive10"); $drive11=mysql_result($result,$i,"drive11"); $drive12=mysql_result($result,$i,"drive12"); $drive13=mysql_result($result,$i,"drive13"); $drive14=mysql_result($result,$i,"drive14"); $drive15=mysql_result($result,$i,"drive15"); $drive16=mysql_result($result,$i,"drive16"); $drive17=mysql_result($result,$i,"drive17"); $drive18=mysql_result($result,$i,"drive18"); $drive19=mysql_result($result,$i,"drive19"); $drive20=mysql_result($result,$i,"drive20"); $drive21=mysql_result($result,$i,"drive21"); $drive22=mysql_result($result,$i,"drive22"); $drive23=mysql_result($result,$i,"drive23"); $drive24=mysql_result($result,$i,"drive24"); $drive25=mysql_result($result,$i,"drive25"); $drive26=mysql_result($result,$i,"drive26"); $drive27=mysql_result($result,$i,"drive27"); $drive28=mysql_result($result,$i,"drive28"); $drive29=mysql_result($result,$i,"drive29"); $drive30=mysql_result($result,$i,"drive30"); $drive31=mysql_result($result,$i,"drive31"); $drive32=mysql_result($result,$i,"drive32"); $drive33=mysql_result($result,$i,"drive33"); $drive34=mysql_result($result,$i,"drive34"); $drive35=mysql_result($result,$i,"drive35"); $drive36=mysql_result($result,$i,"drive36"); $drive37=mysql_result($result,$i,"drive37"); $drive38=mysql_result($result,$i,"drive38"); $drive39=mysql_result($result,$i,"drive39"); $drive40=mysql_result($result,$i,"drive40"); $drive41=mysql_result($result,$i,"drive41"); $drive42=mysql_result($result,$i,"drive42"); $drive43=mysql_result($result,$i,"drive43"); $drive44=mysql_result($result,$i,"drive44"); $drive45=mysql_result($result,$i,"drive45"); $drive46=mysql_result($result,$i,"drive46"); $drive47=mysql_result($result,$i,"drive47"); $drive48=mysql_result($result,$i,"drive48"); $drive49=mysql_result($result,$i,"drive49"); $drive50=mysql_result($result,$i,"drive50"); $drive51=mysql_result($result,$i,"drive51"); $drive52=mysql_result($result,$i,"drive52"); $drive53=mysql_result($result,$i,"drive53"); $drive54=mysql_result($result,$i,"drive54"); $drive55=mysql_result($result,$i,"drive55"); $drive56=mysql_result($result,$i,"drive56"); $drive57=mysql_result($result,$i,"drive57"); $drive58=mysql_result($result,$i,"drive58"); $drive59=mysql_result($result,$i,"drive59"); $drive60=mysql_result($result,$i,"drive60"); $drive61=mysql_result($result,$i,"drive61"); $drive62=mysql_result($result,$i,"drive62"); $drive63=mysql_result($result,$i,"drive63"); $drive64=mysql_result($result,$i,"drive64"); $drive65=mysql_result($result,$i,"drive65"); $drive66=mysql_result($result,$i,"drive66"); $drive67=mysql_result($result,$i,"drive67"); $drive68=mysql_result($result,$i,"drive68"); $drive69=mysql_result($result,$i,"drive69"); $drive70=mysql_result($result,$i,"drive70"); $drive71=mysql_result($result,$i,"drive71"); $drive72=mysql_result($result,$i,"drive72"); $drive73=mysql_result($result,$i,"drive73"); $drive74=mysql_result($result,$i,"drive74"); $drive75=mysql_result($result,$i,"drive75"); $drive76=mysql_result($result,$i,"drive76"); $drive77=mysql_result($result,$i,"drive77"); $drive78=mysql_result($result,$i,"drive78"); $drive79=mysql_result($result,$i,"drive79"); $drive80=mysql_result($result,$i,"drive80"); ?> <div align="center"> <blink>Warning:</blink> Clicking delete will delete this sechedule (no going back once clicked) <table style="width 87%" border="1" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">The Schedule as of: <? echo $date; ?></th> <th><a href="/dominos/admin/delete2.php?urn=<? echo $urn; ?>"><input name='' type='button' value='Delete'/></a></th> <th><a href="../admin/emailit.php"><input type="button" value="Email" /></a></th> <th><a href="../test.php?urn=<? echo $urn; ?>"><input type="button" value="Edit"/></a></th> </tr> </table> <br /> <br /> <input type="text" name="date0" id="date0" value="<? echo $date0; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date1" id="date1" value="<?php echo $date1; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="trans" name="date2" id="date2" value="<?php echo $date2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date3" id="date3" value="<?php echo $date3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date4" id="date4" value="<?php echo $date4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date5" id="date5" value="<?php echo $date5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date6" id="date6" value="<?php echo $date6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date7" id="date7" value="<?php echo $date7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $day; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date1" id="date1" value="<?php echo $day1; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="trans" name="date2" id="date2" value="<?php echo $day2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date3" id="date3" value="<?php echo $day3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date4" id="date4" value="<?php echo $day4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date5" id="date5" value="<?php echo $day5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date6" id="date6" value="<?php echo $day6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date7" id="date7" value="<?php echo $day7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row1; ?>"size="12" maxlength="12" readonly="true"style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row8; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row9; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row10; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row11; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row12; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row13; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row14; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row15; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row16; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row17; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row18; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row19; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row20; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row21; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row22; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row23; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row24; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row25; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row26; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row27; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row28; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row29; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row30; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row31; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row32; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row33; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row34; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row35; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row36; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row37; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row38; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row39; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row40; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row41; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row42; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row43; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row44; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row45; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row46; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row47; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row48; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row50; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row51; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row52; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row53; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row54; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row55; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row56; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row57; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row58; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row59; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row60; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row61; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row62; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row63; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row64; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row65; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive1; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold" /> <input type="text" name="date0" id="date0" value="<? echo $drive2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive8; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive9; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive10; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive11; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive12; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive13; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive14; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive15; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive16; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive17; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive18; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive19; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive20; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive21; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive22; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive23; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive24; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive25; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive26; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive27; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive28; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive29; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive30; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive31; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive32; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive33; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive34; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive35; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive36; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive37; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive38; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive39; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive40; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive41; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive42; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive43; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive44; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive45; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive46; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive47; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive48; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive49; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive50; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive51; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive52; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive53; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive54; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive55; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive56; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive57; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive58; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive59; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive60; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive61; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive62; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive63; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive64; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive65; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive66; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive67; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive68; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive69; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive70; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive71; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive72; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive73; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive74; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive75; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive76; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive77; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive78; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive79; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive80; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <br /> <br /> <br /> <? $i++;} ?> Similar TutorialsAlright, wasn't quite sure how to summarize this in the title, but I want to: Check if a user status is "active" or not based on the UserName input. I have a table witch holds: Code: [Select] VarChar Username Var CharPassWord int Active Ted TedsPW 1 something like the above(assuming it formatted correctly. In my php script I will want to input a variable for Username to check for: inputUN in this example would be "Ted". $UserNameToCheck = $_GET['inputUN']; Then I want to check for that UserName in the database, if it exists, I want pull the value for the "Active" field for just that UserName and echo it. Thanks for any help. I am using php to upload a file to my server, and at the same time inserting the files name and url into my mysql database.
$sql = "UPDATE uploads SET name = '$name', url='$target_path'"; $statement = $dbh->prepare($sql); $statement->execute();This is working, however, when I upload a new file, rather than making a new entry in my database, it just overwrites the first one. I'm quite new at mysql so was wondering how I would make it add new entrys instead of overwriting the current one? I have a table called "colors". It has 2 columns, id and color. All I'm trying to do is pull the data into the form, then edit the colors (for example - misspelled, etc.) Then submit it back to the table. Here is the code that pulls the data into a form so I can edit it: Code: [Select] <form action="adminupdatecolors.php" method="post"> <table width="500" border="1" cellpadding="10"> <tr> <td>Color Options:</td> <td> <? $result = mysql_query("SELECT * FROM colors"); while ($row = mysql_fetch_assoc($result)) { echo '<input type="text" name="color[]" value="' . $row['color'] . '"/>' . $row['id'] . '<br />'; } ?> </td> </tr> <tr> <td> </td> <td><input type="Submit" value="Update Colors"></td> </tr> </form> </table> Here is my update script: Code: [Select] <?php include("config.php"); include("db.php"); $id=$_POST['id']; $color=$_POST['color']; $result = mysql_query("SELECT id FROM colors ORDER BY id DESC LIMIT 0,1"); if ($row = mysql_fetch_assoc($result)) { $id = $row['id']; } $sql = "DELETE FROM colors WHERE id='$id'"; mysql_query($sql) or die("Error: ".mysql_error()); foreach ($color as $colorvalue) { $sql2 = "INSERT INTO colors (id,color) VALUES ($id,'$color')"; mysql_query($sql2) or die("Error: ".mysql_error()); } header("Location: " . $config_basedir . "adminhome.php"); ?> I tried adding a group field to my user table so I can show different content to different users but when I do the check and then if/else the required info it doesn't seem to do it. I think I've got a mistake in my query: <?php include ('header.php'); ?> </center> <?php $username = mysql_real_escape_string($_POST['username']); $checkadmin = mysql_query("SELECT Group FROM users WHERE Username = '".$username."'"); if('$checkadmin' == GroupA) { ?> Welcome Admin! <?php } else { ?> You are not authorised. <?php } include ('footer.php') ?> Whats wrong with it? Cheers. so i have a mysql column with a datetime and i was wondering how i could make it echo the time in "X minutes ago" or "X hours ago" and also, when its more then 24 hours old, delete the entire entry Can anyone point out what's wrong with my feedback.php? It used to work fine and I don't think I did anything but it stopped working - i.e. I had it on a site which I never looked at and when I did look at it I noticed the rubbish written to the database had inexplicably stopped being written there some months ago..... since then I've tried to clean it up and use it elsewhere ( I'm a baby at php and most else) but I can't get it to go right. In this attempt it was giving me the dreaded 'headers already written..' error and I (after googling) took out all the blank space I could and extra comments and what not and stuck in some debugging prints for me and now I get no errors but I get nothing written to the database and no email sent to me. If anyone cares to look at it to help me out, here it is, warts and all, with just the names changed to protect the innocent. <? // mail it $mailto = 'med@yahoo.com' ; $subject = "Ploverpark Feedback Form" ; $formurl = "feedback.html" ; $errorurl = "error.html" ; $thankyouurl = "thankyou.html" ; $uself = 0; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $username = $_POST['username'] ; $firstname = $_POST['firstname'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $secondname = $_POST['secondname'] ; $country = $_POST['country'] ; $phone = $_POST['phone'] ; // do write to database now--------------------------- $link = mysql_connect("mydb.com", "my_pkguest", "password") or die("Could not connect : " . mysql_error()); print "Connected successfully<p>"; $DB = "my_pkguest"; $table = "clients"; mysql_select_db($DB) or die ("Database $DB not select.." . mysql_error()); print "Successfully select the Database: $DB "; $query = "INSERT INTO $table(username,firstname,secondname,email,country,phone,comments) values('$username','$firstname','$secondname','$email','$country','$phone','$comments')"; print "Successfully inserted to table: $table "; //------------------------------------------------------ $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } print "Now past the if isset "; //if (empty($name) || empty($email) || empty($comments)) { // header( "Location: $errorurl" ); // exit ; //} if ( ereg( "[\r\n]", $username ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } print "Now past the if ereg "; if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "UserName of sender: $username\n" . "Firstname of sender: $firstname\n" . "Secondname of sender : $secondname\n" . "Country of sender : $country\n" . "Phone number of sender: $phone\n" . "Email of sender: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; print "Now past the messageproper "; mail($mailto, $subject, $messageproper, "From: \"$username\" <$email>" . $headersep . "Reply-To: \"$username\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); print "Now past the mail"; //header( "Location: $thankyouurl" ); // exit ; ?> Dear All, I am developing a website www.computationalphotography.in on which I need to register new users. I have designed an HTML form for this purpose, but will need help with writing the code for checking and validating the data in the respective fields. The code for my web form is below and the address of the website is www.computationalphotography.in/registration.php: Code: [Select] <html> <head> <title> Photography Experiment Registration </title> </head> <body> <h1> Questionnaire </h1> <h3> We would like to know about your background and interests in photography. For each multiple-choice question, please circle all answers that apply.</h3> <form method="post" action="registration.php"> Name <input name="name" type="text"> <br> <br> <input name="email" type="text"> <br> <br> 1.) Roughly How many pictures do you take each year? <br> <br> <input name="radios" type="radio" value="a"> a) a few: <10 in a year <br> <input name="radios" type="radio" value="b"> b) many: probably 100's a photos a year <br> <input name="radios" type="radio" value="c"> c) a lot: probably 1000's of photos a year <br> <br> 2.) Do you share your pictures with anyone? <br> <input name="radios" type="radio" value="a"> a) No <br> <input name="radios" type="radio" value="b"> b) Yes, but only with friends or family <br> <input name="radios" type="radio" value="c"> c) Yes, I share with friends or family and also post on public sites such as Flickr, Picasaweb, or Snapfish for anyone to see. <br> <input name="radios" type="radio" value="d"> d) Yes, I share frequently and I have also published my photos in books or magazines, or exhibitde my photos in shows. <br> <br> 3.) How much training in photography have you had? <br> <input name="radios" type="radio" value="a"> a) None <br> <input name="radios" type="radio" value="b"> b) Some, but it's self-taught from books or websites <br> <input name="radios" type="radio" value="c"> c) Quite a bit: I have taken courses in photography <br> <input name="radios" type="radio" value="d"> d) A lot:I have completed a degreee or certificate in the subject <br> <br> 4.) How do you describe yourself as a photographer? <br> <input name="radios" type="radio" value="a"> a) A novice:someone who takes a few pictures occasionally <br> <input name="radios" type="radio" value="b"> b) An amateur:someone who takes many photos, but doesn't usually share them <br> <input name="radios" type="radio" value="c"> c) An enthusiast:someone who loves to take pictures, possibly shows them with oters on public sites, or who might own a DSLR, or frequently uses a camera in other than "automatic mode" <br> <input name="radios" type="radio" value="d"> d) An expert:skilled photographer who has published their work, or exhibited their work in shows, or has been paid for their work <br> <br> 5.) Do you have artistic training or exposure? <br> <input name="radios" type="radio" value="a"> a) No <br> <input name="radios" type="radio" value="b"> b) I visit museums or art galleries <br> c) I have studied art: please describe <br> <textarea name="data5c" cols="50" rows="5"> </textarea> <br> d) I am a practicing artist: please describe <br> <textarea name="data5d" cols="50" rows="5"> </textarea> <br> <br> 6.) Some optional information, if you don't mind. We respect your privacy. <br> <br> Age <br> <textarea name="6a" cols="1" rows="1"> </textarea> <br> <br> Gender <br> <input name="radios" type="radio" value="a"> a) Male <br> <input name="radios" type="radio" value="b"> b) Female <br> <br> Languages Spoken <br> <textarea name="6b" cols="25" rows="2"> </textarea> <br> <br> Languages Read <br> <textarea name="6c" cols="25" rows="2"> </textarea> <br> <br> <br> <input type="submit" value="Send"> <input type="reset" value"Reset"> </form> </body> </html> Kindly help me out with this issue. Thank you for your help in this regard. guys in this code i get some data from myswl table and i display them in to and html table with dynamic textboxes the first part works ok but how can i update the mysqltable with tha changes? i have try to work with one table and i get an error Notice: Undefined index: name1 in D:\....... <?php session_start(); include($_SERVER['DOCUMENT_ROOT'].'/includes/connection.php'); $result = mysql_query( "SELECT * FROM serv " ); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<tr>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name1\" type=\"text\" value={$row['onoma-eponymo']} id=\"n1\" STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"25\" maxlength=\"24\" /></form></td>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name2\" type=\"text\" value={$row['username']} STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"7\" maxlength=\"5\" /></form></td>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name3\" type=\"text\" value={$row['password']} STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"7\" maxlength=\"5\" /></form></td>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name4\" type=\"text\" value={$row['serv_id']} STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"9\" maxlength=\"15\" /></form></td>"; echo "</tr>\n"; } echo "</table>"; if(isset($_POST['back'])) {header("location:admin.php");} if(isset($_POST['sub_update'])) { $text = $_POST["name1"]; mysql_query("INSERT INTO serv (password) VALUES ('$text') "); } ?> <body> <form method="post" action=""> <input type="Submit" name="sub_update" value="Ενημέρωση Αλλαγών"style="height:6em; width:16em; font-size:150%;"> <form method="post" action=""> <input type="Submit" name="back" value="Back"style="height:6em; width:16em; font-size:150%;"> </form> Hello coders, I'm using this code to grab random results from a table and it works well but I need it to be a non-repeating event. Code: [Select] $offset_result = mysql_query( " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `jobs_board` "); $offset_row = mysql_fetch_object( $offset_result ); $offset = $offset_row->offset; I'm using this query followed by the html which is a set of divs with inline echo statements for the various variables I've localised from the table. Then I'm repeating that process a number of times to create a small list (I wanted to use a single while loop but cant figure it out at the moment). Anways, how can I make it so each query is random but also not repeated? At the moment they are indeed random but sometimes one same entry will appear a number of times consecutively... Nice one guys, L-plate I spent several hours trying to figure this thing out. Thought I had it nailed, but still getting duplicate record entries into the MySQL DB when I do NOT want them.
Here's the plot:
People filling out the possible attendance form for a Ham Radio event *sometimes* bring a 2nd person (either a spouse or a friend). The 2nd person may, or may not, also has a Callsign which I need to put INSERT the same MySQL Callsign column. In any event, to also identify the 2nd person as coming 'with' the 1st person.
MOST of the attendees are individuals with NO 2nd person.
My entry form has these primary fields:
callsign
fullname
AND...
callsign2
fullname2
What I came up with was to process the MySQL INSERT for the primary callsign & fullname into their respective MySQL DB Columns (which works fine), and then........... immediately following the main Query INSERT, to do a substitution type thing depending on whether or not a form entry was made in the callsign2 field, AND/OR, the fullname2 field.
This partially works, but if there is ONLY a primary callsign and fullname in the form, I'm still getting a duplicate record entry which includes the callsign in the `with` column (which should ONLY take place IF there is a 2nd person indicated).
Confusing?
Here is what I have been wrestling with to try and accomplish the objective, and now my eyes are glazed over ;-(
// TRICKY PART HERE // If a 2nd Callsign AND a Fullname if ($callsign2 != ' ' && $fullname2 != ' ') { // Still make reference to the primary Callsign in the MySQL DB `with` column $with = $callsign; // Assignment to allow 2nd Callsign to be entered in the MySQL `callsign` column $callsign=$callsign2; $fullname=$fullname2; $sql="INSERT INTO `mytable` (`callsign`, `fullname`, `with`) VALUES ('$callsign', '$fullname', '$with')"; // If NO 2nd Callsign BUT a Fullname } elseif ($callsign2 = ' ' && $fullname2 != ' ') { // Make reference to the primary Callsign in the MySQL DB `with` column $with = $callsign; $callsign=$callsign2; $fullname=$fullname2; $sql="INSERT INTO `mytable` (`callsign`, `fullname`, `with`) VALUES ('$callsign', '$fullname', '$with')"; } else { // The only thing I could thing of to (hopefully) NOT make a 2nd entry // record in the MySQL DB IF there is NO 2nd person referenced $with = $callsign; } if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); }This mostly works EXCEPT if only a single (primary) person entry. The recap the objetives: 1. If ONLY a primary/single person entry on the form: * callsign & fullname get INSERTed into the `callsign` and `fullname` columns in the DB as ONLY one record entry 2. If BOTH a primary and 2nd person on the form: A. IF the 2nd person has a Callsign, then the 2nd record entry would be: * callsign2 & fullname2 get INSERTed into the `callsign` & `fullname` columns in the 2nd DB as a separate record entry * callsign of the primary person also gets INSERTED into the `with` column in the same 2nd DB record entry B. IF the 2nd person does NOT have a callsign, then the 2nd record entry would be: * fullname2 gets INSERTed into the `fullname` column in the DB as a separate 2nd DB record entry * callsign of the primary person also gets INSERTED into the `with` column in the same 2nd DB record entry I obvioiusly have overlooked something, but just can't seem to figure it out at this point {SIGH}. Thanks for any enlightenment. -FreakingOUT This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=312600.0 Hi Friends, I am suffering with very serious problem, We have a deal selling website--Problem is that when someone buy a deal , they are getting 2 vouchers on bahalf of one while they are getting charged ones only [I am using authorized.net payment gateway]. for some reason Entry is inserting TWICE in MYSQL but it is not happening on every purchase, it happens once in 20 purchase (for example).... I have tried every possible effort but it still happens, anybody can show me helping hand please ? this is my partial code where I am inserting the voucher info : for($i=0; $i<$_SESSION['quHidden']; $i++): if($_SESSION['RecName'][$i]!=''):$IsGist="t";$GRName=$_SESSION['RecName'][$i];else:$IsGist="f";$GRName="";endif; $coupon_code=str_makerand("12", "12", "false", "false", "false"); $NCCod="#".$coupon_code; $download_path="dealcoupon.php?id=".$sql_coupon['deal_id']."&CRANCode=".$coupon_code; $DLContent[]="<a href=\"".$download_path."\" target=\"_blank\" style=\"font-family: Helvetica,Arial,sans-serif; color: rgb(9, 129, 190);font-size: 14px;\">Download Voucher: ".$NCCod."</a>"; mysql_query("INSERT INTO `tbl_purchase` ( `fld_buyerid` , `fld_dealid` , `fld_amount` , `fld_purchaseid`, `fld_subdate`, `fld_expdate`, `fld_quantity`, `fld_cardno`, `isGift`, `fld_RecName`) VALUES ( '".$_SESSION['usr_id']."', '".$sql_coupon['deal_id']."', '".$sql_coupon['deal_price']."', '$NCCod', '".time()."', '".$sql_coupon[deal_edate]."', '1', '".$_SESSION['x_card_num']."','".$IsGist."','".$GRName."')"); $CoupanArr[]=$NCCod; endfor; //--------------------------------------------------------------------- mysql_query("insert into tbl_vouemails set fld_did='".$sql_coupon['deal_id']."', fld_uid='".$_SESSION['usr_id']."', fld_voucher='".implode(",",$CoupanArr)."', fld_etime='".getPATime($sql_coupon[deal_edate])."', fld_subdate='".time()."', fld_VReceiver='".implode(",",$_SESSION['RecName'])."'"); No errors come up when I run this but it just doesn't delete the entry. <? $rec = $_POST['stock']; if (!$rec){ die ('Please eneter a stock number'); } $link = mysql_connect("xxxx","xxx","xxx"); mysql_select_db('wadkin', $link) or die( "Unable to select database"); mysql_query("DELETE FROM 'wadkin'.'stocklist' WHERE 'stocklist'.'Stock Number' = $rec") or die ('Query failed'); mysql_close($link); ?> Can someone please correct, (btw I have also tried... "DELETE FROM stocklist WHERE 'Stock Number' = $rec") What im trying to achieve is a user contact system, when the user types input in the textarea its saved in a database along with his userid on the site and the date, I have an admin side coded up where it retrieves the data, but there is no order. I want to have it display the most recent results on top. I have looked into this in the mysql manual, but you know how that is its so hard to make sense of anything in that damn manual. Im using a while loop to display the data. How can I achieve this? Hi, I hope this can be done and need some advise as to how. I have a search results page that has a URL of: results-page.php?make=FORD&model=TRANSIT--2000-on++Standard+LOW+ROOF+Models&submit.x=22&submit.y=7 Can i create a button or link on that page to adjust the start of the URL but keeping the dynamically created end part? i.e: new-results-page.php?make=FORD&model=TRANSIT--2000-on++Standard+LOW+ROOF+Models&submit.x=22&submit.y=7 I Hope this makes sense. I am trying to set up a item entry page form.png: Upon submission it shows unsuccessful even though I have checked the fields on mysql table and seem to be good am I missing something? Code: [Select] <form action="" method="post" enctype="multipart/form-data" name="Product_Entry"> <TABLE> <TR> <TD>Product ID</TD><TD><input name="SKU_ProductID" value="<?php if (isset($_post['SKU_ProductID'])) echo $_POST['SKU_ProductID']; ?>" type="text" size="11" maxlength="11" /></TD> </TR> <TR> <TD>Merchant SKU ID</TD><TD><input name="SKU_MerchSKUID" value="<?php if (isset($_post['SKU_MerchSKUID'])) echo $_POST['SKU_MerchSKUID']; ?>" type="text" size="18" maxlength="30" /></TD> </TR> <TR> <TD>Game Title</TD><TD><input name="Game_Title" value="<?php if (isset($_post['Game_Title'])) echo $_POST['Game_Title']; ?>" type="text" size="40" maxlength="40" /></TD> </TR> <TR> <TD>Platform</TD><TD><input name="Platform" value="<?php if (isset($_post['Platform'])) echo $_POST['Platform']; ?>" type="text" size="20" maxlength="20" /></TD> </TR> <TR> <TD>Genre</TD><TD><input name="Genre" value="<?php if (isset($_post['Genre'])) echo $_POST['Genre']; ?>" type="text" size="11" maxlength="11" /></TD> </TR> <TR> <TD>Weight</TD><TD><input name="Weight" value="<?php if (isset($_post['Weight'])) echo $_POST['Weight']; ?>" type="text" size="7" maxlength="7" /></TD> </TR> <TR> <TD>Supplier</TD><TD><input name="Supplier" Value="<?php if (isset($_post['Supplier'])) echo $_POST['Supplier']; ?>" type="text" size="25" maxlength="25" /></TD> </TR> <TR> <TD>Suppliers Price</TD><TD><input name="Supplier_Price" value="<?php if (isset($_post['Supplier_Price'])) echo $_POST['Supplier_Price']; ?>" type="text" size="10" maxlength="12" /></TD> </TR> <TR> <TD>Cashback</TD><TD><input name="Cashback" value="<?php if (isset($_post['Cashback'])) echo $_POST['Cashback']; ?>" type="text" size="6" maxlength="8" /></TD> </TR> <TR> <TD>Cashback Amount</TD><TD><input name="Cashback_Amount" value="<?php if (isset($_post['Cashback_Amount'])) echo $_POST['Cashback_Amount']; ?>" type="text" size="7" maxlength="11" /></TD> </TR> <TR> <TD><input type="hidden" name="submitted" value="true"/></TD><TD><input name="Submit" type="submit" value="Add_Product" /></TD> </TR></form></TABLE> <?php # Product Entry $page_title = 'Product Entry'; if (isset($_POST['Submit'])) { $errors = array(); if (empty($_POST['SKU_ProductID'])) { $errors[] = 'Please enter Product ID.'; } else { $sid = trim($_POST['SKU_ProductID']); } if (empty($_POST['SKU_MerchSKUID'])) { $errors[] = 'Please enter Merchant SKU.'; } else { $mid = trim($_POST['SKU_MerchSKUID']); } if (empty($_POST['Game_Title'])) { $errors[] = 'Please enter Game Title.'; } else { $gt = trim($_POST['Game_Title']); } if (empty($_POST['Platform'])) { $errors[] = 'Please enter Platform.'; } else { $pl = trim($_POST['Platform']); } if (empty($_POST['Genre'])) { $errors[] = 'Please enter Genre.'; } else { $ge = trim($_POST['Genre']); } if (empty($_POST['Weight'])) { $errors[] = 'Please enter Weight.'; } else { $we = trim($_POST['Weight']); } if (empty($_POST['Supplier'])) { $errors[] = 'Please enter Supplier.'; } else { $sup = trim($_POST['Supplier']); } if (empty($_POST['Supplier_Price'])) { $errors[] = 'Please enter Supplier Price.'; } else { $sp = trim($_POST['Supplier_Price']); } if (empty($_POST['Cashback'])) { $errors[] = 'Please enter Cashback %.'; } else { $cb = trim($_POST['Cashback']); } if (empty($_POST['Cashback_Amount'])) { $errors[] = 'Please enter Cashback Amount.'; } else { $cba = trim($_POST['Cashback_Amount']); } if (empty($errors)) { require_once ('connect.php'); [b]$q = "INSERT INTO `Products` (`SKU_ProductID`, `SKU_MerchSKUID`, `Game_Title`, `Platform`, `Genre`, `Weight`, `Supplier`, `Supplier_Price`, `Cashback`, `Cashback_Amount`) VALUES ('$sid', '$mid', '$gt', '$pl', '$ge', '$we', '$sup', '$sp', '$cb', '$cba')"; $r = @mysql_query ($dbc, $q); if ($r) { // If it ran OK. // Print a message: echo '<h1>Thank you!</h1> <p>Product Inserted!</p><p><br /></p>'; } else { // If it did not run OK. // Public message: echo '<h1>System Error</h1> <p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p>'; // Debugging message: echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $q . '</p>'; } // End of if ($r) IF. mysqli_close($dbc); // Close the database connection.[/b] // Include the footer and quit the script: include ('includes/footer.html'); exit(); } else { echo '<H1>Error!</H1> <p class="error">The Following error(s) occurred:<br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p><p><br /></p>'; } } ?> If there is anything else needed let me know I may be on my way to a solution. Question: If the code below will scan ALL fields of my form, how can I add to the code to eliminate just one or two of the inputs, while leaving the remaining 30? $myUpdateList = array();foreach($_POST as $indexName => $value) { $myUpdateList[] = "$indexName = \"$value
How to edit my source code so the output prints correctly ?
Hey. So basically I am working on a simple project, I am no PHP expert, I only know a bit of the basics. This project is simply a "performance monitor" script. I have the parts to add records etc. I am now starting to tackle the next phase of the project that is to modify the records to give "infractions" or "bonus". I want to keep this simple and have the following fields on the edit form: PLAYER NAME: Dropdown List of the PLAYER_NAME column on my table called players I grabbed this code from a different thread (and edited it in an attempt to match my table). echo "Select a name: <select name='$name'>"; $query="select PLAYER_NAME from PLAYERS"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $name=$row['PLAYER_NAME']; echo "<option value='$name'>$name</option>"; } echo "</select>"; I tried to understand it as I modified it, but aparently I misunderstood it becuase it's not working right, this gives me nothing but an empty dropdown box. Here is a screenshot of my current "players" table, so you can see the structure and what not: INFRACTION/BONUS A box to add or subtract "points". I am thinking along the lines of a number text entry with a radio button for options for either BONUS(add) or INFRACTION (subtract) NOTES Just a simple text box for comments. TIMESTAMP I will do this easily with a field on the SQL table What is wrong with the above PHP code I have for the dropdown box? Also how would I go about making this a usable form? I simply want to create new records with all of the above data on a new table I will create called "infractions". I then want to use the data from the "INFRACTION/BONUS" Field to edit the "ND_POINTS" value on the players table. I know the post is a little long, but I would appreciate any help and guidance you can offer in this project. Thanks. |