Jump to content

Random file help ?


Net123
 Share

Recommended Posts

Generate what from what?What is "random file" supposed to mean? Random file name for a certain known file with certain data? Or a file with certain name with some kind of contents based on random data?By "files table" do you mean a table in an SQL database which contains... what? File paths of some sort?

Link to comment
Share on other sites

do you have any unique id associated with file name in db?

Link to comment
Share on other sites

yes i am using this code 'id' int(11) NOT NULL auto_increment,'path' text NOT NULL,'infolder' text NOT NULL,'name' varchar(255) NOT NULL,......... etc etc

Link to comment
Share on other sites

then you can use rand to generate a random number. then query with it appending the number in WHERE caluse...something like

SELECT * FROM table WHERE id=somerandnumber

Edited by birbal
Link to comment
Share on other sites

But how to i generate a file name from files table (not a random number )i want to generate an file name from my server using sql

Link to comment
Share on other sites

Wow really very thanks bro i gonna for try this

If you're trying to get a random record, you can do this:SELECT * FROM files ORDER BY RAND() LIMIT 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...