Page 1 of 1
Trying to avoid repetition in database
Posted: Mon Nov 25, 2002 5:22 pm
by Ozz
I use a form to send links to my site.
Its a link log type site.
I want to inform submitter when a link exist on database to avoid repetition.
table name is weblog column name is body in my MySql database.
How can I do that in php with a database query ?
Thanks
Posted: Mon Nov 25, 2002 7:28 pm
by volka
you might mark the field as unique. Atempts to add an equal entry will be rejected by msql.
Or you perform a query with the apropriate WHERE-clause. if
mysql_num_rows returns a value !=0 there was an equal entry and you may show it.
Posted: Mon Nov 25, 2002 11:06 pm
by Ozz
Body field is not only url it has some text and html tags.
Is there query to search within the body field?
Posted: Mon Nov 25, 2002 11:18 pm
by volka
are you sure you want to store the data that way?
You have to extract any link from the posted message either way, so you could easily store them in a different field or cross-linked table.
Anyway, maybe these two links are helpful
http://www.mysql.com/doc/en/String_comp ... tions.html
http://www.mysql.com/doc/en/Fulltext_Search.html
Posted: Tue Nov 26, 2002 2:03 pm
by Ozz
I think it will be like a full text searching.
Thanks