Re: [PHP-DB] insert into mysql-db from csv-file

2005-01-18 Thread Ruprecht Helms
Hi John,

I want to read a csv-file and import the datas into a mysql-db.
How do I make this. A little scriptexaple in php would be helpfull.

Why not just LOAD DATA INFILE from MySQL? No need to involve PHP at all, 
really...

I think the command you also can write in the mysql_db_query-Command.
The problem the insertprocedure must be able via webbrowser.
Regards,
Ruprecht
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] insert into mysql-db from csv-file

2005-01-17 Thread John Holmes
Ruprecht Helms wrote:
I want to read a csv-file and import the datas into a mysql-db.
How do I make this. A little scriptexaple in php would be helpfull.
Why not just LOAD DATA INFILE from MySQL? No need to involve PHP at all, 
really...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] insert into mysql-db from csv-file

2005-01-17 Thread Bastien Koert
rtfm
http://ca3.php.net/manual/en/function.fgetcsv.php
bastien
From: Ruprecht Helms <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: [PHP-DB] insert into mysql-db from csv-file
Date: Mon, 17 Jan 2005 17:26:56 +0100
Hi,
I want to read a csv-file and import the datas into a mysql-db.
How do I make this. A little scriptexaple in php would be helpfull.
Regards,
Ruprecht
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] INSERT into mysql from dynamic drop down

2004-01-07 Thread Aleks @ USA.net
Hello  Irin,

Not sure where you problem is but here is what I would check first.

After you open the page that has the drop down list, view the source and
See if the OPTION VALUE= has any value assigned to it. If you are using
IE, on the menu bar click on View - Source. 

Second, if that is fine, after you echo the value, you still need to either

1. set the value for $tutor_name in your sql statement - $tutor_name =
$_POST["tutor_name"];
2. Change your sql statement - instead of $tutor_name, say

$sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,
timetable_time)
VALUES
('$class_code','$_POST["tutor_name"]','$edu_level','$timetable_day','$timeta
ble_time')";

You will have to play with the " and ' to get this right..
I would suggest option 1

Hope this helps..

Aleks

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 1:37 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP-DB] INSERT into mysql from dynamic drop down


Hi all, 

   Right now i would like to INSERT the values from a dynamic drop down
menu into mysql database but encountered some problem here. Values in the
drop down menu are retrieved from DB as follows:



 "
.$row["tutor_name"]. "";  } $result = $db->query($sql);

?>





---

echo $_POST["tutor_name"];

INSERT statement:

$sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,
timetable_time)
VALUES
('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time'
)";


---

I am trying to POST the values and then INSERT into DB but was not able to
do so(all other values eg. class_code, edu_level etc...was able to be
INSERTED into DB but not "tutor_name". So, how do i insert values into DB
from a dynamic drop down and where have i gone wrong???Hope to get some help
real
soon.=)

All help are greatly appreciated. Thanks in advance.


Regards,
Irin. 

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] INSERT into mySQL over PHP (internet)

2001-05-03 Thread Russ Michell

> I'd like to have some kind of a GUI on the internet
Could you not use phpMyAdmin??

Download it for free from http://www.phpwizard.net/projects/phpMyAdmin/

Cheers.
Russ

On Thu, 3 May 2001 15:43:11 +0200 Nils Wetterich <[EMAIL PROTECTED]> wrote:

