sandbudd Posted April 13, 2009 Share Posted April 13, 2009 Guys this is a weird one and I may just be too close to see it. This is an update script that I am using. It works all but one field "bold" If I manualy put some data in the database it displays it but when I try to update it clears the field? All the other populate the database fine? <?php $result=mysql_query("select id from employees order by company asc"); // Fetch record rows in $result by while loop and put them into $row. while($row=mysql_fetch_assoc($result)){ $company=$_POST["company".$row[id]]; $bold=$_POST["bold".$row[id]]; $address=$_POST["address".$row[id]]; $city=$_POST["city".$row[id]]; $state=$_POST["state".$row[id]]; $phone=$_POST["phone".$row[id]]; $asian=$_POST["asian".$row[id]]; $american=$_POST["american".$row[id]]; $coffee=$_POST["coffee".$row[id]]; $fun=$_POST["fun".$row[id]]; $italian=$_POST["italian".$row[id]]; $mexican=$_POST["mexican".$row[id]]; $seafood=$_POST["seafood".$row[id]]; $upscale=$_POST["upscale".$row[id]]; $recommend=$_POST["recommend".$row[id]]; $email=$_POST["email".$row[id]]; $website=$_POST["website".$row[id]]; $photo=$_POST["photo".$row[id]]; $coupon=$_POST["coupon".$row[id]]; $map=$_POST["map".$row[id]]; $fastfood=$_POST["fastfood".$row[id]]; $pizza=$_POST["pizza".$row[id]]; // Update field "name", matching with "id" value by while loop. mysql_query("update employees set company='$company', bold='$bold', address='$address', city='$city', state='$state', phone='$phone', asian='$asian', american='$american', coffee='$coffee', fun='$fun', italian='$italian', mexican='$mexican', seafood='$seafood', upscale='$upscale', recommend='$recommend', email='$email', website='$website', photo='$photo', coupon='$coupon', map='$map', pizza='$pizza', fastfood='$fastfood' where id='$row[id]'"); } echo "--- Update Complete ---"; } ?> Link to comment https://forums.phpfreaks.com/topic/153935-solved-wont-populate-but-shows-results/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.