iamq08 Posted July 19, 2006 Share Posted July 19, 2006 I'm trying to populate a form in a menu for my website, and for some reason it won't pull the information from the database correctly. Any assistance would be real helpful. here's the function from the include file[code] function get_extensions(){ $q = mysql_query("select name, context, mailbox, secret from extensions"); while($info = mysql_fetch_array($q)){ return $info; } }[/code]Heres the excerpt from the php file[code]$vars = New Casename;$vars->mysqldbcon();$extens = $vars->get_extensions();..............................<? foreach($extens as $val){ ?><form action="user.php" method="POST"> <tr bgcolor="#E7F3FB"> <td nowrap valign=top><input name="name" value="<?=$val['name']?>"></td> <td nowrap valign=top><input type="text" maxlength="150" name="context" value="<?=$val['context']?>"></td> <td nowrap valign=top><input type="text" maxlength="150" name="mailbox" value="<?=$val['mailbox']?>"></td> <td nowrap valign=top><input type="text" maxlength="150" name="secret" value="<?=$val['secret']?>"></td> <td nowrap valign=top><input type="Submit" name="action" value="Update"></td> <td nowrap valign=top><input type="Submit" value="Remove" name="action"></td> </tr></form><?}?>[/code]For some reason it doesn't pull the information correctly. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 19, 2006 Share Posted July 19, 2006 what about the select statementwhere id='$id' "; Quote Link to comment Share on other sites More sharing options...
iamq08 Posted July 19, 2006 Author Share Posted July 19, 2006 I'm trying to pull and populate the page with all of the entries, which is the reason for no where specification. I don't think the problem is with the function, because I can print values, I think there may be somethin wrong with the foreach statement or below that. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 19, 2006 Share Posted July 19, 2006 try a diffrent loop then okexample.<?for($i=0; $i<count($extens); $i++){?> Quote Link to comment Share on other sites More sharing options...
akitchin Posted July 19, 2006 Share Posted July 19, 2006 try echoing the $extens and seeing if you actually have an array:[code]echo '<pre>'.print_r($extens, TRUE);[/code]and if it's got the values you expect. 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.