[PHP-DB] Re: If statement for sql statement

2002-04-10 Thread Marij Bellen

see mysql.com for an insert select synthax.
maybe that helps.
6.4.3.1 INSERT ... SELECT Syntax
INSERT [LOW_PRIORITY] [IGNORE] [INTO] tbl_name [(column list)] SELECT ...
With INSERT ... SELECT statement you can quickly insert many rows into a
table from one or many tables. 
INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE
tblTemp1.fldOrder_ID > 100;


MVG Marij B.

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




[PHP-DB] Grrr quotes

2002-04-10 Thread Marij Bellen

Hello, i have a little problem with quotes:

- first a have a textarea in a form
- second i'm gonna check this textarea
- if all checks sussesfull I process the data, so no straings thing get in
my database or whatever (function see below)

Problem: if I get the data out of the database I sometimes get problems that
make funny '&' characters of quotes and if im wright also from alt-keys
(like for example a euro-sign ).

EUR -> € 

I do this with code before into database:

$beschrijving = ereg_replace("\n","", ereg_replace("`","
",htmlentities("$beschrijving")));  


this piece of code is in the form (the  will be pulled out first)

---
", "", $beschrijving); ?>



How is it possible i get these funny &-signs.
I think it has something to do with the htmlentities() i'm using.
Is there a way to translate them back or something?

Thanks

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




[PHP-DB] Re: mail function help

2002-04-08 Thread Marij Bellen

Here is an example how to use the mail-function right.
Hope it helps.



#mailtje versturen naar 
$m_adres = "$klant_email";
$m_subject = "$onderwerp";
$m_body = "Onderwerp: $onderwerp\r\n\r\nUw link is: $link\r\nUw categorie
is: $categorie\r\n\r\nU moet uw link bla bla\r\n\r\n";
$mailsend = mail("$m_adres", "$m_subject", "$m_body.", "From:
[EMAIL PROTECTED]\r\n"); 

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




Re: [PHP-DB] How to link a MYSQL table to a dbase file

2002-04-04 Thread Marij Bellen

I run my site on a linux webserver.
I don't really know what a cron is?
I can also get a csv file.
I also have a function to translate the dbase-file to sql.

Is a cron a tool or whatever to automatically load data into the database?

==
Can you use a cron (Unix) or at (Windows) job to dump the dbase data to a
 comma-separated-value table? Then suck up the csv into the mysql databasde.
 
=
> 
> How can I extract data for a mysql-table from a dbase file?
> 
> 
> This is the situation:
> 1) we have a dbase-file with data
> 2) the dbase-file is put on the server
> 3) we have a mysql-table that needs to get his data out of this
dbase-file.
> 
> How can I link this mysql-table to this file!
> 
> !!note:
> ---
> I don't mean how I can put the data of the dbase-file into the table,
> but the table should be linked to the dbase file to get its data!
> 
> Background:
> ---
> we want to upload a file with data from our own local database each night
> to our internet-mysql-database.
> 
> In MS-access such a file is called a 'external table.'
> 
> If this isn't possible and we don't have the ability to use the
> php-dbase-functions (because of our provider),
> 
> is there another solution to get the data from the dbase-file
automatically
> in the mysql-database?
> 
> Can you help me!!
> 
> Thanks.
> 
> 
> 
> -- 
> PHP Database Mailing List (
> To unsubscribe, visit: 


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




[PHP-DB] How to link a MYSQL table to a dbase file

2002-04-04 Thread Marij Bellen

How can I extract data for a mysql-table from a dbase file?
 
 
 This is the situation:
1) we have a dbase-file with data
2) the dbase-file is put on the server
3) we have a mysql-table that needs to get his data out of this dbase-file.

 How can I link this mysql-table to this file!
 
 !!note:
 ---
 I don't mean how I can put the data of the dbase-file into the table,
 but the table should be linked to the dbase file to get its data!
 
 Background:
 ---
 we want to upload a file with data from our own local database each night
to our internet-mysql-database.
 
 In MS-access such a file is called a 'external table.'
 
