php - Random Switch Statement Improvements? -


I am trying to improve my switch statement to make it more random. I am currently trying to make the profile random. Two profiles are displayed on the other side at the same time these profiles are on a slide show and when I load the faded web page every and every second in 2.5 seconds I do not have to show the same profile at the same time (both above and below) Fan Thank you in advance for any input you may have made two switch statements as follows:

  & lt; div id = "slider" & gt; & Lt ;? In Php $ getSliderInfoQuery = "pst.state_id = select ps.state_id f_name, L_NAME, book_reviews left the city, zipcode, state_id, book_types, profile_photo, PROFILE_URL as pst.name, book_states join book_readers prt.rating ps left pst The prt.user_id = ps.user_id at the joining preset where promoted_reader = 1 is "ORDER"; $ Pickrow = mt_rand (1, 6); $ Pickrow = mt_rand (1, 6); Switch ($ Pickrock) {Case 1: Get Slider Enfe ... Case 4: $ getSliderInfoQuery. = "Profile_photo"; breakdown; case 5: $; "breakdown; getSliderInfoQuery. = "L_name DESC"; break; case 6: $ getSliderInfoQuery. = "city Diissi"; break; & lt; div id = "slider 2" & gt; & LT ;? Php $ getSliderInfoQuery = "pst.state_id = select the ps.state_id f_name, L_NAME, prt.user_id city, zipcode, state_id, book_types, profile_photo, PROFILE_URL as pst.name, joining book_readers prt.rating ps left book_states left pst preset join book_reviews = ps.user_id where promoted_reader = 1 by ORDER "; $ Pickrow = mt_rand (1, 6); switch ($ pickrow) {case 1: $ getSliderInfoQuery. = "F_name"; breakdown; case 2: $ getSliderInfoQuery. = "L_name"; breakdown; Case 3: $ getSliderInfoQuery. = " City "; breakage; Case 4: $ getSliderInfoQuery. =" Profile_photo "; breakdown; case 5: $ getSliderInfoQuery. =" City dessc "; breakage; case 6: $ getSliderInfoQuery. =" L_name DESC "; break; } $ SliderResult = mysql_query ($ getSliderInfoQuery);    

You can use MySQL ORDER BY RAND () Without your php switch can

  $ getSliderInfoQuery = "f_name, L_NAME, city, zip code, state_id, book_types, profile_photo, PROFILE_URL as pst.name, joining prt.rating ps left selection book_readers book_states pst Pst.state_id => Ps.user_id at prt.user_id on left book_reviews at ps.state_id where promoted_reader = 1 command rand () LIMIT 2 ";    

You want to add LIMIT to get the number of rows. Repeat the lines instead of creating a query again.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -