Solved

insert into two tables

Posted on 2007-11-25
2
1,869 Views
Last Modified: 2012-06-21
I'm still new at php and mysql, so hope I've given the correct info here to help you answer my question.

While the data is being added to the table using the below code, I need to also add the name and filepath date to a second table. This entry in the second table will be new entry in it. Is it possible to do this, and if so, how would I best accomplish that? I've not included the form portion of the code, but if it's needed, please let know.

if((array_search(stristr($fileName, '.'), $allowedExtensions))) {

// They are allowed to proceed with the upload
 

$query = "INSERT INTO cms_file_entries (name, CatID, file, size, type, path, Description, importance ) ".

"VALUES ('$fileName', '$CatID', '$file', '$fileSize', '$fileType', '$filePath', '$Description', '$importance')";
 

    mysql_query($query) or die('Error, query failed : ' . mysql_error());  
 

	echo "<br><strong>File uploaded</strong><br>";
 

} else {

   // They are not allowed to proceed with the upload - notify them of same

   echo "<strong>Sorry, you are not allowed to upload that sort of file.</strong>";

} // end if

Open in new window

0
Comment
Question by:nascent1
2 Comments
 
LVL 28

Accepted Solution

by:
gamebits earned 500 total points
Comment Utility
Just add a second insert query in the script, could be name $query2 = INSERT....
0
 

Author Closing Comment

by:nascent1
Comment Utility
Thank you! :)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 1 30
Why isn't this loading my css file 2 22
PHP connection to remote AWS MySQL RDS 4 34
html input clean up 3 28
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now