If this isn't possible and we don't have the ability to use the
php-dbase-functions (because of our provider),
 
 is there another solution to get the data from the dbase-file automatically
 in the mysql-database?
 
 Can you help me!!
 
 Thanks.



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




[PHP-DB] Re: Fill select boxes with dependent data from a database. How?

2002-04-02 Thread Marij Bellen



-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Verzonden: Friday, March 29, 2002 11:44 AM
Aan: [EMAIL PROTECTED]
Onderwerp: failure notice


Hi. This is the qmail-send program at pb1.pair.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<[EMAIL PROTECTED]>:
timed out waiting for confirmation that sender is real
I'm not going to try again; this message has been in the queue too long.

--- Below this line is a copy of the message.

Return-Path: <[EMAIL PROTECTED]>
Received: (qmail 87144 invoked by uid 1007); 22 Mar 2002 09:43:56 -
Message-ID: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Reply-To: "Marij B." <[EMAIL PROTECTED]>
From: "Marij B." <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Subject: Re: Fill select boxes with dependent data from a database. How?
Date: Fri, 22 Mar 2002 10:43:59 +0100
Lines: 209
Organization: Centric
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Posted-By: 62.58.181.251

You're lucky,

I had the same problem, needing 2 synced pulldown menus, but I found a
solution.
I add 2 parts:
1) the function
2) an example to make the arrays

part 1: the function
=
\n\n";
 $pd1 .= "
 <!--
 v=false;
 //-->
 
 
 <!--
 if (typeof(Option)+\"\" != \"undefined\") v=true;
 //-->
 
 <!--
 if(v){
  a=new Array(22);
 }

 var catsIndex = -1;
 var itemsIndex;

 if (v) { // ns 2 fix

  function newCat(){
   catsIndex++;
   a[catsIndex] = new Array();
   itemsIndex = 0;
  }

  function O(txt,url) {
   a[catsIndex][itemsIndex]=new myOptions(txt,url);
   itemsIndex++;
  }

  function myOptions(text,value){
   this.text = text;
   this.value = value;
  }


  // populate array for pd's
  ";

  # empty cat voor blank 1st values
  $pd1 .= "\nnewCat();\n";
  $pd1 .= "O(\"Maak evt. een keuze\", \"\")\n";

  # process the $array1 and $array2 to polulate the array used by js

  while (list($key, $val) = each($array_groups)) {

   # Now fill the array with models for each make
   $pd1 .= "\nnewCat();\n";

   if(array_key_exists($key, $array_members)) {
while (list($key2, $val2) = each($array_members[$key])) {
 # format: O(label, value)
 $pd1 .= "O(\"$val2\", \"$key2\")\n";
}
   } else { # echo "No contact found for this company" or something
$pd1 .= "O(\"Geen gegevens gevonden\", \"\")\n";
   }

   $pd1 .="\n";
  }

  # continue creation of the 1st pull down menu string
  $pd1 .="
 } // end if (v)

 function relate(j) {
  if(v){
   with (document.$form_name.$pd_name2) {
for(i=options.length-1;i>0;i--) options[i] = null; // null out in
reverse order (bug workaround)
for(i=0;i<a[j].length;i++){
 options[i] = new Option(a[j][i].text,a[j][i].value);
}
 options[0].selected = true;
   }
  }
 }

 // BACK BUTTON FIX for ie4+- or
 // MEMORY-CACHE-STORING-ONLY-INDEX-AND-NOT-CONTENT
 function IEsetup(){
  if(!document.all) return;
  IE5 = navigator.appVersion.indexOf(\"5.\")!=-1;
  if(!IE5) {
   for (i=0;i<document.forms.length;i++) {
document.forms[i].reset();
   }
  }
 }

 window.onload = IEsetup;

 //-->
 ";

 $pd1 .="";

 # fill menu 1
 $pd1 .="Maak een keuze\n";
 while (list($key, $val) = each($array_groups2)) {
  $pd1 .="$val\n";
 }

 $pd1 .="\n";

 # start creation pull down menu 2
 $pd2="
 Maak een keuze
 ";

 $pd = array();
 $pd[1] = $pd1;
 $pd[2] = $pd2;
 return $pd;
}


# this function prints the elements of an array
function print_array($array) {
 if (gettype($array) == "array") {
  echo "\n";
  while (list($index, $subarray) = each($array) ) {
   echo "$index => \n";
   print_array($subarray);
   echo "\n";
  }
  echo "\n";
 } else {
 echo $array;
 }
}
?>

part 2:make the arrays

#MARKTSEGMENTEN: Get entries listed in table for marktsegmenten
$query_pd = "SELECT id, naam FROM marktsegment1 ORDER BY naam";
$result_pd = mysql_db_query($database, $query_pd, $connection) or die
("Could not execute query_pd: $query_pd. " . mysql_error() );
$klanten = array();
while ($row_pd = mysql_fetch_array($result_pd)) {
 $klanten[$row_pd[id]] = $row_pd[naam];
}

$query_pd2 = "SELECT id, naam, marktsegment1_id FROM marktsegment2 ORDER
BY marktsegment1_id, naam";
$result_pd2 = mysql_db_query($database, $query_pd2, $connection) or die
("Could not execute query_pd2: $query_pd2. " . mysql_error() );
 

[PHP-DB] Re: menues problem

2002-04-02 Thread Marij Bellen


You don't have to reload three times!!!
Just make the first two in static html and the third one with PHP like this:







$category_array[category_name]";
}

