[PHP-DB] mail() function

2002-06-10 Thread Dib, Walid (MED, Stagiaire GEMS)

Hello

I want to test the mail() function locally, i'm using esays php, how can I
do that?
thanks

Walid





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


[PHP-DB] problem with mysql_query

2002-06-10 Thread Rene Schoenmakers

Hi,

I've a problem with the following script. Sometimes it does write the
data into the database, sometimes it doesn't. When it doesn't $result is
completely blank, otherwise it is 1. $sql always returns the propper
values even though $result is blank. Can anybody tell me what I'm doing
wrong?

TIA,

Rene

Here's the code:
---
 
   ";
  echo $sql."";
  echo "Het nieuwsbericht is succesvol toegevoegd.\n";
  echo "Meer nieuws toevoegen\n";
  echo "Bekijk het resultaat";

} else{

  // display form
  ?>

  
  
  
  titel:
  
  
  
  datum:
  
  
  
  bron:
  
  
  
  inleiding: 
  
  
  
  tekst:
  
  
  
  foto:
   
  
  
  Toevoegen zonder http:// Voorbeeld:
www.indyschoenmakers.com 
  
  
  link:
  
  
  
  
  
  
  
  

  


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




Re: [PHP-DB] problem with mysql_query

2002-06-10 Thread Markus Lervik

On Monday 10 Jun 2002 12:14 pm, Rene Schoenmakers wrote:
> Hi,
>
> I've a problem with the following script. Sometimes it does write the
> data into the database, sometimes it doesn't. When it doesn't $result is
> completely blank, otherwise it is 1. $sql always returns the propper
> values even though $result is blank. Can anybody tell me what I'm doing
> wrong?

>   $result = mysql_query($sql);

Try changing this to (for example)

if(!$result = mysql_query($sql)) {
echo "MySQL error " . mysql_errno() . " - " . mysql_error();
die();
}

and see what you get. There's probably some problem with the database
connection.

Cheers,
Markus

-- 
Markus Lervik
Linux-administrator
Vaasa City Library - Regional Library, Finland
[EMAIL PROTECTED]
+358-6-325 3589/+358-40-832 6709

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




RE: [PHP-DB] problem with mysql_query

2002-06-10 Thread Rene Schoenmakers

Hi,

I know what's causing the problem. In $newsText sometimes single quotes
are entered. There the error occurs. How can I escape these singel
quotes?

Regards,

Rene



-Original Message-
From: Markus Lervik [mailto:[EMAIL PROTECTED]] 
Sent: maandag 10 juni 2002 12:45
To: Rene Schoenmakers
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] problem with mysql_query


On Monday 10 Jun 2002 12:14 pm, Rene Schoenmakers wrote:
> Hi,
>
> I've a problem with the following script. Sometimes it does write the 
> data into the database, sometimes it doesn't. When it doesn't $result 
> is completely blank, otherwise it is 1. $sql always returns the 
> propper values even though $result is blank. Can anybody tell me what 
> I'm doing wrong?

>   $result = mysql_query($sql);

Try changing this to (for example)

if(!$result = mysql_query($sql)) {
echo "MySQL error " . mysql_errno() . " - " . mysql_error();
die();
}

and see what you get. There's probably some problem with the database
connection.

Cheers,
Markus

-- 
Markus Lervik
Linux-administrator
Vaasa City Library - Regional Library, Finland [EMAIL PROTECTED]
+358-6-325 3589/+358-40-832 6709

-- 
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] problem with mysql_query

2002-06-10 Thread Markus Lervik

On Monday 10 Jun 2002 2:15 pm, Rene Schoenmakers wrote:

> Hi,
>
> I know what's causing the problem. In $newsText sometimes single quotes
> are entered. There the error occurs. How can I escape these singel
> quotes?

with $newsText = addslashes($newsText);

http://www.php.net/manual/en/function.addslashes.php


Cheers,
Markus

-- 
Markus Lervik
Linux-administrator
Vaasa City Library - Regional Library, Finland
[EMAIL PROTECTED]
+358-6-325 3589/+358-40-832 6709

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




Re: [PHP-DB] problem with mysql_query

2002-06-10 Thread Markus Lervik

