php and random sql seqrch

Codes here !

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Mon Jul 16, 2012 12:42 pm

php and random sql seqrch

Postby smithandson » Mon Jul 16, 2012 12:46 pm

Hello people,

I need some help with some PHP coding, and hope someone can help me.

I have a mysql table within a mysql database.
for example

id word sentence associated word
1 happy there is a lot of unhappiness unhappiness
2 consume I am a consumer consumer

I want to choose a random element from the associated word column

I want to make this random element a php variable $word1 (for example)

elsewhere I want to have an text input box with a submit button
I want to make what is typed a php variable, for example $word 2

I then want to compare $word1 and $word2

If they are the same, I want to echo $word2 in green
If not, I want to echo $word2 in red with an explanation

I hope my description is not too confusing

many thanks

User avatar
php-forum Active User
php-forum Active User
Posts: 335
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: php and random sql seqrch

Postby freshnet » Sat Jul 21, 2012 11:41 am

And what help are you looking for? Perhaps post your code and let us know which part isn't working. If you're after someone to write all your code for you for free.... good luck!

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 2 guests