473,549 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sql insert question

hi all thanks again for all th direction you guys have given me..

i have a partial backend done for uploading graphics to a directory
and information into mysql. Now what i'm having problems with is
getting the file path with the file name to upload to the sql
database.

Right now i have 2 unique qualifiers carrying over (jobnum, custID).
I'm querying the database to find those matching qualifier and i need
to fill in the file name into the directorytile field in the db. here
is what i have now (excuse the sloppy code i'm a newbie!):
<?php
mysql_connect ('localhost', 'acme', 'acme') ;
mysql_select_db ('olcg');
$query = mysql_query("SE LECT directorytile FROM itl WHERE
jobnum='$jobnum ' AND custID='$custID '") or die (mysql_error()) ;

if (isset($_POST['submit'])) {
$sql = "INSERT INTO itl SET
directorytile=' $file_name'";
}
?>

<?php

if($file_name !="")
{
copy ("$file", "/home/guestdir/www/olcg/$file_name")
or die("Could not copy file");
}
else { die("No file specified"); }

?>
again thanks so much!!!!!
Jul 17 '05 #1
1 1569
ph*********@com cast.net (Mikey P) wrote:

hi all thanks again for all th direction you guys have given me..

i have a partial backend done for uploading graphics to a directory
and information into mysql. Now what i'm having problems with is
getting the file path with the file name to upload to the sql
database.

Right now i have 2 unique qualifiers carrying over (jobnum, custID).
I'm querying the database to find those matching qualifier and i need
to fill in the file name into the directorytile field in the db. here
is what i have now (excuse the sloppy code i'm a newbie!):
...
mysql_select_d b ('olcg');
$query = mysql_query("SE LECT directorytile FROM itl WHERE
jobnum='$jobnu m' AND custID='$custID '") or die (mysql_error()) ;

if (isset($_POST['submit'])) {
$sql = "INSERT INTO itl SET
directorytile=' $file_name'";
}


INSERT is only used to add an entirely new record. To update the fields in
an existing record, you use UPDATE. Further, an SQL connection has no
concept of a "current record", so you have to tell it exactly which
record(s) to update. Hence:

$sql = "UPDATE itl SET directorytile=' $file_name' " .
"WHERE jobnum='$jobnum ' AND custID='$custID ';";
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3084
by: Bob Bedford | last post by:
I've a textarea and would like to save the content in a mysql table each time a user click on a form. How can I do for avoiding error when the user put a " or a ' in the message, or any other character that may cause problems. My query is: "insert into questions(UserID,Question) values (".$HTTP_POST_VARS.",'".$HTTP_POST_VARS."')"
8
5507
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table records are manipulated to control the permissions. Example: The Press...
4
6915
by: soni29 | last post by:
hi, i have a small question regarding sql, there are two tables that i need to work with on this, one has fields like: Table1: (id, name, street, city, zip, phone, fax, etc...) about 20 more columns Table2: name what i need help with is that table2 contains about 200 distinct names that i need to insert into table1, i'm using sql server,...
5
4706
by: TThai | last post by:
HI, I'm trying to insert records to a table using bcp command. The problem is the input file to the bcp is a text file that looks like this: Text file data: 1234 abc def ghi jkl mno Expected result: column1 1234
11
7491
by: Jean-Christian Imbeault | last post by:
I have a table with a primary field and a few other fields. What is the fastest way to do an insert into that table assuming that sometimes I might try to insert a record with a duplicate primary key and want that to fail? I know that if I try a plain insert this will work, but in the case where I am trying to insert a duplicate key, the...
25
11073
by: Andreas Fromm | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Im building an user database with many tables keeping the data for the Address, Phone numbers, etc which are referenced by a table where I keep the single users. My question is, how do I get the "Id"-value of a newly inserted address to store it in the referencing user table:
16
3855
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but...
1
3026
by: javedna | last post by:
Can PHP help with the following as I have tried in the MYSQL Forums and cant get any help Thanks Nabz ---------------------------------------- Hi I am developing a PHP MYSQL questionnaire tool. The problem I am having is that of inserting all the answers into the table. The questionnaire is Dynamic so the number of questions can vary. I...
10
10484
by: Aditya | last post by:
Hi All, I would like to know how it is possible to insert a node in a linked list without using a temp_pointer. If the element is the first element then there is no problem but if it is in between then what is the best solution.
24
7096
by: Henry J. | last post by:
My app needs to insert thousand value rows into a mostly empty table (data are read from a file). I can either use inserts, or use merge. The advantage of using merge is that in the few cases where the table is not empty, it can take care of the updating part, which makes the app cleaner. However, my concern is the merge state would slow...
0
7524
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7451
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...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7960
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...
0
7812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5372
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...
1
1944
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
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
766
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.