Hi everyone, i'm having problem on what PHP code that is appropriate for me to search for a specific data from mysql database, help me with how to go about please

Recommended Answers

All 3 Replies

Here's what I do to prototype such a search. I usually have an example output (report) that I am attempting to achieve. Then I manually craft a SQL command using the command line that gives me the dataset I need for the report.

After that, that SQL command is re-used in the PHP to create the desired output.

I'm finding folk I am running into today are heading straight to code rather than sketching out what they want, building the SQL command line and sometimes skipping the design stage. What happens is they often feel lost.

commented: +1 +14

Also, remember there are two MySQL api's for PHP. One is the mysql api (deprecated and no longer supported), and the newer mysqli api which is the currently supported one. You will find documentation for them on the PHP web site documentation pages.

commented: +1 for noting that. +11

PDO also deserves a mention, when talking about different MySQL APIs. It's not exclusively for MySQL, but the support for it is superp. In fact, it has some features MySQLi does not. (Like named parameters.)

And, as an added bonus, if/when you ever start using other databases, you don't have to learn a new API; PDO supports all the popular databases.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.