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 curso
Publicado hace más de 9 años

$10-30 USD

Pagado a la entrega
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.
ID del proyecto: 6862843

Información sobre el proyecto

9 propuestas
Proyecto remoto
Activo hace 9 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
9 freelancers están ofertando un promedio de $24 USD por este trabajo
Avatar del usuario
A proposal has not yet been provided
$35 USD en 1 día
4,8 (413 comentarios)
7,0
7,0
Avatar del usuario
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 día
5,0 (55 comentarios)
6,2
6,2
Avatar del usuario
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 día
5,0 (9 comentarios)
4,4
4,4
Avatar del usuario
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 día
5,0 (37 comentarios)
4,4
4,4
Avatar del usuario
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 días
5,0 (7 comentarios)
3,4
3,4
Avatar del usuario
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 día
5,0 (1 comentario)
0,8
0,8
Avatar del usuario
let me check i will reply in minute......................................................................
$10 USD en 1 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
Warren, United States
5,0
22
Forma de pago verificada
Miembro desde ago 11, 2014

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.