codrgi Posted April 11, 2009 Share Posted April 11, 2009 I'm using a select columname from table query using php, and the result returns more than 1 result, how to i set an array to collect all the data The query im using is just like below $query = "select columname from table"; $result = odbc_exec($connect, $query) or die(""); $table = odbc_result($result,1); How do i make the result collect all the data, not just the first column? Quote Link to comment https://forums.phpfreaks.com/topic/153646-array-a-result/ Share on other sites More sharing options...
MasterACE14 Posted April 11, 2009 Share Posted April 11, 2009 I believe it is... $table = odbc_fetch_array($result); Regards, ACE Quote Link to comment https://forums.phpfreaks.com/topic/153646-array-a-result/#findComment-807373 Share on other sites More sharing options...
codrgi Posted April 11, 2009 Author Share Posted April 11, 2009 Ty for the fast reply, i tried adding the $table = odbc_fetch_array($result); but it dosent do the job, is there any other ways to do this? Quote Link to comment https://forums.phpfreaks.com/topic/153646-array-a-result/#findComment-807385 Share on other sites More sharing options...
.josh Posted April 11, 2009 Share Posted April 11, 2009 You also need to select more than one column from your table (you still have to change $table as MasterACE mentioned). In your query, you're just selecting a single column: columnname. You can specify all of the columns you want to select by doing select column1,column2,column3 from table or select them all by using * select * from table I would not recommend using * unless you really are using all of your columns, though. Should only select what you are going to use. Less work for the system = faster execution time. Quote Link to comment https://forums.phpfreaks.com/topic/153646-array-a-result/#findComment-807405 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.