Jump to content

Textarea list vs database entries


triphp

Recommended Posts

I have a textarea wherein users can input a string, i.e. names for example, line by line. And in my database I have a table that store the names.

I want to compare the names (one name per line) he entered in the textarea versus the names in the database. If the names he entered in the textarea is not yet in the database, it will be echoed back.

Does anyone know how to do the comparison? Is there a built-in function in PHP to do this? Any help or examples give is greatly appreciated :)
Link to comment
https://forums.phpfreaks.com/topic/23029-textarea-list-vs-database-entries/
Share on other sites

I think you can do an array compare against two arrays, that would probably be the way to go... Look at [url=http://uk.php.net/manual/en/function.array-diff.php]array_diff()[/url].

Get both sets of data into an array, this should be pretty simple, if you're not sure, give us a shout back.

Regards
Huggie

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.