Hi-

So im making a buying/selling website, where people can search through my catalog. and i have no idea how i would go about that. basicly i would have a database with all of my producs in it, and then people would type in a key word and a page would come up with the appropriate results.

Thanks in advance!

P.S. even if you don't know how to do this, if you could just point me in the right direction id apreciate it!

Dani AI

Generated

Good starting point: laid out the need and 's suggestion to use PHP plus AJAX is a practical approach for a responsive search UI. A simple, repeatable workflow is: choose which product fields are searchable (title, description, tags, SKU), pick a server-side search strategy, expose a single JSON endpoint that accepts a sanitized query, and have the client call that endpoint with a debounced AJAX/fetch request.

Search strategy choices matter as the catalog grows. For very small catalogs a constrained indexed column or prefix search can be fine; for moderate sizes use database full-text search for relevance ranking (MySQL and PostgreSQL both support this but require index tuning and have stopword/minimum-word-length behavior) — see the MySQL full-text notes. For advanced features (fuzzy matching, facets, typo tolerance, scaling) consider an external engine such as Elasticsearch.

Security, UX and performance notes: always use parameterized queries/prepared statements (see the PHP PDO docs) and follow OWASP guidance on SQL injection prevention. Escape output to prevent XSS. Front-end should debounce input, show progress, paginate results, and provide filters and term highlighting. Troubleshooting tips: empty results often come from stopword lists or min-word-length settings or from not rebuilding indexes; slow searches usually need better indexing or caching — use EXPLAIN and incremental profiling. For AJAX, prefer the modern Fetch API for requests.

Recommended Answers

All 2 Replies

You can simply do this with php, and include some ajax to make everything easier for the user, I don't know anything about ajax :p
with php you will have to make a html form like this:

<form action='example.php' method='post'>//or an other page or get
<input type='text' name='txt'></form>

example.php
Here you will need to do some queries to get a product from the database and show it to the user.

PhP, ajax. Got it. Thanks!!

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.