Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Sensible Method Of Inserting Records In To MySQL


I have users using a third party windows application. They can export data
from this application directly to a text file (CSV). So far as I know,
there is no way to make this application talk directly to the MySQL server.

We're talking thousands of records here - it's not practical to have an HTML
form handled by PHP which inserts the data to MySQL... or is it??

What I thought about doing was to have them export the data to the CSV file
& then upload it to the web server using FTP.

Once uploaded, I would have
them go to a page with a PHP script which would run the command to import
the data to MySQL. PHP can run shell commands, as I understand it from the
manual. Perhaps this would be a bitch on Windows, though. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Inserting Master-detail Records In Mysql
how I can insert a master-detail record in mysql? I use an auto-increment key, but I don't know how I can find that key for inserting the detail records, I tried to make a 'highest-key' function with 'select MAX(field)...' but in php it gives the wrong key (in mysql it gives the right one).

View Replies !
Check For Errors Before Inserting Records In Mysql
I'm creating an auction script from scratch and I'm busy with the registration page. I was wondering if there is a better way to check that there are no errors when inserting the users profile into the database. ....

View Replies !
MySQL Inserting Into Multiple Tables Linked Records
Using MySQL can anyone tell me how to most efficiently insert a collumn
in 'table1' retrieve the id from this record and insert mutliple
records into 'table2' with a collumn for the id in 'table1' which links
the two recordsets

View Replies !
Inserting Records
I'm trying to insert as many as records as possible but less than 100 into a table. First, i get the count inorder how many to add and then depending on the count, i get so many blank form fields to enter. Now, I noticed something really strange.

1.Only the last entered record is inserted into the table.
2.For example, when I type a name, Let us assume "WORLD", only w is inserted into the table and the rest is not.It is the same with all the form fields.whether, i'm trying to enter text or a number,only the first character is inserted.This sounds weird. Could somebody pls tell me why is this peculiar behaviour Here is the code:

View Replies !
Inserting New Records- But Want To Know Fields From Other Tables Too?
I am doing a very simple website for a running club,and am rather new to mysql and php. The database just has 3 tables, member , race, and results.

member has stuff about the member, primary key is member_no.

race holds race details, e.g. race_no (primary key), the race name, etc.

results holds results for each race, primary key is member_no and race_no, the only other data recorded is the time.

basically i want a page where you can enter the results for a particular race. but im not sure how to do this, since it is pretty unreasonable to expect someone to remember a race's id no and a members id no, how can you allow them to enter (on a simple html form on the site) for example the members first name, the race's name AND its date (as some races are called the same on different days) along with the result time and then just update the results table?

View Replies !
Checking To See If 2 Records Exists Before Inserting
I have a webpage with multiple form fields on it, one for name, address, email and comment.

I use php to connect to a mysql db that has all those fields in it and the script the checks if name and email exists, if they dont it inserts the form fields to a new entry, if they do exist it redirects to another page.

My problem is I seem to mess up the checking of the two fields part. I thought I'd been clever and set it up so that it checks if both fields exits in a given row but users can not add just a name without and email adress. Code:

View Replies !
Having Trouble Inserting Records To A Table.
currently i am using the code:

$query ="INSERT INTO table_name (Field_name) VALUES ($name)";
$result = mysql_query($query);

and it doesnt seem to be inserting.

am i doing it wrong?

View Replies !
Inserting Multiple Records From 1 Form. How?
i have a page that lets you input a number which is passed to a php script that generates rows of textboxes / records (first name, last name). how do i pass these rows / records into the database? Code:

View Replies !
Inserting Records Into A Microsoft Access Database...
I'm still new at using PHP although thanks to these forums I'm learning quite a lot. Currently, I am trying to insert a new record into my access database.

I can display records from it but not add new ones. I know that I am to use the 'INSERT' SQL function but how would an Access Database be different from mySQL?

So far I've seen only mysql examples and havent been able to find anything on access...

