473,756 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

populating mysql using php

anfetienne
424 Contributor
hi this question is linked to this post ive made in the mysql section.

http://bytes.com/topic/mysql/answers...le#post3499253

simply i want to use a form to populate a table with the locations of images, thumbnails and their corresponding captions. i want to populate the table like this:

id image location thumbnail location caption

1 folder/image1.jpg folder/t/image1.jpg just a test
2 folder/image2.jpg folder/t/image2.jpg just the test
3 folder/image3.jpg folder/t/image3.jpg just to test

is it possible to loop php to insert data into more than one row in a mysql table like shown above?
Jul 14 '09 #1
14 3764
anfetienne
424 Contributor
ok i have solved how to insert multiple rows in sql but is it possible to loop this in php so it inserts the correct amount of rows for the amount of images?
Jul 14 '09 #2
Dormilich
8,658 Recognized Expert Moderator Expert
consider using a Prepared Statement (it's faster than multiple queries)
Jul 14 '09 #3
pdkadam
6 New Member
yes you can loop it exactly the no. of times the amount of images you have.
for that purpose u will have to set a variable to count the images. this variable will first check the no. of images and will restrict the loop to execute that many no. of times.
now how that can be done? u need to tell whr r the images stored & fetched from.
Jul 14 '09 #4
anfetienne
424 Contributor
cant find anything on multiple insert with prepared statements
Jul 14 '09 #5
anfetienne
424 Contributor
and pdkadam....i want to do this on upload not once its stored it will be alot easier that way because i can get this image and thumbnail locations once the code has been run in vars and then just add them into the sql (which is the last thing to run within the php script).

i think i will be using a foreach loop, i will set a array in the form called id[] but wont store this into the database as the project number will be stored as an id for later and easier retrieval. the images are already an array so therefore i have the captions to change to an array and then write my foreach loop....

i will be back with the results...thank s for the help guys
Jul 14 '09 #6
Dormilich
8,658 Recognized Expert Moderator Expert
@anfetienne
then you should read a bit more about prepared statements...

it basicly goes like this
Expand|Select|Wrap|Line Numbers
  1. // ...
  2. $ps->prepare($sql);
  3. foreach (...)
  4. {
  5.     // ...
  6.     $ps->execute($values);
  7. }
Jul 14 '09 #7
anfetienne
424 Contributor
Dormilich i dont appreciate the manner or tone of your last message.....sim ple fact is the link you sent explained prepared statements i read the whole thing and nowhere on that page did it give an example or state anything about multiple inserts. moderator or not you just rude....your answer wasnt needed especially in that manner as i previously stated that i found my way that i will use and i will return the results later.

thanks but no thanks for the answer!
Jul 14 '09 #8
anfetienne
424 Contributor
and i also searched it on google and for tutorials but it kept coming up with javascript!
Jul 14 '09 #9
Dormilich
8,658 Recognized Expert Moderator Expert
and i also searched it on google and for tutorials but it kept coming up with javascript!
I'd have thought you could have had a look at the PHP manual (eventually you need a PHP function to use Prepared Statements (just my train of thoughts)).

manual entry (further examples in the function discussions)

my google search

@anfetienne
1) I'm not modding PHP
2) I can't have a good day everytime. I'm a human after all and are bound to make mistakes
3) I'm sorry if I upset you

* – someone once told me that "reading the manual" is a rare skill nowadays…
Jul 14 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3902
by: Jason | last post by:
I have a client that would like to have drop down menus added to a nav bar that is generated from MySQL. Is it possible to have a dynamically driven DHTML menu from MySQL? example link http://www.msnbc.msn.com/Default.aspx?p1=0
1
1997
by: Robert Kattke | last post by:
I'm designing a site for local music and entertertainment and have a few ?s that need to be cleared up. Currently, I'm working on the Club part and have a Contact Person form, and a Club form. For the Club form, I'd like to have up to 4 Contacts with various roles, {Booking, Manager, Owner, All}. Ideally, I'd like to have a frameset and have Contact form filled out 1st, allowing me to set a cookie that would populate the...
1
3121
by: Ward B | last post by:
Greetings. I'm somewhat new to this whole MySQL/PHP thing and need a little help. My web hosting service uses phpMyAdmin and at the bottom of the screen iis an area where I can upload a text file to populate a table. I have a table named groups with two fields: groups_id auto-increment primary groups_name
1
3209
by: kurty | last post by:
Hello all, I am currently working on a project (a web based database) which entails the use of HTML, PHP and MySQL. I am new to all of these languages and would like some assistance in solving the following problem that I have encountered: The project entails ADDing ,EDITing, DELETing records from a web based database. However the main objective of this project is to allow users to perform queries on the data in the database and then view the...
4
20111
by: prosad | last post by:
hello, Just solved a problem using Javascript onclick, can click on any cell in a dynamic table and it will pass the innerText object value to my form text field. parts of code given below: <script type="text/javascript"> function select_cell(obj) { document.getElementById('complaint').value = obj.innerText; document.getElementById('selected_form'); }
0
1077
by: xhermit | last post by:
I'm creating a wiki-style website with a mysql database. I'm not to this point yet, but I'm thinking ahead of when I'll need to start populating the database. Obviously the point is for users to populate it themselves, but I've been to several travel wiki websites and it seems like they almost share identical information. Is there some sort of central data I could tap into? Or just wishful thinking? For instance, lets say I wanted...
2
9047
by: eihabisaac | last post by:
Hi everyone I'm using VS2005 C# with MySQL to do a windows application i'm also using Devart for MySQL i was able to populate a combobox from the database but i really want to populate the other combobox based on the first combo value
2
4555
by: eihabisaac | last post by:
hi all im using C# with mysql i want to populate the menustrip items based on the select statement bellow i can select the items from the table and show them but how to popule the MenuStrip private void Form2_Load(object sender, EventArgs e) { textBox1.Text = general.profile.getX().ToString();
14
4338
by: Philth | last post by:
Hi there, I've essentially got a form with several drop down, each populated by columns in various tables. The populating bit works fine - the column rows appear as they should in the menu. Ideally the user needs to make their selections, and enter the form into a new database table. The problem is, when the selection is entered into the new table, only the first word of the string is entered. For example, the drop down may have...
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.