Find Jobs
Hire Freelancers

Fix my php foreach loop and write a function to populate a mysql DB table with data in a multidimensional array

$10-30 USD

En cours
Publié il y a plus de 9 ans

$10-30 USD

Payé lors de la livraison
I wrote a multidimensional array called $foods. I added 181 items to the array. Each item has an array with 4 key=> value pairs. When I try to write the foreach loop to add all the keys and values of the array into an array called $foods, I get "null" when I do var_dump($foods). I've been working on this stupid array for a week and have tried everything I can find online. The function is here: [login to view URL] Nothing I do works. So then I decided it would be better to use a table in the mysql DB rather than an array. But I don't want to go and re-write everything into an SQL command. I know there's a way to write a php function to load all data in the array into the DB table. Will you help me write this function? I found this on stackoverflow: $fields=array(); $values=array(); for($i=0;$i<count($array);$i++) { $fields[]=$array[$i]['field_name']; $values[]=$array[$i]['field_value']; } if(count($array) > 0) { $query="Insert into tablename (".implode(",", $fields).") values (".implode(",", $values).")"; mysql_query($query); } but do I use 'field_name' and 'field_value' or am I supposed to enter something that pertains to my table there? My table has 4 columns - the primary key auto-incrementing id, name, value, and addinfo. So task #2 is write me a function so I can populate my db table without having to rewrite everything as an SQL command.
N° de projet : 6862843

Concernant le projet

9 propositions
Projet à distance
Actif à il y a 9 ans

Cherchez-vous à gagner de l'argent ?

Avantages de faire une offre sur Freelancer

Fixez votre budget et vos délais
Soyez payé pour votre travail
Surlignez votre proposition
Il est gratuit de s'inscrire et de faire des offres sur des travaux
9 freelances proposent en moyenne $24 USD pour ce travail
Avatar de l'utilisateur
A proposal has not yet been provided
$35 USD en 1 jour
4,8 (413 commentaires)
7,0
7,0
Avatar de l'utilisateur
I would like to apply this job, My experience of 5 years in development and my implementation power keeps me one step ahead for working with any web based application with a very high speed. I am pro with PHP, Zend, Wordpress, & CakePHP and other related technologies. Why me? I believe in Pro active communication and quality delivery. I ensure you that I will satisfy with my work. We can discuss more over chat. Thanks
$25 USD en 1 jour
5,0 (55 commentaires)
6,2
6,2
Avatar de l'utilisateur
Hi, I am engineering graduate having 5+ years of web designing and development experience. My expertise lies in Wordpress, Magento, Smarty, Cake PHP and can do any kind of customization in all those along with Core PHP. In addition to that I can create PSD layout and can convert that in responsive web pages, templates and themes as per requirement. Frontend development is totally under my expertise with CSS2/CSS3, HTML4/HTML5, XHTML, JavaScript/JQuery and Bootstrap frontend development framework. As per your job posting I do have quite good experiencem to do your job. Its a very basic job for me as I usually deals with PHP/Mysql daily basis. I can not only insert your data into database infact help you to optimize all things in the process. Please let me know your suitable time to discuss over PM once in detail. For sure you will get your will get your job done. Just to be safe I usually do not bid on work that I didn't do or cannot do. So you should not face any delay and all. Let’s give me a try I am very sure you would not get disappointed. Looking forward to hear from you. Best Regards Dinesh Singh
$20 USD en 1 jour
5,0 (9 commentaires)
4,4
4,4
Avatar de l'utilisateur
Let me write it for you . Please give me one hour for this task i will make it as you want . Thanks in advance . Best regards
$25 USD en 1 jour
5,0 (37 commentaires)
4,4
4,4
Avatar de l'utilisateur
Hi there, I’d like to be considered for your project. I’m a strategic developer with a strong background developing various web related projets based on PHP. Whether you need a troubleshooting or development from scratch, I can make the transition with ease. For 3 years I’ve worked in web development and so I am accustomed to working with almost all php frameworks which includes MVC(Yii, CakePHP, CodeIgnitor), CMS(Wordpress,Joomla) and Ecommerce(openCart). I have a deep passion for research and development so I can proudly guarantee that all of my development work is 100% original and have quality. I highly value professionalism and hold myself strictly accountable to represent my client’s brand. I aim to form a long-term working relationship. If you are interested in a larger volume of work each month, I can offer a lower rate. Please, let me know what is needed to secure this bid! Thank you for your consideration. Cool Coder
$30 USD en 2 jours
5,0 (7 commentaires)
3,4
3,4
Avatar de l'utilisateur
Hi. I am a web developer who is specialized in PHP. I would like to help you solve your foreach problem. Could you contact me and send me your codes of array? Thank you.
$25 USD en 1 jour
5,0 (1 commentaire)
0,8
0,8
Avatar de l'utilisateur
let me check i will reply in minute......................................................................
$10 USD en 1 jour
0,0 (0 commentaires)
0,0
0,0

À propos du client

Drapeau de UNITED STATES
Warren, United States
5,0
22
Méthode de paiement vérifiée
Membre depuis août 11, 2014

Vérification du client

Merci ! Nous vous avons envoyé un lien par e-mail afin de réclamer votre crédit gratuit.
Une erreur a eu lieu lors de l'envoi de votre e-mail. Veuillez réessayer.
Utilisateurs enregistrés Total des travaux publiés
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Chargement de l'aperçu
Permission donnée pour la géolocalisation.
Votre session de connexion a expiré et vous avez été déconnecté. Veuillez vous connecter à nouveau.