?>


MVG Marij




- 
The information included in this message is personal and/or confidential and
intended exclusively for the addressees as stated. This message and/or the
accompanying documents may contain confidential information and should be
handled accordingly. If you are not the intended reader of this message, we
urgently request that you notify Centric immediately and that you delete
this e-mail and any copies of it from your system and destroy any printouts
immediately. 
It is forbidden to distribute, reproduce, use or disclose the information in
this e-mail to third parties without obtaining prior permission from
Centric. We expressly point out that there are risks associated with the use
of e-mail. Centric and the companies within the group shall not accept any
liability whatsoever for damage resulting from the use of e-mail. Legally
binding obligations can only arise for Centric by means of a written
instrument, signed by an authorized representative of Centric. 
- 



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




[PHP-DB] Re: date problem

2002-04-02 Thread Marij Bellen



-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Verzonden: Friday, March 29, 2002 11:59 AM
Aan: [EMAIL PROTECTED]
Onderwerp: failure notice


Hi. This is the qmail-send program at pb1.pair.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<[EMAIL PROTECTED]>:
timed out waiting for confirmation that sender is real
I'm not going to try again; this message has been in the queue too long.

--- Below this line is a copy of the message.

Return-Path: <[EMAIL PROTECTED]>
Received: (qmail 92721 invoked by uid 1007); 22 Mar 2002 09:58:45 -
Message-ID: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Reply-To: "Marij B." <[EMAIL PROTECTED]>
From: "Marij B." <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
Subject: Re: date problem
Date: Fri, 22 Mar 2002 10:58:48 +0100
Lines: 88
Organization: Centric
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Posted-By: 62.58.181.251

Make a validation on the data field.
I have one that checks dates, hope its good for you too:

function

#functie valid_date
function valid_date($string)
{
 #Connectie database: vanuit moederscript!!
 #Connection met database openen: vanuit moederscript!!
 global $database;
 global $connection;

 if (strlen($string) < 8)
 { #die ("String te kort")
  return FALSE;
 }

 $query_checktime = "SELECT UNIX_TIMESTAMP($string)";
 $result = mysql_db_query($database, $query_checktime, $connection)
 or die ("Could not execute query: $query_checktime. " .
mysql_error());

  $row = mysql_fetch_row($result);
  if ($row[0] == "0")
  {
   #die ("Ongeldige string")
   return FALSE;
  }
  else
  {
   return TRUE;
  }
}