On Monday 10 Jun 2002 2:37 pm, Markus Lervik wrote:
> On Monday 10 Jun 2002 2:15 pm, Rene Schoenmakers wrote:
> > Hi,
> >
> > I know what's causing the problem. In $newsText sometimes single quotes
> > are entered. There the error occurs. How can I escape these singel
> > quotes?
>
> with $newsText = addslashes($newsText);
>
> http://www.php.net/manual/en/function.addslashes.php

Oh yea, forgot to mention, when pulling the field back from the database, use
the stripslashes -function in the same manner.


Cheers,
Markus

-- 
Markus Lervik
Linux-administrator
Vaasa City Library - Regional Library, Finland
[EMAIL PROTECTED]
+358-6-325 3589/+358-40-832 6709

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




RE: [PHP-DB] problem with mysql_query

2002-06-10 Thread Rene Schoenmakers

It works! Thanks!

-Original Message-
From: Markus Lervik [mailto:[EMAIL PROTECTED]] 
Sent: maandag 10 juni 2002 13:37
To: Rene Schoenmakers; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] problem with mysql_query


On Monday 10 Jun 2002 2:15 pm, Rene Schoenmakers wrote:

> Hi,
>
> I know what's causing the problem. In $newsText sometimes single 
> quotes are entered. There the error occurs. How can I escape these 
> singel quotes?

with $newsText = addslashes($newsText);

http://www.php.net/manual/en/function.addslashes.php


Cheers,
Markus

-- 
Markus Lervik
Linux-administrator
Vaasa City Library - Regional Library, Finland [EMAIL PROTECTED]
+358-6-325 3589/+358-40-832 6709

-- 
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




[PHP-DB] date format display

2002-06-10 Thread fabrizio

Hello dear all, 

in my mysql-db I   have a  date_tbl  with this format: (20020531).
how is possible in PHP do display date_tbl's values in a more human-readable 
format like 05-31-2002 or 31/05/2002 ?

thaks in advance, 
regards

fabrizio




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




Re: [PHP-DB] date format display

2002-06-10 Thread Stuart Dallas

Monday, June 10, 2002, 2:00:59 PM, you wrote:
> in my mysql-db I   have a  date_tbl  with this format: (20020531).
> how is possible in PHP do display date_tbl's values in a more human-readable 
> format like 05-31-2002 or 31/05/2002 ?

Look at date and strtotime...

http://www.php.net/date
http://www.php.net/strtotime

Also take a look at DATE_FORMAT in the MySQL manual...

http://www.mysql.com/doc/D/a/Date_and_time_functions.html

-- 
Stuart


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




Re: [PHP-DB] date format display

2002-06-10 Thread Manuel


 This function will fix your date display. 
$sqldate="20020531";
$sqldate= fixdate($sqldate); 

