开发者

How do i properly format a Mysqli query result in PHP? And is there an equivalent to mysql_field_table() for mysqli?

开发者 https://www.devze.com 2023-01-25 12:47 出处:网络
So I am writing a small PHP framework for fun, and I have come to a point where I need to format an arbitrary query result into this format:

So I am writing a small PHP framework for fun, and I have come to a point where I need to format an arbitrary query result into this format:

Array(<br>
[tablename]<br>
  [fieldname] => value<br>
  [fieldname] =&g开发者_如何学运维t; value<br>
[tablename]<br>
  [fieldname] => value);<br>
<br>

If I was doing this in mysql, I would simply do it this way: $tmp[mysql_field_table][mysql_field_name] = $value. But I chose to do this project using mysqli, and I can't seem to find an equivalent for mysql_field_table() so I can determine the table for each individual value. What is the ideal method for gaining this result?


Look at the example here in the manual; the return value of the function documented is an object with a member called 'table'.

This gives you what you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号