> Hi NG
> 
> Now that I finally realy work with the combination mySQL & PHP on a
> Windows-machine I began to just love it. There's only one problem I 
> still have:
> How can I INSERT data from a HTML-form to the database on the server? 
> I'd like to have some kind of a GUI on the internet so I could 
> administer and manage the database from everywhere I want.
> Please look at what I have yet. Maybe you can find the prob and help 
> me. (I have the idea that "mysql_query()" can't work with the variables 
> ($uName & $eMail).)
> 
> Thanx in advance,
> 
> Yours Nils.
> -
> 
> $con = @mysql_connect("host", "user", "password") or die("Oops... no
> connect.");
> $qry = "SELECT name, mail FROM TUsers";
> $res = mysql_db_query("database", $qry, $con);
> // $ins = "INSERT INTO TUsers (name, mail)
> //VALUES ($uName, $eMail)";  // --->  doesn't 
> work! $ins = "INSERT INTO TUsers (name, mail)
> VALUES (\"Any Name\", "\and eMail\");  // -->   
> works perfect!
> 
> mysql_query($ins) or die("Sorry. Couldn't execute INSERT.");
> 
> 
> Name:  eMail:  name="eMail"> 
> 
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

#---#

  "Believe nothing - consider everything"   
  
  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-30 Thread Robert

I found the problem. I didn't give myself write access to the database   :}

- Original Message -
From: "Darryl Friesen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 29, 2001 8:32 AM
Subject: Re: [PHP-DB] insert into mysql


> > > > > $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
> > >
> > > Another thought:  Are ID and part character data of some sort?  If not
> (i.e.
> > > if ID is an int) then remove the single quotes.
> > >
> > A trivial point this, but if you insert values in ' into a mysql int
> > column then MySQl still treats it as intended. THey aren' necessary for
> > int columns, but it is acceptable to have them there
>
> Thanks for pointing that out Tom.  That's a good bit of info to tuck away
> for later.
>
> We've been using MSSQL Server 7 here quite a bit lately, and it isn't
nearly
> as forgiving.  :(
>
> - Darryl
>
>  --
>   Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
>   Education & Research Technology Services, http://gollum.usask.ca/
>   Department of Computing Services,
>   University of Saskatchewan
>  --
>   "Go not to the Elves for counsel, for they will say both no and yes"
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-29 Thread Darryl Friesen

> > > > $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
> >
> > Another thought:  Are ID and part character data of some sort?  If not
(i.e.
> > if ID is an int) then remove the single quotes.
> >
> A trivial point this, but if you insert values in ' into a mysql int
> column then MySQl still treats it as intended. THey aren' necessary for
> int columns, but it is acceptable to have them there

Thanks for pointing that out Tom.  That's a good bit of info to tuck away
for later.

We've been using MSSQL Server 7 here quite a bit lately, and it isn't nearly
as forgiving.  :(

- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-29 Thread Tom Carter



On Thu, 25 Jan 2001, Darryl Friesen wrote:

> 
> 
> > It still didn't work.
> > just says unable to add part
> 
> > > $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
> 
> Another thought:  Are ID and part character data of some sort?  If not (i.e.
> if ID is an int) then remove the single quotes.
> 
A trivial point this, but if you insert values in ' into a mysql int
column then MySQl still treats it as intended. THey aren' necessary for
int columns, but it is acceptable to have them there

-Tom > 
> - Darryl
> 
>  --
>   Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
>   Education & Research Technology Services, http://gollum.usask.ca/
>   Department of Computing Services,
>   University of Saskatchewan
>  --
>   "Go not to the Elves for counsel, for they will say both no and yes"
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-25 Thread Robert

They are both set as text
they store numbers and letters from this link ( it's my local development
machine )

http://tech2000/rfq.php?spp=MC68020RC12E&pkg=PGA&mfc=MOT&act=ADD&sid=583607b
a7b565b6d699da58d7c7fe9ab

- Original Message -
From: "Darryl Friesen" <[EMAIL PROTECTED]>
To: "Robert" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 25, 2001 2:26 PM
Subject: Re: [PHP-DB] insert into mysql


>
>
> > It still didn't work.
> > just says unable to add part
>
> > > $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
>
> Another thought:  Are ID and part character data of some sort?  If not
(i.e.
> if ID is an int) then remove the single quotes.
>
>
> - Darryl
>
>  --
>   Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
>   Education & Research Technology Services, http://gollum.usask.ca/
>   Department of Computing Services,
>   University of Saskatchewan
>  --
>   "Go not to the Elves for counsel, for they will say both no and yes"
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-25 Thread Darryl Friesen



> It still didn't work.
> just says unable to add part

> > $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";

Another thought:  Are ID and part character data of some sort?  If not (i.e.
if ID is an int) then remove the single quotes.


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-25 Thread Darryl Friesen



> It still didn't work.
> just says unable to add part

Remove the @ from @mysql_db_query and it will spit out the SQL error
explaining why the query fails.  That should help for debugging.


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] insert into mysql

2001-01-25 Thread Dave Fudge

try this:

$db = mysql_connect(host,uid,pwd);
if($act=="ADD"){
$sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
$res = mysql_db_query($dbname,$sql,$db);
  if(!$res){
  echo("Unable to add part.");
  mysql_close($db);
  exit();
  }
}

you didn't specify $dbname

-Original Message-
From: Robert [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 25, 2001 3:07 PM
To: Darryl Friesen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] insert into mysql


It still didn't work.
just says unable to add part
$db = mysql_connect("tech2000", "wwwguest", "guest");

- Original Message -
From: "Darryl Friesen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 25, 2001 2:02 PM
Subject: Re: [PHP-DB] insert into mysql


>
> > //--- Add
part --
> > if($act=="ADD"){
> > $sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp'),$db";
> > if(! @mysql_db_query("$sql")){
> >echo("Unable to add part."); mysql_close($db);exit();} }
> >
> > Why does this not work?
> >
>
> You're INSERT query is wrong.  Take the ',$db' off the end.
>
> $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
>
>
> - Darryl
>
>  --
>   Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
>   Education & Research Technology Services, http://gollum.usask.ca/
>   Department of Computing Services,
>   University of Saskatchewan
>  --
>   "Go not to the Elves for counsel, for they will say both no and yes"
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-25 Thread Robert

It still didn't work.
just says unable to add part
$db = mysql_connect("tech2000", "wwwguest", "guest");

- Original Message -
From: "Darryl Friesen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 25, 2001 2:02 PM
Subject: Re: [PHP-DB] insert into mysql


>
> > //--- Add
part --
> > if($act=="ADD"){
> > $sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp'),$db";
> > if(! @mysql_db_query("$sql")){
> >echo("Unable to add part."); mysql_close($db);exit();} }
> >
> > Why does this not work?
> >
>
> You're INSERT query is wrong.  Take the ',$db' off the end.
>
> $sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";
>
>
> - Darryl
>
>  --
>   Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
>   Education & Research Technology Services, http://gollum.usask.ca/
>   Department of Computing Services,
>   University of Saskatchewan
>  --
>   "Go not to the Elves for counsel, for they will say both no and yes"
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-25 Thread Darryl Friesen

> You're INSERT query is wrong.  Take the ',$db' off the end.
  ^^

Oops.  That's "Your".  Long day.

- Darryl



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] insert into mysql

2001-01-25 Thread Darryl Friesen


> //--- Add part --
> if($act=="ADD"){
> $sql="INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp'),$db";
> if(! @mysql_db_query("$sql")){
>echo("Unable to add part."); mysql_close($db);exit();} }
> 
> Why does this not work?
> 

You're INSERT query is wrong.  Take the ',$db' off the end.

$sql = "INSERT INTO ecomm (ID,part) VALUES ('$sid','$spp')";


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]