PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
angelic_devil
Forum Commoner
Posts: 74 Joined: Thu Apr 02, 2009 7:05 am
Post
by angelic_devil » Mon Jul 04, 2011 11:12 am
plz help...the code below doesn't populate the dropbox with the records
Code: Select all
<?
// Initializes a list of acceptable category
$category_list = array();
$query_category = " SELECT categorylist.categoryname from categorylist ";
$result_category = mysql_query($query_category);
confirm_query($result_category);
$category_list[]=" ";
while ($record = mysql_fetch_assoc($result_category)) {
$category_list[] = $record['categoryname'] ;
echo '<option>'.['categoryname'].'</option>';
}
$category = $_GET['categoryname'];
?>
social_experiment
DevNet Master
Posts: 2793 Joined: Sun Feb 15, 2009 11:08 am
Location: .za
Post
by social_experiment » Mon Jul 04, 2011 11:29 am
Code: Select all
<?php
while ($record = mysql_fetch_assoc($result_category)) {
$category_list[] = $record['categoryname'] ;
echo '<option> '. $record['categoryname'] . '</option>';
}
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
angelic_devil
Forum Commoner
Posts: 74 Joined: Thu Apr 02, 2009 7:05 am
Post
by angelic_devil » Mon Jul 04, 2011 1:31 pm
doesn't work
give the error
'. $record['categoryname'] . ''; } } //$category = $_GET['categoryname']; ?>
angelic_devil
Forum Commoner
Posts: 74 Joined: Thu Apr 02, 2009 7:05 am
Post
by angelic_devil » Mon Jul 04, 2011 3:02 pm
OK i got it to work...little change in code
social_experiment
DevNet Master
Posts: 2793 Joined: Sun Feb 15, 2009 11:08 am
Location: .za
Post
by social_experiment » Mon Jul 04, 2011 3:59 pm
Out of curiosity, what error did you get?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Jonah Bron
DevNet Master
Posts: 2764 Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California
Post
by Jonah Bron » Mon Jul 04, 2011 9:55 pm
@social_experiment: I'd say his (local)host had short tags disabled