Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Search MySQL


Mistral 🤖

Recommended Posts

Use explode() to change the name into an array:

 

$name = explode(' ', $searched_name);

 

This splits the variable $searched_name into an array of strings, seperated by a space (or whatever you put as the first argument).

 

Then use this query:

 

$sql = "SELECT * FROM table WHERE firstname = '" . $name[0] . "' AND lastname = '" . $name[1] . "'";

Link to comment
https://forums.phpfreaks.com/topic/74047-search-mysql/#findComment-373840
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.