View Replies !
Form Processing - Create The Page And Have The Records Inserting
I can create the page and have the records inserting, without any issue, but the problem I'm having is trying to understand the process involved. I can find lots of tutorials on how to insert records but none on the logic behind it. Can anyone point me in the direction of a tutorial.  What I'm trying to understand is the how the form submits the page (to where I'm not sure) and then executes the form handling. I'm using Dreamweaver to create the insert form, if that is of any consequence.

View Replies !
Execute Ancestor Method Before Descendant Method From Another Method
Is there any way to invoke the ancestor method and then the descendant
method? I'm not saying:

parent::method();
...
<script for the current method>

What I'm looking for is to manually execute the ancestor method
(bypassing the descendant method) and then execute the descendant
method from 'another' method. All of this execution is done from
another method. Reflection class or something?

View Replies !
MySQL Connection Method With PHP..?
I have done a search and could not find an answer for this although I am sure someone has asked this before. What I am looking to do is this say I have 5 PHP files on a website and they all use the same database and mysql_connect string. PHP Code:

View Replies !
MySQL Generic Entry Method?
So I am wondering if there is a way for me to generically enter values into a database. This is only for INSERTS UPDATES and DELETEs. I want to write a functions that build queries for me.

But I can only build the first part with my current knowledge, I can only build "INSERT INTO table(col1, col2, col3)" or "UPDATE table SET ". I want to be able to write the entire query without having to worry about types. Is there a way to do that in PHP or MySQL?

View Replies !
Good MySQL Search Method?
I usually program my search using the "LIKE %$search%" method and I find the results to be not so good. I've tried using regular expression as well as full-text searching and they all have their pros and cons. I would like to know what method people here use to program their search in and find that method to be useful.

View Replies !
MySQL Result Can't Be Returned From Class Method.. ?
I've been messing around with objects and classes lately and can't figure out why this wont work.

I have index.php which uses the pbMySQL class (pbMySQL.class.php) and methods:
Code: include("lib/pbMySQL.class.php");

$db = new pbMySQL;
$db->pbMySQL_open("localhost","user","pass");
$db->pbMySQL_useDB("database");

// $q=$db->pbMySQL_query("SELECT * FROM pbn_news ORDER BY id DESC");
$q=mysql_query("SELECT * FROM pbn_news ORDER BY id DESC");

if(isset($q)) {
while($row=mysql_fetch_array($q)) {
print $row['name']."<br>
";
}
} else {
print "query returned FALSE";
}

$db->pbMySQL_close();

My problem is that when I use the first query method (which is commented; uses the pbMySQL_query() method) I do not get the mysql result returned, but if I use the same query without the method, I get the result. Here is the method from my class:
Code: function pbMySQL_query($query) {
if(!isset($this->conn) || !isset($query)) {
print "Error : argument(s) missing.<br>
";
} else {
$this->query = mysql_query($query,$this->conn) or die("Error : query failed.<br>
mysql said: <i>".mysql_error()."</i><br>
");
if(isset($this->query)) { return $this->query; } else { return FALSE; }
}
}

The method returns FALSE and I don't understand why. Is it something in particular I have to do different when using a class?

View Replies !
Method To Bypass FILE (MYSQL) Privileges..
I run psychology website and have a database that contains members of an psychological association. The admin of the server has assured me that i have all the privileges regarding the database access. It seems not because i cannot import my database on the remote server. I have all other rights, but how can i upload my database without using the LOAD DATA syntax?

I thought if i make a php script and use this with some loop command so that i can insert records without running into the upper mentioned restriction. So to say, take 1 record at a time and use insert and update commands.

Would this be possible? If it would be, i wouldn't know where to start, in what format should i export my local database, should i put it on my html server and from there run the php code?

View Replies !
Inserting To Mysql
my data are in an array and there's a problem when im inserting it in mysql. the values are null.

View Replies !
When Inserting Into MySQL
I use this format in PHP to get a date. date("Y-m-d"); And I use the proper field in MySql and get the proper date most of the time in my file upload form. But I am currently getting a user then when she uploads a new file, it puts and old date in MySql, in this case 2005-12-05, instead of todays date, 2005-12-21. When I upload a file I get the proper date inserted into mysql. I have turned off Caching options with headers:

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: Mon, 26 July 1997 05:00:00 GMT");
header("Pragma: no-cache")

But the auto date is still posting the date of 2005-12-05.

View Replies !
Inserting Into MySQL
For some reason im having trouble inserting into a database. Here is the code:

View Replies !
MySQL Inserting
I've just started playing with ENUM/SET field types and so far I love em'. only thing ihavent been able to find via google is examples of insert and update query statements.

View Replies !
Get Method Works But Not Post Method On PHP 5.0.4 Pages
I am unable to display PHP pages generated by a submission of a form
using a POST method. To illustrate this, I created a very simple form
called TestForm.php .

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Test Form</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr><td>Name</td><td><input type="text" name="name0"/></td></tr>
<tr><td>Age</td><td><input type="text" name="age0"/></td></tr>
</table>
<input type="submit" name="SubmitMe" value="Submitted" />
</form>
</body>
</html>

I first set the method for the form to GET and the page loaded again
after the submit.
When I changed the method back to POST, I received a Page Not Found
error page.
I created another page testform3.php to display the Form Values after
submit. I changed the action on the form to testform3.php.

View Replies !
Variable And Inserting Into MySQL
I have a PHP script that pulls data from an external URL. I can fetch and print the data without using a MySQL database, but I can't figure out how to add a separate entry for each "idnumber". Here is a snip from my code that relates to what I'm referring to:

How can I insert them into the MySQL database. Here's what I've tried, but it isn't adding the info to the database.

$sql = "INSERT INTO clients SET IDNumber = '". $client[$i]['idnumber']. "',

View Replies !
Inserting Data Into Mysql
I have a simple loop
include '../php_library/connect.php'
include '../php_library/opendb.php'

$conn=mysql_connect($host,$dbuser,$dbpass) or die ('Error');
mysql_select_db($dbname);
//Open the file
$fp = fopen($src,"r");
//for each line in the file
while ($row=fgetcsv($fp,10000,'')) { //Get line
$sql_insert="INSERT INTO ...";
if (!mysql_query($sql_insert,$conn)){
OutputError($sql_insert,$mysql_error());
$FailedCount++;
}
else {$InsertCount++;}
}

It works fine for the first couple of hundred or so rows but the stops -
no errors, it just stops mid-loop.

I'm guessing some sort of buffer problem (needs flushing?) but it is a
guess.

I'm running this all locally - XP, Apache2, PHP5, mySQL 4.1

View Replies !
Inserting HTML Into Mysql, Is It Possible?
i want my users to be able to insert html into my mysql database, is this possible?
and how would i go about doing it, or could you point me in a direction that would tell me?

View Replies !
Parsing Xml And Using Php Inserting In Mysql
How to parse this xml and generate php code to insert to mysql.In this example xml there are 3 articles, one with 2 photos and the others with just one. A Php5 solution requiered. Code:

View Replies !
Inserting Php Arrays Into Mysql
I am working on a project where I am dealing with over 10,000,000 records and I was wondering if it is possible to slice these records into multidimensional arrays of say 1,000,000 records each and then insert them into mysql with 10 inserts statements rather than the 10,000,000 insert statements I am currently using...

I know there is a way to extract data to an array, but is there a way to then take an array and plug it into mysql without doing millions of iterations?

View Replies !
Inserting Data Into Mysql Db
i was trying to insert a data into mysql db but my system inserts a given data twice. i tried to sort out the problem but i faild. Code:

View Replies !
MySQL Not Inserting All Data
I'm using php to dynamically create a query from an array. When the query is run, it doesn't always insert all of the data. Some of the last columns are ignored. It happens on very long inserts... with over 50 columns in the table. Code:

View Replies !
Inserting Record Into Mysql
If someone goes to mypage1.php and their ip address is already in my mysql database, how can I find that record and update the "status" field so it says "Yes"?

View Replies !
MySQL Inserting Data
I have a form with two fields, firstname and lastname. I am trying to insert data into my mysql database, but unable to do so. Following is the script on my action1.php file

<?php $username="***";
$password="***";
$database="***";
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
mysql_connect(***,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "INSERT INTO pko_userinfo (firstname, lastname) VALUES ('$firstname', '$lastname')";
mysql_query($query);
mysql_close();
?>

View Replies !
Inserting A CSV Into MySQL Via Page.
I'm building an e-commerce site, where the owner needs to be able to
upload a CSV file of product that gets inserted into mySQL.

Unfortunately, I think my Web host may have some functions turned off.
Is there some other ways I can try to do the following? Code:

View Replies !
Validation Before Inserting Into Mysql
I setup a field that captures ip, host, etc. on the database when a new record is added.  I noticed that my "ip catching" field has a NULL value when those spam messages get inserted. 

The other records (the real ones) all get populated with the IP address and other info.  So, I figured I'd validate the user's ip as they are about to insert a record... I figured I could stop the insert if the user doesn't show an IP address.  So I use the following if statement to check for user info. Code:

View Replies !
Inserting Timedate Into Mysql
i heard that in order to insert time or date correcly in your mysql database you must have unix_timestamp or something.

View Replies !
Problem Inserting Into Mysql Via Php Form
Well let me get right to it, I have the following form:

View Replies !
Inserting Speacial Chars Into Mysql DB
I'm working on a shopping cart and want to store user info in the DB (credit cards). I have used php's mcrypt to encrypt cc numbers which all works fine, but when I try to store an encrypted number in the DB I get problems. For example, here is an encrypted CC:

View Replies !
Inserting Values Into MySQL Using A For Loop In PHP
I have an html array I am trying to insert the values from into my database.I have no idea how to do this using a for loop.These are not seperate rows that I want to insert, but rather one row with these values in the columns they are meant for. PHP Code:

View Replies !
Problems Inserting Data Into Mysql
I am trying to load data into the mysql database from a tab delimited text file. The Text file has 15455 rows, so I should expect that many records to be created when I load the data into the table. However it only gets to 12692 records, and I get 15455 warnings (the expected amount of records). Code:

View Replies !
Inserting Array Into Mysql Table
Anyone know the best way to insert an array from a form into a mysql table. My array is validated from the form and then inserted into the db, only when I SELECT it, it merely saya 'array' in the field.

View Replies !
Inserting Php Code Into Mysql Field
Im trying to display a variable '$downloadimage' which is in my head.php file. I am trying to display this on my page by inserting this code into one of my mysql database fields: -Code: <? echo $downloadimage; ?>

When the page loads there is nothing there (i only have text in the variable at the moment), my html code shows the PHP echo code as text.

View Replies !
Removing Linebreaks When Inserting To MySQL?
I'm using a textarea to insert some notes into a database.
It's inserting the complete result into the mySQL table including the
linebreaks...and not as a visible symbol but an actual linebreak. If I
select the fireld in mySQL at a command prompt, the results take an
inordinate amount of space from all the linebreaks.

I tried nl2br() before it goes into the INSERT, but all that does is ADD <br
/> to the data but it still have linebreaks in the field.

Is there some way to replace linebreaks with something else than the break
itself so I can save database space?

View Replies !
Inserting Formatted Text Into Mysql ?
is there a way to format the text from a multi-line textfield (html), including line breaks, tabs etc. and to properly insert it into a mysql-table ?

View Replies !
Problem Inserting Data Into MySQL
I am having a problem inserting data into MySQL what can be the problem ??

$SQL_insert = "INSERT into borrow VALUES ('','$bok_id','$bok_nam','$stu_id','$stu_nam','$DOI','$due_dat','','')";
mysql_query($SQL_insert)or die("Couldnot insert");

Database structure:

The first column is auto increament and last two columns can be null. Date is also in : m/d/y format so MySQL should accept tht as it is.

View Replies !
Inserting Image Url Into Mysql In A While Loop
I have a multiple image up loader to upload images to a server. Now while it uploads the file I want it the insert the link to the image in the database. What I have works, but not exactly how I want.

I have a table called hpics with 10 fields, 1 of them is called id, which in turn is not auto_inceremented, because I want to insert the id. Now, I'm trying the insert all 9 images, when uploaded, with 1 row with an id. Instead it uploads the images as seperate rows, instead of the fields Code:

View Replies !
Inserting A Null Value Into Mysql Database
i have a form that submits data to a php result page. i then insert that data into a mysql database. Null values ARE allowed and the problem is when i try to insert a null number value, it errors.

$ticket_number = $_POST['ticket_number'];
$another_number = $_POST['another_number'];

$query = "INSERT INTO ticket (ticket_number, another_number) values ($ticket_number, $another_number);
mysql_query($query) or die(mysql_error());

ticket number is required, but another_number is not.
error: youg have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near ')' at line 1

the ')' refers to the end of the close parenthasis in the sql statement. the thing is, in mysql i could have just done:

insert into ticket (ticket_number, another_number) values (1, NULL);

how do i replicate that in a php statement. the same thing happens with a null date type too. There has to be a way!

View Replies !
Inserting Apostrophes Into MySQL Field...
Trying to insert a height input into a MySQL table's field:

<select class='normal' name='height' size='1'>
<option value='5''>5'</option>
<option value='5'1"'>5'1"</option>
</select>

the height variable is then inserted into the database. Looking at the table afterwards with phpMyAdmin shows that it contains only: 4

I'm escaping the apostrophes and speech marks for obvious reasons, but I imagine there's a proper way of doing this. Of course, selecting the height field from the database and echoing it to the page also just shows: 4

View Replies !
Inserting Empty Data Into Mysql
I am creating an interface for my wife to keep track of what cross stitch threads she has. I have created a text area so she can enter a bunch at a time. I am trying to get the script to skip over blank lines. Code:

View Replies !
Inserting Data Into A Users Row In Mysql
i'm not sure if this is possible but this is what i'm attempting to do:

1)I Have made a registration page for a user to fill in and submit <-- ok

2)Once they do they can login to thier account <-- ok

3)the minute they are in thier account they can upload a photo/avatar and it submits the path/filename e.g to the database "grahamspicture.jpg" for example.

