?
Solved

API function -- mysql_field_count()  with use of PHP

Posted on 2002-07-22
2
Medium Priority
?
497 Views
Last Modified: 2015-08-19
Hello, expert!

I have some problems with mySQL and PHP. I have found C API function in MySQL manual -
mysql_field_count() .

I wanted to ask you, how to use this API function in my php code. Is it possible? If not,
then can I ask you to write a reliable function, which could count fields in SQL query.

For example,

select * from ... ; How to count them ...??


This is my problem. Thanks in advance.

*j
0
Comment
Question by:fr0x
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
shifted earned 100 total points
ID: 7171115
So why don't you use PHP function mysql_num_fields() instead of C API?
0
 
LVL 8

Expert Comment

by:F P
ID: 40937507
Like this with a sub-query, so it shows on every record, or independent if you just need it once.

SELECT table.*, (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS  WHERE table_name = 'table') AS total_columns FROM table;

Open in new window

0

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question