dongyin2390 2010-02-08 05:21
浏览 43

将PHP与MySQL数据库一起使用,如果我不知道列是什么,如何从一行中选择所有内容?

I have a table but I dont know what the columns are except for 1 column. There is only 1 permanent data value for each row, the rest of the columns are added and removed elsewhere. This isnt a problem for the query, i just do:

SELECT * FROM table

but for the php function bind_result() i need to give it variables for each column, which i do not know.

I think that once I have the columns in an array, I can do anther query and use call_user_func_array to bind the result to the array.

This seems like it would come up a lot so im wondering is there a standard way of doing this?

  • 写回答

4条回答 默认 最新

  • duanjiao5723 2010-02-08 05:23
    关注

    You could do

    show columns from table;
    

    And then parse that string to grab your column names.

    评论

报告相同问题?

悬赏问题

  • ¥15 有人能看一下我宿舍管理系统的报修功能该怎么改啊?链表那里总是越界
  • ¥15 cs loadimage运行不了,easyx也下了,没有用
  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥20 关于变压器的具体案例分析