function fixdate($data){
 $aux="";
 $z=0;
 for($i=0; $i wrote: Hello dear all, 

in my mysql-db I have a date_tbl with this format: (20020531).
how is possible in PHP do display date_tbl's values in a more human-readable 
format like 05-31-2002 or 31/05/2002 ?

thaks in advance, 
regards

fabrizio




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





~ Manuel Ochoa ~
Seven days is too long to wait for a gun!



-
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup


Re: [PHP-DB] date format display

2002-06-10 Thread Paul Burney

on 6/10/02 9:00 AM, fabrizio at [EMAIL PROTECTED] appended the following bits
to my mbox:

> in my mysql-db I   have a  date_tbl  with this format: (20020531).
> how is possible in PHP do display date_tbl's values in a more human-readable
> format like 05-31-2002 or 31/05/2002 ?

In your query, you can use the MySQL date_format function.  See the
documentation here:



Example:

SELECT movie_title, DATE_FORMAT(movie_start_date, '%m/%d/%Y') AS
start_date_formatted FROM movies_table WHERE movie_id="3";

Hope that helps.

Sincerely,

Paul Burney






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




Re: [PHP-DB] mail() function

2002-06-10 Thread Edward Marczak

On 6/10/02 5:02 AM, "Dib, Walid (MED, Stagiaire GEMS)" [EMAIL PROTECTED]
pressed the keys forming the message:

> Hello
> 
> I want to test the mail() function locally, i'm using esays php, how can I
> do that?

Not sure what esays php is, but you don't say what platform you're on.
Basically, you need some kind of mail server.  If you're on Linux or MacOS
X, great: you've got sendmail built in.  If you're on Windows, you either
need an SMTP product running locally, or you need one you can connect to.
-- 
Ed Marczak
[EMAIL PROTECTED]


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




RE: [PHP-DB] mail() function

2002-06-10 Thread Bruce Karstedt

The best way to test mail is to get a free e-mail account at hotmail or
yahoo and use that as a destination.

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


-Original Message-
From: Dib, Walid (MED, Stagiaire GEMS) [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 4:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mail() function


Hello

I want to test the mail() function locally, i'm using esays php, how can I
do that?
thanks

Walid





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




RE: [PHP-DB] date format display

2002-06-10 Thread Gary Pullis

This is how I'd do it:
$strtime = "20020531"; // Example date string

// STEP 1: Turn the MMDD string into a UNIX date
$unixtime = mktime(substr($strtime, 8, 2),substr($strtime, 10,
2),0,substr($strtime, 4, 2),substr($strtime, 6, 2),substr($strtime, 0, 4));

// STEP 2: Use the date() function to format the date however you'd like
echo date("m-d-Y", $unixtime); // Outputs 05-31-2002 echo date("d/m/Y",
$unixtime); // Outputs 31/05/2002

Things I highly recommend reading:
http://www.php.net/manual/en/function.substr.php
http://www.php.net/manual/en/function.mktime.php
http://www.php.net/manual/en/function.date.php

You'll really want to read the page about the date function. The options for
formatting your date output are just about limitless.

Gary Pullis
Office Management Technologies
http://www.omt.cc


> -Original Message-
> From: fabrizio [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, June 10, 2002 9:01 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] date format display
> 
> 
> Hello dear all, 
> 
> in my mysql-db I   have a  date_tbl  with this format: (20020531).
> how is possible in PHP do display date_tbl's values in a more 
> human-readable 
> format like 05-31-2002 or 31/05/2002 ?
> 
> thaks in advance, 
> regards
> 
> fabrizio
> 
> 
> 
> 
> -- 
> 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




[PHP-DB] CSV/TXT file imported via PHP into MySQL

2002-06-10 Thread Keiran Wynyard

I have a form on a PHP page with which I wish to load a tab delimited text file into a
UNIX based MySQL database

By using PHPMyAdmin I have tested whether I can upload the file, using MyAdmin to help 
me
construct the Query and to date in MyAdmin it works fine. Taking the query and 
splitting
it across two pages (one for receiving the file, and to action the query) seems to 
stop it
from working.

I have detailed the pertinent aspects below.
My question is really to do with whether there is a file permissions setting or
requirement that I have to be aware of, or if there is merely something else I can do.

Form code:
 echo "";
  echo "\n";
  echo "\n\n";

Query section:
 switch ($command)
{
case 'create':
echo "$textfile"; \\merely existing to run checks
$query = "LOAD DATA LOCAL INFILE '" . $textfile . "' INTO TABLE
pebble_email_addresses FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n' (firstname,
surname, email) ";
echo "$query"; \\merely existing to run checks
$sql_query_result = @mysql_query($query, $sql_userdb);
 if ($sql_query_result and @mysql_affected_rows() > 0)
{
 //Worked OK
 echo "it worked";
  }
else
   {
   echo "it didn't";
 break;

I have yet to get the damn query to import anything at all! HELP

Thanks in Advance!

Keiran



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




[PHP-DB] How do I get a ' in my sql statement?

2002-06-10 Thread Blaine Dinsmore

I have noticed that when I try to assign the value of a input field that has a  ' in 
it for example :   It will goof up my attempt to load the information to the 
database. Anyone know a way around this? Do I have to send each string through a 
parsing routine before assigning my string to a variable that will be used in a SQL 
statement?


Thanks,

Blaine


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




Re: [PHP-DB] How do I get a ' in my sql statement?

2002-06-10 Thread Daniel Brunner

Hello!!

Spit some code out...I put a lot of ' in my inserts...

Is it from a form?!?!!?

Is it from a Insert, or Select or Update?!?

That's why we need some code...


Dan


On Monday, June 10, 2002, at 12:01 PM, [EMAIL PROTECTED] wrote:

> I have noticed that when I try to assign the value of a input field 
> that has a  ' in it for example :   It will goof up my attempt 
> to load the information to the database. Anyone know a way around this? 
> Do I have to send each string through a parsing routine before 
> assigning my string to a variable that will be used in a SQL statement?
>
>
> Thanks,
>
> Blaine
>
>
> --
> 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] How do I get a ' in my sql statement?

2002-06-10 Thread Terry Romine

Any text field that has the possibility of getting quotes should be 
handled by
$textfield = addslashes($textfield);
prior to insert.

Then on displaying, use
$textfield = stripslashes($textfield);

If it is a big text (including paragraphs) I use
$textfield = nl2br(stripslashes($textfield));

On Monday, June 10, 2002, at 12:40  PM, Daniel Brunner wrote:

> Hello!!
>
> Spit some code out...I put a lot of ' in my inserts...
>
> Is it from a form?!?!!?
>
> Is it from a Insert, or Select or Update?!?
>
> That's why we need some code...
>
>
> Dan
>
>
> On Monday, June 10, 2002, at 12:01 PM, [EMAIL PROTECTED] wrote:
>
>> I have noticed that when I try to assign the value of a input field 
>> that has a  ' in it for example :   It will goof up my attempt 
>> to load the information to the database. Anyone know a way around 
>> this? Do I have to send each string through a parsing routine before 
>> assigning my string to a variable that will be used in a SQL statement?
>>
>>
>> Thanks,
>>
>> Blaine
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
Terry Romine
Web Developer
JumpInteractive.com


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




Re: [PHP-DB] How do I get a ' in my sql statement?

2002-06-10 Thread Blaine Dinsmore

Terry,

Thanks for the tip on the nl2br function. That function proved to be
very helpful when displaying data in a HTML table.
I noticed the \n is ok when sending text to a form with multiline input
boxes. 


Thanks,

Blaine

>>> Terry Romine <[EMAIL PROTECTED]> 06/10/02 02:35PM >>>
Any text field that has the possibility of getting quotes should be 
handled by
$textfield = addslashes($textfield);
prior to insert.

Then on displaying, use
$textfield = stripslashes($textfield);

If it is a big text (including paragraphs) I use
$textfield = nl2br(stripslashes($textfield));

On Monday, June 10, 2002, at 12:40  PM, Daniel Brunner wrote:

> Hello!!
>
> Spit some code out...I put a lot of ' in my inserts...
>
> Is it from a form?!?!!?
>
> Is it from a Insert, or Select or Update?!?
>
> That's why we need some code...
>
>
> Dan
>
>
> On Monday, June 10, 2002, at 12:01 PM, [EMAIL PROTECTED] wrote:
>
>> I have noticed that when I try to assign the value of a input field

>> that has a  ' in it for example :   It will goof up my
attempt 
>> to load the information to the database. Anyone know a way around 
>> this? Do I have to send each string through a parsing routine before

>> assigning my string to a variable that will be used in a SQL
statement?
>>
>>
>> Thanks,
>>
>> Blaine
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php 
>>
>>
Terry Romine
Web Developer
JumpInteractive.com


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




RE: [PHP-DB] CSV/TXT file imported via PHP into MySQL

2002-06-10 Thread Beau Lebens

Keiran,
in your second page, you refer to $textfile as the thing that you want to
load into the database; this file doesn't exist on the server, so it is
inserting nothing I would imagine.

You need to use something like $_FILES['tmp_name'] to refer to the actual
file, once it has been successfully uploaded to your server
(http://www.php.net/manual/en/features.file-upload.php#features.file-upload.
post-method)

HTH

Beau

// -Original Message-
// From: Keiran Wynyard [mailto:[EMAIL PROTECTED]]
// Sent: Tuesday, 11 June 2002 12:38 AM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] CSV/TXT file imported via PHP into MySQL
// 
// 
// I have a form on a PHP page with which I wish to load a tab 
// delimited text file into a
// UNIX based MySQL database
// 
// By using PHPMyAdmin I have tested whether I can upload the 
// file, using MyAdmin to help me
// construct the Query and to date in MyAdmin it works fine. 
// Taking the query and splitting
// it across two pages (one for receiving the file, and to 
// action the query) seems to stop it
// from working.
// 
// I have detailed the pertinent aspects below.
// My question is really to do with whether there is a file 
// permissions setting or
// requirement that I have to be aware of, or if there is 
// merely something else I can do.
// 
// Form code:
//  echo "";
//   echo "\n";
//   echo "\n\n";
// 
// Query section:
//  switch ($command)
//  {
//  case 'create':
//  echo "$textfile"; \\merely existing to run checks
//  $query = "LOAD DATA LOCAL INFILE '" . $textfile 
// . "' INTO TABLE
// pebble_email_addresses FIELDS TERMINATED BY '\t' LINES 
// TERMINATED BY '\r\n' (firstname,
// surname, email) ";
//  echo "$query"; \\merely existing to run checks
//  $sql_query_result = @mysql_query($query, $sql_userdb);
//   if ($sql_query_result and @mysql_affected_rows() > 0)
//  {
//  //Worked OK
//   echo "it worked";
//   }
// else
//{
//echo "it didn't";
//  break;
// 
// I have yet to get the damn query to import anything at all! HELP
// 
// Thanks in Advance!
// 
// Keiran
// 
// 
// 
// -- 
// 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




[PHP-DB] Having trouble understanding how to manage arrays

2002-06-10 Thread Bill Fleury

Hi all.  I am very new to this, and have been reading my way through php, but have 
come accross a stumbling block that I just don't seem able to get past, although I'm 
sure it's something simple.

I have a very basic mysql database set up, that contains a table with 4 fields- type, 
manname, manlink, and recordno

What I need to do is pull all records from the database, and provide a list on a page 
with links to the url's stored in manlink with the lable manname.  So far, I've come 
up with the script at the end of this message.  This script works beautifully for me- 
for the first record.  Could anyone point out why it won't go on to any other records?

Thanks, 

Newbie Bill


 $idl) {
break;
}


$query = "SELECT type, manname, manlink FROM man_links WHERE recordno=$id";
$result = mysql_query($query) or die("Query failed");

extract(mysql_fetch_array($result));

/* Printing results in HTML */
print "\n";
print "$manname";
print "\n";

}
/* Free resultset */
mysql_free_result($result);