check before to function


  #controle datum
  $datum = $year.$month.$day;
  if ( !valid_date($datum) )
  {
   $foutmessage .= "U heeft geen geldig formaat als datum ingevoerd !";
 $check = 0;
}

  if (empty($year))
{
 $foutmessage .= "U heeft geen jaartal ingevoerd !";
 $check = 0;
}
if (empty($month))
{
 $foutmessage .= "U heeft geen maand ingevoerd !";
 $check = 0;
}
if (empty($day))
{
 $foutmessage .= "U heeft geen dag ingevoerd !";
 $check = 0;
}
  #email check

form field data:
-

 Datum:*Formaat:
 
  Dag:.Maand:.Jaartal:
  ..
  ..
  
  DDMM.
 



Hope it helps.
MVG Marij



- 
The information included in this message is personal and/or confidential and
intended exclusively for the addressees as stated. This message and/or the
accompanying documents may contain confidential information and should be
handled accordingly. If you are not the intended reader of this message, we
urgently request that you notify Centric immediately and that you delete
this e-mail and any copies of it from your system and destroy any printouts
immediately. 
It is forbidden to distribute, reproduce, use or disclose the information in
this e-mail to third parties without obtaining prior permission from
Centric. We expressly point out that there are risks associated with the use
of e-mail. Centric and the companies within the group shall not accept any
liability whatsoever for damage resulting from the use of e-mail. Legally
binding obligations can only arise for Centric by means of a written
instrument, signed by an authorized representative of Centric. 
- 



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




[PHP-DB] Re: text area

2002-04-02 Thread Marij Bellen



I have some code that could help you,

 Omschrijving:*
 


Hope its enough, else mail me!
Marij Bellen


"Jas" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am wondering where I could find a good tutorial on displaying the
contents
> of a database field within a textarea for editing.  Any help would be
great!
> Thanks in advance,
> Jas
>
>


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




[PHP-DB] RE: failure notice

2002-04-02 Thread Marij Bellen

Got a function that migth do both thricks at once (found on PHP.NET:

function valid_email($email)
{
 #if
(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$",
$email, $check))
 if
(eregi("^[0-9a-z_]([_\.-]?[0-9a-z])*@[0-9a-z][0-9a-z\.-]*\.[a-z]{2,4}\.?$",
$email, $check))
 {
   if ( getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) )
  {
   return TRUE;
  }

 }
 return FALSE;
}

MVG mary

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




[PHP-DB] RE: failure notice

2002-04-02 Thread Marij Bellen

You need to realize that sessions works in that way the same as headers.
You can use session_start() when you have already outputted data.

Always use sessions (like headers) at top of page!!


"Killer Angel Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You may try to put session_start(); at the most begining.
> But should you also add a session path first?
>
> "Ryan Snow" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > when I do:
> >   session_start();
> >   session_register('signor');
> >   session_register('username');
> >
> >
> > I get:
> >
> > Warning: Cannot send session cookie - headers already sent by (output
> > started at /var/www/html/index.php:3) in
> > /var/www/html/index.php on line 14
> >
> > Warning: Cannot send session cache limiter - headers already sent
(output
> > started at /var/www/html/index.php:3) in
> > /var/www/html/index.php on line 14
> >
> > Anybody know why?
> >
> > Thanks.
> >
> > Ry
>
>



- 
The information included in this message is personal and/or confidential and
intended exclusively for the addressees as stated. This message and/or the
accompanying documents may contain confidential information and should be
handled accordingly. If you are not the intended reader of this message, we
urgently request that you notify Centric immediately and that you delete
this e-mail and any copies of it from your system and destroy any printouts
immediately. 
It is forbidden to distribute, reproduce, use or disclose the information in
this e-mail to third parties without obtaining prior permission from
Centric. We expressly point out that there are risks associated with the use
of e-mail. Centric and the companies within the group shall not accept any
liability whatsoever for damage resulting from the use of e-mail. Legally
binding obligations can only arise for Centric by means of a written
instrument, signed by an authorized representative of Centric. 
- 



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




[PHP-DB] dbase-mysql-php

2002-04-02 Thread Marij Bellen

I know its possible to use a .dbf file for input.

Does anyone have an example how i can search through an .dbf - file?


Thanks Mary


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