mattsolomon Posted February 27, 2011 Share Posted February 27, 2011 at the moment i have my page: addevent.php i have written: $q = "SELECT username " ."FROM ".TBL_USERS." ORDER BY ASC"; $result = $database->query($q); on the database.php page here is what query looks like: /** * query - Performs the given query on the database and * returns the result, which may be false, true or a * resource identifier. */ function query($query){ return mysql_query($query, $this->connection); } then i want to display $result in a drop down menu so i wrote back on addevent.php: <select name="Select1"> <option value="<? echo("$result"); ?>"><? echo("$result"); ?></option> </select> Link to comment https://forums.phpfreaks.com/topic/229055-why-am-i-not-getting-a-result/ Share on other sites More sharing options...
flolam Posted February 27, 2011 Share Posted February 27, 2011 <select name="Select1"> <?php while ($row = mysql_fetch_assoc($result)) { echo '<option value="'.$row["column_name"].'">'.$row["column_name"].'</option>'; } ?> </select> of course you need to replace column_name with the name of the db column from which you want to insert the value. Link to comment https://forums.phpfreaks.com/topic/229055-why-am-i-not-getting-a-result/#findComment-1180481 Share on other sites More sharing options...
mattsolomon Posted February 27, 2011 Author Share Posted February 27, 2011 im still not getting a result? i've echo'd $q and i get: SELECT * FROM client_details ORDER BY ASC but $result is brining nothing? Link to comment https://forums.phpfreaks.com/topic/229055-why-am-i-not-getting-a-result/#findComment-1180483 Share on other sites More sharing options...
flolam Posted February 27, 2011 Share Posted February 27, 2011 Shouldn't your sql "order by" clause include a column? like this: SELECT * FROM client_details ORDER BY column ASC Link to comment https://forums.phpfreaks.com/topic/229055-why-am-i-not-getting-a-result/#findComment-1180489 Share on other sites More sharing options...
mattsolomon Posted February 27, 2011 Author Share Posted February 27, 2011 thank you [solved] Link to comment https://forums.phpfreaks.com/topic/229055-why-am-i-not-getting-a-result/#findComment-1180490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.