lordzardeck Posted March 29, 2009 Share Posted March 29, 2009 Hey, i was wondering if you can take a query such as: $sql="SELECT * FROM items WHERE itemid = 1"; $query = mysql_query($sql); and then add a column to it with your own data like this: $row = mysql_fetch_row($query); $row[subject] = "English"; I want to return the $query having the new column Subject. Note, the column Subject does not exist in the table. I have tried different means, but I didn't know if it was possible. Link to comment https://forums.phpfreaks.com/topic/151575-add-columns-to-mysql-query-after-being-queryed/ Share on other sites More sharing options...
redarrow Posted March 29, 2009 Share Posted March 29, 2009 $row['subject'] = "English"; yes that will over right the current info in the database field subject. but $row['subject'] will be set to English where ever you use it, who ever id = id. Link to comment https://forums.phpfreaks.com/topic/151575-add-columns-to-mysql-query-after-being-queryed/#findComment-796163 Share on other sites More sharing options...
lordzardeck Posted March 29, 2009 Author Share Posted March 29, 2009 But, can I still access the $query and get the column I added in line 4? I couldn't get it to work that way. Link to comment https://forums.phpfreaks.com/topic/151575-add-columns-to-mysql-query-after-being-queryed/#findComment-796226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.