/* Closing connection */
mysql_close($link);
?>




[PHP-DB] problem with a small script

2002-06-10 Thread suman

hi
i can't understand whats missing here.thou i knew this ques is asked many 
times i couldn't find an ans for it.

-
  
  firstname:


this is te html scrript

and the php code is 


---
but on executing this i get a blank page
what might be the error

suman


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




[PHP-DB] Re: Having trouble understanding how to manage arrays

2002-06-10 Thread Adam Royle

Hi Bill,

Looks like you're making it hard for yourself, by querying the database for each 
record found. Here is some code which should make your life easier. Of course, I have 
developed functions which would turn the following code into 10 or so lines, but this 
should work for your situation.

Adam







  
  ">









Re: [PHP-DB] Having trouble understanding how to manage arrays

2002-06-10 Thread Jason Wong

On Tuesday 11 June 2002 13:20, Bill Fleury wrote:
> Hi all.  I am very new to this, and have been reading my way through php,
> but have come accross a stumbling block that I just don't seem able to get
> past, although I'm sure it's something simple.
>
> I have a very basic mysql database set up, that contains a table with 4
> fields- type, manname, manlink, and recordno
>
> What I need to do is pull all records from the database, and provide a list
> on a page with links to the url's stored in manlink with the lable manname.
>  So far, I've come up with the script at the end of this message.  This
> script works beautifully for me- for the first record.  

