deadone Posted August 20, 2008 Share Posted August 20, 2008 :'( Hey guys i want to thank everyone in advance for any assistance on the following. Its straight forward code. I just don't understand why it does not work. Server Info 5.0.51b-community-nt CREATE TABLE mg( mgID INT NOT NULL AUTO_INCREMENT, g VARCHAR(27), urldefine VARCHAR(50), PRIMARY KEY (mgID)) After that was finished i had wrote a script to input the different variables, to fill out the table. and verified there is data via phpmyadmin. Now here the problem. I cannot retrieve data from the fields. The purpose of the script is dump the variables into a text file with html markups so i can copy and paste when necessary. <? $connect=mysql_connect(' ',' ',' '); // Omitted connection info for obvious reasons $fp=fopen("formatedsqldump.txt","w"); $db=mysql_select_db("fdad",$connect); $table="mg"; $sql="SELECT * FROM mg LIMIT 400"; $result=mysql_query($sql,$connect); while ($field = mysql_fetch_field($result)){ $htmlformat="<label><input type=checkbox name=$field->mgID id=$field->mgID/>$field->g</label><br/>"; fputs ($fp,$htmlformat); echo sizeof($field); // only thing that should appear on webpage } mysql_close($connect); fclose($fp); mysql_free_result($result); ?> My results i get on my webpage is 111 and my results in my formatedsqldump.txt is the following <label><input type=checkbox name= id=/></label><br/><label><input type=checkbox name= id=/></label><br/><label><input type=checkbox name= id=/></label><br/> So a total of three items are returned. With no values passed. The other problem that there is well. I have 333 fields. So any explanation why its not working properly would be appreciated. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 20, 2008 Share Posted August 20, 2008 My guess? PHP is having trouble parsing that... use curlies. Quote Link to comment Share on other sites More sharing options...
AjBaz100 Posted August 21, 2008 Share Posted August 21, 2008 try like this.. $htmlformat='<label><input type="checkbox" name="'.$field->mgID.'" id="'.$field->mgID.'"/>'.$field->g.'</label><br/>'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.