Current location: Hot Scripts Forums » Programming Languages » PHP » storing value in an array


storing value in an array

Reply
  #1 (permalink)  
Old 07-06-06, 12:49 AM
n3wb!e's Avatar
n3wb!e n3wb!e is offline
Wannabe Coder
 
Join Date: Mar 2006
Posts: 216
Thanks: 2
Thanked 0 Times in 0 Posts
storing value in an array

hi everyone, how can i save the retrieved rows in an array ? i dont know how to throw a question. prolly, my php code might help.. here is the code.,

PHP Code:

$sql=mysql_query("select * from question_base where username='$name'",$conn);

$rows mysql_num_rows($sql);
if(
$rows 0)
{
    while(
$row mysql_fetch_array($sql))
    {
         
$sub=$row[subject];
         
$question_no=$row[question];
     }

the problem is, there are n number of subjects which r returned.. i want to store those subjects in a array.. i used $sub[]=$row[subject] , but thats not working.. can anyone tell me how to store those subjects in an array for later retrieval ? thanks in advance.. ciao..
Reply With Quote
  #2 (permalink)  
Old 07-06-06, 01:51 AM
n3wb!e's Avatar
n3wb!e n3wb!e is offline
Wannabe Coder
 
Join Date: Mar 2006
Posts: 216
Thanks: 2
Thanked 0 Times in 0 Posts
finally i figured it myself.. just had to add a variable for the subject. $sub[$i] !
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
unknown problem - probably $session issue clantron PHP 6 03-19-06 01:36 PM
Sorting a massive multidimensional array dave111 PHP 1 12-12-05 04:09 PM
Serializing a set of arrays dannyallen PHP 2 10-11-04 03:04 AM
file into an array, then appending array only if no duplicates djpennin Perl 2 05-17-04 01:04 PM
linking to iframe not working :( j0d JavaScript 5 01-19-04 08:14 PM


All times are GMT -5. The time now is 07:20 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.