Jump to content

SQL Information Retrieval


deadone

Recommended Posts

:'(

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.