Php function to get data from mysql.

Using php get 10 values from a mysql table with a select and if the 10 values are not obtained then the function must get the rest of the values needed for the 10 under another select.

The following function must be modified to get the $array.

private function getTagArray($idChannel){

$array = array();

$sql = "SELECT idTagPhoto FROM ((SELECT idTagPhoto FROM ((SELECT idTagPhoto,votes FROM tagphotos_view WHERE (idChannel = $idChannel) ORDER BY idTagPhoto DESC limit 500) as tagphotos_view3) ORDER BY votes DESC limit 100) as tagphotos_view2) GROUP BY idTagPhoto ORDER BY RAND() LIMIT 10";

$result = mysqli_query($this->db, $sql);

$rows = mysqli_num_rows($result);

while($row = $result->fetch_assoc()){

array_push($array, $row["idTagPhoto"]);


return $array;



The "SELECT" of my code must be respected to get the same result, but the function must be modified so that if the select does not reach 10 data, for example if this select only obtains 7 data, the other 3 data must obtain them in another way:

"SELECT idTagPhoto FROM tagphotos_view WHERE (idChannel = 1) LIMIT 3"

I will try the code on my computer to see if it works.

Compétences : MySQL, PHP, Architecture Logicielle

Voir plus : php push mysql data, php mysql data push, software write mq4, software write chip epson, useful software write book, software write web specs, free software write user guide, software write edid, free software write company profile, software write websites idea, software write book images, software write books, software write protection, free software write book, software write book, display mysql data php ajax, excel report mysql data using php, jquery ajax json php mysql data entry example, php mysql data analysis, php export mysql data pdf, php mysql data dictionary, software write protect software, php class display mysql data, display mysql data php, software write technical manual

Concernant l'employeur :
( 93 commentaires ) madrid, Spain

N° du projet : #12711134

Décerné à :


Hello Sir, I've reviewed your requirement and I'm ready to work with you. I will provide quality work as well full support for any query. I'm giving you trust for good quality work. I have almost 7+ years of expe Plus

25 $ USD en 0 jours
(49 Commentaires)

24 freelance font une offre moyenne de $26 pour ce travail

28 $ USD en 1 jour
(161 Commentaires)

A proposal has not yet been provided

20 $ USD en 1 jour
(303 Commentaires)
38 $ USD en 0 jours
(138 Commentaires)

Hello Greetings of the day!!! I’ve carefully gone through your job posting. I am having 5+ years of experience in Word press, Shopify, HTML and PHP. I have designed many e-commerce and woo-commerce websites in last Plus

30 $ USD en 1 jour
(46 Commentaires)

ILM Techno Solution.Pvt.Ltd.India. [url removed, login to view] [url removed, login to view] About:- Welcome to ILM Techno Solutions Pvt. Ltd. clients ranging from Indian business giants to growing enterprises. As a d Plus

25 $ USD en 1 jour
(54 Commentaires)

Hello there i am a professional and have extensive experience, please contact to discuss in details.. i will be waiting thanks regards

30 $ USD en 2 jours
(27 Commentaires)

Greetings! I am an expert PHP programmer and I have just seen your project description. I can complete this function modification within an hour max. Looking forward to hear from you.

25 $ USD en 0 jours
(32 Commentaires)

Hi, I read carefully your project, and I wanna do it for you. If you wanna work together, send me a message to discuss details. I am an experienced Web Developer and Web Designer, and have worked with wide variety of s Plus

15 $ USD en 1 jour
(27 Commentaires)
25 $ USD en 1 jour
(29 Commentaires)

Respected Recruiter, Went through the Job Post and I am Confident to do your Task. My name is Avinash Singh and I am a Full Stack Developer with experience of 6 years. About my work on Php / MySQL : A. Php Plus

30 $ USD en 1 jour
(5 Commentaires)
25 $ USD en 1 jour
(24 Commentaires)
25 $ USD en 1 jour
(6 Commentaires)

Hello dear, i can do this for you. i have read your requirements. seriously, if you want this work be done, contact me so that i can be able to help you Thanks. and Take care..

30 $ USD en 1 jour
(10 Commentaires)

Greetings from InfoRidge Technology !! Pls go through our work will help you to take decision . [url removed, login to view] Below is a gist of our work. * [url removed, login to view] --- E-Commerce Plus

30 $ USD en 1 jour
(7 Commentaires)

Hello there. This looks like a simple task and I should be able to deliver it quickly. We can discuss more details over chat if you're interested. Thanks in advance. Best regards, Diogo Bragança

30 $ USD en 1 jour
(10 Commentaires)
18 $ USD en 1 jour
(12 Commentaires)

Hey, I had a chance to go through your complete job description. And we think this is the best project matching with our skills. I would like to have a verbal conversation with you to walk through your web developmen Plus

25 $ USD en 1 jour
(1 Commentaire)
20 $ USD en 0 jours
(3 Commentaires)

Greeting, I am Hassan and i would love to have the chance to discuss your project. looking forward Hassan B

17 $ USD en 2 jours
(0 Commentaires)

Hi, hope you're fine. This is an easy task, should be something very quick. I'm a web developer and database admin. If you agree, I would suggest to use the same query with an "UNION" clause to merge the record fro Plus

15 $ USD en 1 jour
(0 Commentaires)