PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 11th, 2004, 11:15 PM
giggle giggle is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 giggle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need help with code in radiobuttons

Hello!!

I was trying to get the value of radiobutton dynamically from the database because in future we might add some more columns in that field.I wrote a code but it is not working.Can anybody pls help me.

<html>
<body>
<?php
include("Dbconn.php");
?>
<?php
$sql= "select distinct books from tblbooks order by Books";
$res=mysql_query($sql);
$numofrows=mysql_numrows($res);
$count=0;
while($count<$numofrows)
{
$Books=mysql_result($res,$count,"Books");
?>
<input type="radio" name="nodes" value="<? echo $Books; ?>"
<input type="submit" >
</body>
</html>

Reply With Quote
  #2  
Old September 12th, 2004, 04:47 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 6
A couple of points off the top of my head.

1) There's no closing brace '}' for the while loop.
2) You need to increment $count in the while loop or it'll go on forever.

Hope these help,

-KM-

Reply With Quote
  #3  
Old September 12th, 2004, 11:24 AM
giggle giggle is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 giggle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thankyou

hi!!

Thankyou so much.I made those corrections and I used 'mysql_fetch_array' instead of that
count in that while loop and it worked.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Need help with code in radiobuttons


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT