ok.. Here is what i am trying to do with an mySQL table.
I want to get a random row number from the table but also from only certian rows (example: Males only)
Here is what i have done...
I can get the random number from this after i have used COUNT(*) in a previous query..
my $number = int rand $total;
my $query = ("SELECT * FROM people LIMIT $number,1");
But here is what i want to do... ( this does not work, any ideas on how to write this to make it work ?)
my $query = ("SELECT * FROM people WHERE gender = 'Male' LIMIT $number,1");
I am just learning how to use a mySQL database in programs and need all the help i can get. Anyone know of any good online resources to learn? I have seen a lot of articles etc... out there but they are all basic on how to use SELECT DELETE UPDATE etc....
I know i need to know more than this...
Thanks
I want to get a random row number from the table but also from only certian rows (example: Males only)
Here is what i have done...
I can get the random number from this after i have used COUNT(*) in a previous query..
my $number = int rand $total;
my $query = ("SELECT * FROM people LIMIT $number,1");
But here is what i want to do... ( this does not work, any ideas on how to write this to make it work ?)
my $query = ("SELECT * FROM people WHERE gender = 'Male' LIMIT $number,1");
I am just learning how to use a mySQL database in programs and need all the help i can get. Anyone know of any good online resources to learn? I have seen a lot of articles etc... out there but they are all basic on how to use SELECT DELETE UPDATE etc....
I know i need to know more than this...
Thanks