but what i'm not sure about is HOW to post that logged in users data back into the mysql database, once that particular user logs in how to make mysql know to post the path in grahams mysql row under photo (i hope that made sense) Code:

View Replies !
Inserting Php_auth_user Into Mysql Table
I am simply trying to insert the username('PHP_AUTH_USER') and password('PHP_AUTH_PW') from a HTTPS authentication screen into mysql table, This does not work anymore system uses php4.4.1 with Apache 2 Code:

View Replies !
Inserting Unique Record MySQL
Are you able to check if a record that you are about to insert into one table isnt already located in another table? Obviously I can do a select query and check that way, however I am inserting multiple values in one statement and this is not efficient. The column is called "URL" in both tables and they are both set to unique. Can I somehow check if the value I am inserting is unique to both tables?

View Replies !
Inserting Special Characters In MySql
I got problem with inserting following code in mysql:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

or

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com"
>

i want that this code is shown like this on page, any suggestion?

View Replies !
Inserting Encrypted Data Into MYSQL DB
I am making a script that uses mcrypt to encrypt the data submitted from a user and inserts the data into a database. Everything works except the encrypted data won't submit into the database. It keeps coming up with this error message
Code:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '´ó˜m<ßÍF׆½ÃaâF =tgFX]O⪠ؼߝ–F[bé4}÷´ÙmdSá>M5<édèèåñûÄÄ' at line 1

I am assuming it has something to do with the quote signs into the encrypted data but I may be worng. What is the solution around this?

View Replies !
Problem Inserting Into Mysql Table
I am developing a shopping cart but have run into a problem. Here is part of my code...

$putitems = mysql_query("INSERT INTO cart (UserID,Item,Manufacturer,Model,Price) VALUES ('$userinfo','$additem','$addproducts[manufacturer]','$addproducts[model]','$addproducts[price]')");

...which works fine but I want to also add the product description, so I do this...

$putitems = mysql_query("INSERT INTO cart (UserID,Item,Manufacturer,Model,Desc,Price) VALUES ('$userinfo','$additem','$addproducts[manufacturer]','$addproducts[model]','$addproducts[briefdesc]','$addproducts[price]')");

...and it refuses to insert the record at all. Does anyone have any suggestions as to why this is happening?

View Replies !

Copyright 2005-08 www.BigResource.com, All rights reserved