The fact that it works 'beautifully' is just luck!

> Could anyone point
> out why it won't go on to any other records?

Your logic is completely messed up :)

>  /* Connecting, selecting database */
> $link = mysql_connect("192.168.0.112", "root", "")
> or die("Could not connect");
> print "Connected successfully";
> mysql_select_db("dgdrivers") or die("Could not select database");

The above is OK. But for better error reporting you should replace the die() 
statements with something like:

  die('Could not connect. The error was: ' . mysql_error())

This will display your message along with the actual error returned by mysql.

> /* Performing SQL query */
>
> $getlength = "select * from man_links";
> $length = mysql_query($getlength);
> $idl = count($length);
>
> for ($id = 1 ;; $id++ ) {
> if ($id > $idl) {
> break;
> }
>
>
> $query = "SELECT type, manname, manlink FROM man_links WHERE
> recordno=$id"; $result = mysql_query($query) or die("Query failed");
>
> extract(mysql_fetch_array($result));
>
> /* Printing results in HTML */
> print "\n";
> print "$manname";
> print "\n";
>
> }
> /* Free resultset */
> mysql_free_result($result);
>
> /* Closing connection */
> mysql_close($link);

Here's the standard way to retrieve a set of results from a query:

$query = "SELECT manname, manlink FROM man_links";
$resultID = mysql_query($query) 
OR die("Error in query $query : " . mysql_error());
while ($row = mysql_fetch_array($resultID)) {
  print "Man Name : " . $row['manname'];
  print "Man Link : " . $row['manlink'] . '';
}
mysql_free_result($result); # optional, as php cleans up automatically
mysql_close($link); # at the end of the script

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
QOTD:
I looked out my window, and saw Kyle Pettys' car upside down,
then I thought 'One of us is in real trouble'.
-- Davey Allison, on a 150 m.p.h. crash
*/


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




Re: [PHP-DB] CSV/TXT file imported via PHP into MySQL

2002-06-10 Thread Srinivasan Ramakrishnan

Have you tried to get the fields programmatically via fgetcsv()

You could open the file, and fgetcsv() each record one by one and insert the
normal way. This way it'll be a lot more portable across databases.

-Srini
--
http://symonds.net/~sriniram

- Original Message -
From: "Keiran Wynyard" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 10:07 PM
Subject: [PHP-DB] CSV/TXT file imported via PHP into MySQL


> I have a form on a PHP page with which I wish to load a tab delimited text
file into a
> UNIX based MySQL database
>
> By using PHPMyAdmin I have tested whether I can upload the file, using
MyAdmin to help me
> construct the Query and to date in MyAdmin it works fine. Taking the query
and splitting
> it across two pages (one for receiving the file, and to action the query)
seems to stop it
> from working.
>
> I have detailed the pertinent aspects below.
> My question is really to do with whether there is a file permissions
setting or
> requirement that I have to be aware of, or if there is merely something
else I can do.
>
> Form code:
>  echo " enctype=\"multipart/form-data\">";
>   echo "\n";
>   echo "\n\n File\">";
>
> Query section:
>  switch ($command)
> {
> case 'create':
> echo "$textfile"; \\merely existing to run checks
> $query = "LOAD DATA LOCAL INFILE '" . $textfile . "' INTO TABLE
> pebble_email_addresses FIELDS TERMINATED BY '\t' LINES TERMINATED BY
'\r\n' (firstname,
> surname, email) ";
> echo "$query"; \\merely existing to run checks
> $sql_query_result = @mysql_query($query, $sql_userdb);
>if ($sql_query_result and @mysql_affected_rows() > 0)
>   {
>  //Worked OK
>   echo "it worked";
>   }
> else
>{
>echo "it didn't";
>  break;
>
> I have yet to get the damn query to import anything at all! HELP
>
> Thanks in Advance!
>
> Keiran
>
>
>
> --
> 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] problem with a small script

2002-06-10 Thread George Pitcher

Suman,

Firstly, it's a bit longer than necessary.

Make your form a 'POST' rather than 'GET' and you'll hide your query and



will then be the equivalent.

I presume that you have been able to display other PHP stuff?

Check your php.ini file and make sure that the part that allows you to use
the short 
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 10:43 PM
Subject: [PHP-DB] problem with a small script


hi
i can't understand whats missing here.thou i knew this ques is asked many
times i couldn't find an ans for it.

-
  
  firstname:


this is te html scrript

and the php code is


---
but on executing this i get a blank page
what might be the error

suman


--
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] problem with a small script

2002-06-10 Thread Jason Wong

On Tuesday 11 June 2002 14:04, George Pitcher wrote:
> Suman,
>
> Firstly, it's a bit longer than necessary.
>
> Make your form a 'POST' rather than 'GET' and you'll hide your query and
>
>  echo $fname;
> ?>
>
> will then be the equivalent.

That requires 'register_globals' to be enabled, which for security reasons 
should be disabled, and is disabled by default on php 4.1.X and above.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Pecor's Health-Food Principle:
Never eat rutabaga on any day of the week that has a "y" in it.
*/


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