Re: [PHP-DB] MySQL REGEXP functionality... any way to make this easier?

2002-10-10 Thread Martin Adler

Hi,

unfortunately i can't help you much, but listen
you can make your pattern more readable if you
delete [] there's no need for classes in your pattern

SELECT * FROM ospd WHERE word REGEXP
'^a?p?e?$|^a?e?p?$|^p?e?a?$|^p?a?e?$|^e?a?p?$|^e?p?a?$';

? = one or none but if you need each letter then omit ?

SELECT * FROM ospd WHERE word REGEXP '^ape$|^aep$|^pea$|^pae$|^eap$|^epa$';

this is the simplest way but it also matches aae, aaa, ppe, ppp ... and
probably not what you need

SELECT * FROM ospd WHERE word REGEXP '^[aep]{3}$';

I thnk you don't have another choice then to write each combination by
yourself

greet
martin

- Original Message -
From: Xepherys [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 10, 2002 8:26 AM
Subject: [PHP-DB] MySQL REGEXP functionality... any way to make this easier?


 Right now, a sample query I might have would be...

 SELECT * FROM ospd WHERE word REGEXP '^([a]?[p]?[e]?)$|^[p]?[a]?[e]?$|^[a
 ]?[e]?[p]?$|^[p]?[e]?[a]?$|^[e]?[p]?[a]?$|^[e]?[a]?[p]?$';


 where basically I need to query every combination of a, p and e.  This is
a
 pain, but for only three letter is not so bad.  As you can see, this could
 become unruly with larger numbers of letters.  Each instance of a letter
can
 only occur once.  However, a letter may be duplicated and used once for
each
 instance.  Hence the statement steps through... it could also be something
 like...

 SELECT * FROM ospd WHERE word REGEXP
 '^[a]?[a]?[e]?$|^[a]?[e]?[a]?$||^[e]?[a]?[a]?$';

 more easily written because one letter is used twice and can occure once
for
 each instance.  Please let me know if you have any ideas.


 Jesse
 [EMAIL PROTECTED]


 --
 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] Error query : mysql_result

2002-10-10 Thread Snijders, Mark

would be nice if you would tell which line is 140



-Original Message-
From: Burgess [mailto:[EMAIL PROTECTED]]
Sent: donderdag 10 oktober 2002 11:14
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Error query : mysql_result


Hi

I have used the mysql_result function to return some specific information
from database.  The information is returned as it should but I keep getting
this error message:

Warning: Unable to jump to row 0 on MySQL result index 4 in
/u1.bath/s31/eh842/public_html/SCR/register/process.php on line 140



I'm relatively new to PHP and am unable to solve the problem so I wondered
if someone would mind spending a couple of minutes to help me.

My script, in part, reads as below:

 // check to see if company exists in db

$CompanyQuery = mysql_query(SELECT coid FROM co_details WHERE co_name =
'$company' AND co_city = '$city' AND co_country = '$co_country');

$CompanyExist = mysql_num_rows($CompanyQuery);
$company_id= mysql_result($CompanyQuery,0,0);

if ($CompanyExist  0) {

  //if company exists add workplace details
   $confirmkey =  md5(uniqid(rand()));
  $signup_id = signup_details($username, $title, $fname, $lname, $email,
$country, $job_title, $user_notes, $agree_terms, $confirmkey,$password);
  addworkplace($signup_id, $company_id, $department, $start_month,
$start_year, $end_month, $end_year );
  add_cons_info($signup_id,$functional,$technical,$mysap,$industry);

}  //END if statement

else { //add company and workplace details

   // Add new member to table signup
$confirmkey =  md5(uniqid(rand()));
   $signup_id = signup_details($username, $title, $fname, $lname,
$email, $country, $job_title, $user_notes, $agree_terms, $confirmkey,
$password);
  $company_id = company_details($company, $city, $co_country);
  addworkplace($signup_id, $company_id, $department, $start_month,
$start_year, $end_month, $end_year );
  add_cons_info($signup_id,$functional,$technical,$mysap,$industry);

 } // END else statement

  }

  //  if successful in adding to vAuthenticate, send confirmation email
  if (mysql_errno() == 0){

   $emailerMessage .= \n\n; // 2 Line Breaks
   $emailerMessage .= $confirm; // URL to confirm.php - see email.inc
   $emailerMessage .= ?confirmkey= . $confirmkey; // add confirm key to
message
   $emailerMessage .= \n\n; // 2 Line Breaks
   $sent = @mail($email, $emailerSubject, $emailerMessage,
From:$emailerName$emailerEmail\nReply-to:$emailerEmail);
 } // END if statement

}




function signup_details($username, $title, $fname, $lname, $email, $country,
$job_title, $user_notes, $agree_terms, $confirmkey, $password)  {

if ($user_notes == '') {

 $user_notes = Member chose not to include a profile;
 $sql = INSERT INTO signup VALUES
('','$username','$title','$fname','$lname','$email','$country','$job_title',
'$user_notes','$agree_terms',NOW(),'$confirmkey');
  $addmember = mysql_query($sql);
  $memberid=mysql_insert_id();

  // If SUCCESSFUL, add to vAuthenticate tables too
  if (mysql_errno() == 0){
  $AddToAuth = new auth();
  $add =
$AddToAuth-add_user($username,$password,Ungrouped,999,inactive, '',
0);
  }
  else{
print this is the signup details sql statement\n ;
print $sql.\n;
print mysql_errno() . :  . mysql_error() . \n;
exit;
  }
  return $memberid;

 }// END if

else {

  $user_notes = addslashes($user_notes);

  $sql = INSERT INTO signup VALUES
('','$username','$title','$fname','$lname','$email','$country','$job_title',
'$user_notes','$agree_terms',NOW(),'$confirmkey');
  $addmember = mysql_query($sql);
  $memberid=mysql_insert_id();

  // If SUCCESSFUL, add to vAuthenticate tables too
  if (mysql_errno() == 0){
  $AddToAuth = new auth();
  $add =
$AddToAuth-add_user($username,$password,Ungrouped,999,inactive, '',
0);
  }
  else{
print this is the signup details sql statement\n ;
print $sql.\n;
print mysql_errno() . :  . mysql_error() . \n;
exit;
  }
  return $memberid;
  }// END else

} // END function

function company_details($company, $city, $co_country)
{
  $newcompanysql = INSERT INTO co_details VALUES
('','$company','$city','$co_country');
  $add_company= mysql_query($newcompanysql);
  if (mysql_errno()  0){
print add compnay details \n;
print $newcompanysql. \n;
print mysql_errno() . : .mysql_error() . \n;
exit;
  }
  else
return mysql_insert_id();
}



function addworkplace ($signup_id, $company_id, $department, $start_month,
$start_year, $end_month, $end_year)
{
 //start date in correct format
 $start_date= $start_year.-.$start_month.-01;

  //end date in correct format
   $end_date = $end_year.-.$end_month.-01;

/* if ($end_month || $end_year == Present)
$end_date=NULL;
  else
$end_date=$end_year.-.$end_month.-01;
*/

  $worksql = INSERT INTO workplace VALUES
('','$signup_id','$company_id','$end_date','$start_date','$department');
  mysql_query($worksql);
  // need to meddle with date to get correct format
  if 

Re: [PHP-DB] Error query : mysql_result

2002-10-10 Thread Thomas Lamy



Burgess [mailto:[EMAIL PROTECTED]] wrote:
 Hi
 
 I have used the mysql_result function to return some specific 
 information
 from database.  The information is returned as it should but 
 I keep getting
 this error message:
 
 Warning: Unable to jump to row 0 on MySQL result index 4 in
 /u1.bath/s31/eh842/public_html/SCR/register/process.php on line 140
 
 My script, in part, reads as below:
 
133   // check to see if company exists in db
134  
135 $CompanyQuery = mysql_query(SELECT coid FROM co_details 
136  WHERE co_name =
137  '$company' AND co_city = '$city' AND co_country = '$co_country');
138  
139  $CompanyExist = mysql_num_rows($CompanyQuery);
140  $company_id= mysql_result($CompanyQuery,0,0);
141  
142  if ($CompanyExist  0) {
143  
144//if company exists add workplace details
145 $confirmkey =  md5(uniqid(rand()));
146$signup_id = signup_details($username, $title, $fname, 
 []
 
I have inserted the line numers where I think they are right, please correct
me...

This seems to be a common trivial error: in 139, you get the number of rows
found, but if there are none, you try to retrieve data in line 140, where
you get the error message. Exchange line 140 with 142, and the error message
will go away.

And please, the next time you ask here, post only code snippets (e.g.
beginning of function to 2-5 lines from where you get the error), and
include line numbers. Thanks.

Thomas

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




[PHP-DB] Multi-Table Insert and gettin' data from auto-inc coloumn in one to the other

2002-10-10 Thread Noodle Snacks

I have table A with an auto increment coloumn called tid. during the same
query I need to get that value and stick it in a related record in anouther
table.

I have two doubts.

A: What is the way to do a multitable insert? guess is: INSERT INTO
table(fields) VALUES (fields), table1(fields) VALUES (fields) etc... is it
even possible in one query?

B: how can I get the auto increment value from one into the record on the
other table?


--
JJ Harrison
[EMAIL PROTECTED]





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




[PHP-DB] Re: Multi-Table Insert and gettin' data from auto-inc coloumn in one to the other

2002-10-10 Thread Noodle Snacks

I can get the previous insert auto-increment id via mysql_insert_id(). it
will solve my problem. but if you know a soloution that will work in one
query please share it with me/everyone!


--
JJ Harrison
[EMAIL PROTECTED]

Noodle Snacks [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have table A with an auto increment coloumn called tid. during the same
 query I need to get that value and stick it in a related record in
anouther
 table.

 I have two doubts.

 A: What is the way to do a multitable insert? guess is: INSERT INTO
 table(fields) VALUES (fields), table1(fields) VALUES (fields) etc... is it
 even possible in one query?

 B: how can I get the auto increment value from one into the record on the
 other table?


 --
 JJ Harrison
 [EMAIL PROTECTED]







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




RE: [PHP-DB] Error query : mysql_result

2002-10-10 Thread John W. Holmes

This usually means your query failed. Check for errors using
mysql_error().

---John Holmes...

 -Original Message-
 From: Burgess [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 10, 2002 5:14 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Error query : mysql_result
 
 Hi
 
 I have used the mysql_result function to return some specific
information
 from database.  The information is returned as it should but I keep
 getting
 this error message:
 
 Warning: Unable to jump to row 0 on MySQL result index 4 in
 /u1.bath/s31/eh842/public_html/SCR/register/process.php on line 140
 
 
 
 I'm relatively new to PHP and am unable to solve the problem so I
wondered
 if someone would mind spending a couple of minutes to help me.
 
 My script, in part, reads as below:
 
  // check to see if company exists in db
 
 $CompanyQuery = mysql_query(SELECT coid FROM co_details WHERE
co_name
 =
 '$company' AND co_city = '$city' AND co_country = '$co_country');
 
 $CompanyExist = mysql_num_rows($CompanyQuery);
 $company_id= mysql_result($CompanyQuery,0,0);
 
 if ($CompanyExist  0) {
 
   //if company exists add workplace details
$confirmkey =  md5(uniqid(rand()));
   $signup_id = signup_details($username, $title, $fname, $lname,
 $email,
 $country, $job_title, $user_notes, $agree_terms,
$confirmkey,$password);
   addworkplace($signup_id, $company_id, $department, $start_month,
 $start_year, $end_month, $end_year );

add_cons_info($signup_id,$functional,$technical,$mysap,$industry);
 
 }  //END if statement
 
 else { //add company and workplace details
 
// Add new member to table signup
 $confirmkey =  md5(uniqid(rand()));
$signup_id = signup_details($username, $title, $fname, $lname,
 $email, $country, $job_title, $user_notes, $agree_terms, $confirmkey,
 $password);
   $company_id = company_details($company, $city, $co_country);
   addworkplace($signup_id, $company_id, $department, $start_month,
 $start_year, $end_month, $end_year );

add_cons_info($signup_id,$functional,$technical,$mysap,$industry);
 
  } // END else statement
 
   }
 
   //  if successful in adding to vAuthenticate, send confirmation
email
   if (mysql_errno() == 0){
 
$emailerMessage .= \n\n; // 2 Line Breaks
$emailerMessage .= $confirm; // URL to confirm.php - see email.inc
$emailerMessage .= ?confirmkey= . $confirmkey; // add confirm key
to
 message
$emailerMessage .= \n\n; // 2 Line Breaks
$sent = @mail($email, $emailerSubject, $emailerMessage,
 From:$emailerName$emailerEmail\nReply-to:$emailerEmail);
  } // END if statement
 
 }
 
 
 
 
 function signup_details($username, $title, $fname, $lname, $email,
 $country,
 $job_title, $user_notes, $agree_terms, $confirmkey, $password)  {
 
 if ($user_notes == '') {
 
  $user_notes = Member chose not to include a profile;
  $sql = INSERT INTO signup VALUES

('','$username','$title','$fname','$lname','$email','$country','$job_tit
le
 ',
 '$user_notes','$agree_terms',NOW(),'$confirmkey');
   $addmember = mysql_query($sql);
   $memberid=mysql_insert_id();
 
   // If SUCCESSFUL, add to vAuthenticate tables too
   if (mysql_errno() == 0){
   $AddToAuth = new auth();
   $add =
 $AddToAuth-add_user($username,$password,Ungrouped,999,inactive,
'',
 0);
   }
   else{
 print this is the signup details sql statement\n ;
 print $sql.\n;
 print mysql_errno() . :  . mysql_error() . \n;
 exit;
   }
   return $memberid;
 
  }// END if
 
 else {
 
   $user_notes = addslashes($user_notes);
 
   $sql = INSERT INTO signup VALUES

('','$username','$title','$fname','$lname','$email','$country','$job_tit
le
 ',
 '$user_notes','$agree_terms',NOW(),'$confirmkey');
   $addmember = mysql_query($sql);
   $memberid=mysql_insert_id();
 
   // If SUCCESSFUL, add to vAuthenticate tables too
   if (mysql_errno() == 0){
   $AddToAuth = new auth();
   $add =
 $AddToAuth-add_user($username,$password,Ungrouped,999,inactive,
'',
 0);
   }
   else{
 print this is the signup details sql statement\n ;
 print $sql.\n;
 print mysql_errno() . :  . mysql_error() . \n;
 exit;
   }
   return $memberid;
   }// END else
 
 } // END function
 
 function company_details($company, $city, $co_country)
 {
   $newcompanysql = INSERT INTO co_details VALUES
 ('','$company','$city','$co_country');
   $add_company= mysql_query($newcompanysql);
   if (mysql_errno()  0){
 print add compnay details \n;
 print $newcompanysql. \n;
 print mysql_errno() . : .mysql_error() . \n;
 exit;
   }
   else
 return mysql_insert_id();
 }
 
 
 
 function addworkplace ($signup_id, $company_id, $department,
$start_month,
 $start_year, $end_month, $end_year)
 {
  //start date in correct format
  $start_date= $start_year.-.$start_month.-01;
 
   //end date in correct format
$end_date = $end_year.-.$end_month.-01;
 
 /* if ($end_month || $end_year == Present)
 $end_date=NULL;
   else
 $end_date=$end_year.-.$end_month.-01;
 

RE: [PHP-DB] Re: Multi-Table Insert and gettin' data from auto-inc coloumn in one to the other

2002-10-10 Thread John W. Holmes

No, you have to use two queries to do two inserts into different
tables...

---John Holmes...

 -Original Message-
 From: Noodle Snacks [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 10, 2002 7:07 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: Multi-Table Insert and gettin' data from
auto-inc
 coloumn in one to the other
 
 I can get the previous insert auto-increment id via mysql_insert_id().
it
 will solve my problem. but if you know a soloution that will work in
one
 query please share it with me/everyone!
 
 
 --
 JJ Harrison
 [EMAIL PROTECTED]
 
 Noodle Snacks [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I have table A with an auto increment coloumn called tid. during the
 same
  query I need to get that value and stick it in a related record in
 anouther
  table.
 
  I have two doubts.
 
  A: What is the way to do a multitable insert? guess is: INSERT INTO
  table(fields) VALUES (fields), table1(fields) VALUES (fields) etc...
is
 it
  even possible in one query?
 
  B: how can I get the auto increment value from one into the record
on
 the
  other table?
 
 
  --
  JJ Harrison
  [EMAIL PROTECTED]
 
 
 
 
 
 
 
 --
 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] OT...where do I go for this......?

2002-10-10 Thread Michael Cortes

I realize this is off topic, not php db interfacing.  However, it is php and I am 
hoping someone 
can point me to a mailing list that would cover this question.   So here goes


I am working on a simple inventory program and am running into the following 
messageMethod 
Not Allowed
The requested method POST is not allowed for the URL/cafe_inventory/choose.php.
Apache/1.3.23 Server at (domain.net) Port 80

I have been researching this and cannot get it fixed.  I believe it may have to do 
with Bastille.  
I used Bastille about 2 years ago and 3 versions ago.  I've updated the RH on this 
server several 
times but just recently added php and we plan to use it as our application server, if 
I can get 
this problem solved.   

If anyone can think of a mailing list, chat room, or even paid tech support to help me 
with this 
problem, I would greatly appreciate it.

Thank you,



Michael Cortes
Fort LeBoeuf School District
34 East 9th Street
PO Box 810
Waterford PA 16411-0810
814.796.4795
Fax1 814.796.3358
Fax2 978-389-1258


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




RE: [PHP-DB] OT...where do I go for this......?

2002-10-10 Thread John W. Holmes

That would be an Apache configuration issue. Somewhere in http.conf, I
think, you can choose whether or not to allow GET/POST operations.

---John Holmes...

 -Original Message-
 From: Michael Cortes [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 10, 2002 10:25 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] OT...where do I go for this..?
 
 I realize this is off topic, not php db interfacing.  However, it is
php
 and I am hoping someone
 can point me to a mailing list that would cover this question.   So
here
 goes
 
 
 I am working on a simple inventory program and am running into the
 following messageMethod
 Not Allowed
 The requested method POST is not allowed for the
 URL/cafe_inventory/choose.php.
 Apache/1.3.23 Server at (domain.net) Port 80
 
 I have been researching this and cannot get it fixed.  I believe it
may
 have to do with Bastille.
 I used Bastille about 2 years ago and 3 versions ago.  I've updated
the RH
 on this server several
 times but just recently added php and we plan to use it as our
application
 server, if I can get
 this problem solved.
 
 If anyone can think of a mailing list, chat room, or even paid tech
 support to help me with this
 problem, I would greatly appreciate it.
 
 Thank you,
 
 
 
 Michael Cortes
 Fort LeBoeuf School District
 34 East 9th Street
 PO Box 810
 Waterford PA 16411-0810
 814.796.4795
 Fax1 814.796.3358
 Fax2 978-389-1258
 
 
 --
 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] Problem after upgrading to PHP 4.2.3

2002-10-10 Thread Schnittker, Tom

I recently upgrade to PHP 4.2.3 and started having problems with one of my
applications.  I have a PHP application that interfaces to a MySQL DB
(version 3.23) all running on an Apache web server (1.3) under Linux 7.  Up
until doing the upgrade, everything had been working fine.  Now on a daily
basis, the MySQL server has started exceeding the max_connections.  I
doubled the number and again exceeded it.  Being somewhat of a novice with
all of this, I am somewhat at a loss as to where to look to identify the
problem.  Any suggestions that anyone can give me would be greatly
appreciated.

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




RE: [PHP-DB] OT...where do I go for this......?

2002-10-10 Thread Michael Cortes

I just checked and register_globals are on in php.ini.  I have also previously been in 
the 
httpd.conf in my previous attempts to fix this problem.   I have googled my fingers 
off and all 
fixes have mentioned the conf file for apache.  I have played with options ExecCGI 
as well as 
other options as per google search results.

BTW... I am trying to use the POST method in my php scripts.



On 10 Oct 2002 at 10:20, Naved, Masroor wrote:

 Michael,
 
 The easist way of fixing this is to turn register_globals on. It is
 defaulted to off since a few versions ago, I believe. However, there are
 some security concerns you should be aware of with this option. Google
 around for some discuss about this.

On 10 Oct 2002 at 12:09, John W. Holmes wrote:

 That would be an Apache configuration issue. Somewhere in http.conf, I
 think, you can choose whether or not to allow GET/POST operations.
 
 -Original Message-
 
 I am working on a simple inventory program and am running into the following
 messageMethod 
 Not Allowed
 The requested method POST is not allowed for the
 URL/cafe_inventory/choose.php. Apache/1.3.23 Server at (domain.net) Port 80
 
 If anyone can think of a mailing list, chat room, or even paid tech support
 to help me with this 
 problem, I would greatly appreciate it.


Michael Cortes
Fort LeBoeuf School District
34 East 9th Street
PO Box 810
Waterford PA 16411-0810
814.796.4795
Fax1 814.796.3358
Fax2 978-389-1258


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




AW: [PHP-DB] OT...where do I go for this......?

2002-10-10 Thread Thomas Lamy

Have you checked apache's config file for:

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source  .phps

?

IIRC Apache denies POST to file types not registered for... Also it may be
possible that your OS upgrade has overwritten your (old, maybe handcrafted)
httpd.conf.


Thomas


Michael Cortes [mailto:[EMAIL PROTECTED]] wrote:
 Gesendet: Donnerstag, 10. Oktober 2002 18:52
 An: [EMAIL PROTECTED]
 Betreff: RE: [PHP-DB] OT...where do I go for this..?
 
 
 I just checked and register_globals are on in php.ini.  I 
 have also previously been in the 
 httpd.conf in my previous attempts to fix this problem.   I 
 have googled my fingers off and all 
 fixes have mentioned the conf file for apache.  I have played 
 with options ExecCGI as well as 
 other options as per google search results.
 
 BTW... I am trying to use the POST method in my php scripts.
 
 
 
 On 10 Oct 2002 at 10:20, Naved, Masroor wrote:
 
  Michael,
  
  The easist way of fixing this is to turn register_globals on. It is
  defaulted to off since a few versions ago, I believe. 
 However, there are
  some security concerns you should be aware of with this 
 option. Google
  around for some discuss about this.
 
 On 10 Oct 2002 at 12:09, John W. Holmes wrote:
 
  That would be an Apache configuration issue. Somewhere in 
 http.conf, I
  think, you can choose whether or not to allow GET/POST operations.
  
  -Original Message-
  
  I am working on a simple inventory program and am running 
 into the following
  messageMethod 
  Not Allowed
  The requested method POST is not allowed for the
  URL/cafe_inventory/choose.php. Apache/1.3.23 Server at 
 (domain.net) Port 80
  
  If anyone can think of a mailing list, chat room, or even 
 paid tech support
  to help me with this 
  problem, I would greatly appreciate it.
 
 
 Michael Cortes
 Fort LeBoeuf School District
 34 East 9th Street
 PO Box 810
 Waterford PA 16411-0810
 814.796.4795
 Fax1 814.796.3358
 Fax2 978-389-1258
 
 
 -- 
 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: AW: [PHP-DB] OT...where do I go for this......?

2002-10-10 Thread Michael Cortes

This is what I have in my config file:

# The following is for PHP4 (conficts with PHP/FI, below):
#IfModule mod_php4.c
  AddType application/x-httpd-php .php4 .php3 .phtml .php
  AddType application/x-httpd-php-source .phps
#/IfModule

# The following is for PHP3:
#IfModule mod_php3.c
  AddType application/x-httpd-php3 .php3
  AddType application/x-httpd-php3-source .phps
#/IfModule

# The following is for PHP/FI (PHP2):
IfModule mod_php.c
  AddType application/x-httpd-php .phtml
/IfModule


You can probably tell that I have commented out some of my IfModule statements.  I 
kept getting a 
repeated theme of the AddType statements not being active in my google searches.  I 
figured I could 
test by comment out the if and making them active all the time.



On 10 Oct 2002 at 18:59, Thomas Lamy wrote:

 Have you checked apache's config file for:
 
 AddType application/x-httpd-php   .php
 AddType application/x-httpd-php   .php4
 AddType application/x-httpd-php-source.phps
 
  BTW... I am trying to use the POST method in my php scripts.
  
  On 10 Oct 2002 at 10:20, Naved, Masroor wrote:
  
   -Original Message-
   
   I am working on a simple inventory program and am running 
  into the following
   messageMethod 
   Not Allowed
   The requested method POST is not allowed for the
   URL/cafe_inventory/choose.php. Apache/1.3.23 Server at 
  (domain.net) Port 80
   
   If anyone can think of a mailing list, chat room, or even 
  paid tech support
   to help me with this 
   problem, I would greatly appreciate it.




Michael Cortes
Fort LeBoeuf School District
34 East 9th Street
PO Box 810
Waterford PA 16411-0810
814.796.4795
Fax1 814.796.3358
Fax2 978-389-1258


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




[PHP-DB] sessions tutorial

2002-10-10 Thread Edward Peloke

Sorry, Michael, I meant to send this to the list, not just to you.  I
apologize.




Hello all,

I am a php newbie and am currently developing my first php page.  My page
will allow several people to log in at the same time sharing access to the
mysql db.  SO, I need to use sessions.  Does anyone know of a good tutorial
on sessions to get me started?

Thanks,
Eddie


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




[PHP-DB] checkboxes names values in mySQL (newbie)

2002-10-10 Thread John

I'm new at using PHP and mySQL, so please forgive my potentially naive question.

I have a series of checkboxes with different values.  The user can select any number 
of checkboxes, and I need to store this information in a mySQL table.

2 questions:
Should I have a unique form name for each checkbox, and store it's boolean value in 
the database, 
OR (is it more streamlined) ..
To create an array input type=checkbox name=apps value =myarray[$i] with the same 
name but different value for each checkbox.

Finally, how do I construct the query to store the array of values?  Do I need a 
separate column (enum('n','y') for each value, or should I store all the true values 
as a long text string?

If anyone has some code snippets, that would help very much.

Thanks very much!




[PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-10 Thread Tim Haak

Hello,

I'm trying to retrieve data from a MySQL table which contains data encrypted with the 
MySQL PASSWORD() function from a PHP script but I can't seem to get it to work.  
Below is the query I'm trying:

SELECT * FROM user_data WHERE username = 'thaak' AND password = PASSWORD('thaak');

I then tried the following subquery/subselect:

SELECT * FROM user_data WHERE username = 'thaak' AND password IN (SELECT 
PASSWORD('thaak') FROM user_data);

...which also didn't work.

If I just execute SELECT PASSWORD('thaak') from the MySQL command line it returns 
the same value stored in the password column of my user_data table.  I verified these 
queries at the MySQL command line so I don't think it's a PHP problem.

I need to compare the password the user enters to log in against the password stored 
in the DB.  In addition to the PASSWORD() function, I also tried MD5() and 
ENCRYPT() but they also failed.  Can someone please help me accomplish this or point 
me to some resources that might help?

Thanks!

Tim Haak

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




[PHP-DB] update and join?

2002-10-10 Thread Cory Hicks

Hello to all!

Quick questionis it possible to do an update query w/ a join yet? If not, what is 
your preferred method? Would you take care of it on the PHP side?

I need to update a table w/ data from another table if certain conditions are true, 
i.e the fields in the table to be joined are NULL

Any help as always is greatly appreciated

Thanks,

Cory

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




[PHP-DB] space in query

2002-10-10 Thread Edward Peloke

forgive the basic question but how do I add a space in my query

$result=mysql_query(SELECT * from .$dbname..grades WHERE user_id=.$uid.
 and subject=.$subject,$db);

I need to force a space between $uid and 'and' and I don't think simply
pressing the space bar does it.

Thanks,

Eddie


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




RE: [PHP-DB] space in query

2002-10-10 Thread Edward Peloke


nevermind, stupid me, I got it working...
-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 5:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] space in query


forgive the basic question but how do I add a space in my query

$result=mysql_query(SELECT * from .$dbname..grades WHERE user_id=.$uid.
 and subject=.$subject,$db);

I need to force a space between $uid and 'and' and I don't think simply
pressing the space bar does it.

Thanks,

Eddie


-- 
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] update and join?

2002-10-10 Thread Thomas Lamy

Cory Hicks [mailto:[EMAIL PROTECTED]] wrote:
 Hello to all!
 
 Quick questionis it possible to do an update query w/ a 
 join yet? If not, what is your preferred method? Would you 
 take care of it on the PHP side?
No, it's not possible, at least not with MySQL 3.x. MySQL 4.1, currently in
development, will feature nested subqueries and multi-table-updates.
 
 I need to update a table w/ data from another table if 
 certain conditions are true, i.e the fields in the table to 
 be joined are NULL
 
I have to do that a couple of times, and always do it this way:
Build a SELECT statement, selecting all the data you will need in the
updates, and the primary key for the table which needs updates.
Fetch all the data in a nested array, like this:
  $a = array(primary key 1 = array (col1=data1,col3=data3),
 primary key 2 = array (col2=data2,col3=data3),
 );
and then, do the updates in a neat foreach loop:
  foreach ($a as $pkey=$data) {
[ build update stmt from $data array ]
dbquery ($stmt)
  }

Hope this helps.

Thomas

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




RE: [PHP-DB] update and join?

2002-10-10 Thread John W. Holmes

 Quick questionis it possible to do an update query w/ a join yet?
If
 not, what is your preferred method? Would you take care of it on the
PHP
 side?

Probably depends on your database, but MySQL doesn't support it. I think
MySQL 4.0 might.

 I need to update a table w/ data from another table if certain
conditions
 are true, i.e the fields in the table to be joined are NULL

You'll have to use a scripting language, or something outside of the
database. Or maybe a INSERT INTO ... SELECT ... will help?

---John Holmes...



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




RE: [PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-10 Thread John W. Holmes

 I'm trying to retrieve data from a MySQL table which contains data
 encrypted with the MySQL PASSWORD() function from a PHP script but I
 can't seem to get it to work.  Below is the query I'm trying:
 
 SELECT * FROM user_data WHERE username = 'thaak' AND password =
 PASSWORD('thaak');
 
 I then tried the following subquery/subselect:
 
 SELECT * FROM user_data WHERE username = 'thaak' AND password IN
(SELECT
 PASSWORD('thaak') FROM user_data);
 
 ...which also didn't work.

How do you know it didn't work? The first query is what you want to
use. If you are using PHP variables, make sure they actually have the
values you expect in them.

---John Holmes...



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




[PHP-DB] Re: Multi-Dimensional Arrays

2002-10-10 Thread Jonathan Duncan

Perfect, thank you very much Owen!!


Owen Prime [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Sounds like what your trying to do is:

 $cartArray[] = array(ItemNumber = $itemnumber,
  Brand  = $brand,
  Quantity   = $itemqty,
  ItemName   = $itemname);

 This will give you:

 $cartArray[0][ItemNumber] = $itemnumber;
 $cartArray[0][Brand] = $brand;
 $cartArray[0][Quantity] = $itemqty;
 $cartArray[0][ItemName] = $itemname;

 Running the very top statement again will give you:

 $cartArray[1][ItemNumber] = $itemnumber;
 $cartArray[1][Brand] = $brand;
 $cartArray[1][Quantity] = $itemqty;
 $cartArray[1][ItemName] = $itemname;

 Note that $cartArray[] = $val is just a short hand way of doing
 array_push($cartArray, $val);

 Cheers,

 Owen Prime
 http://www.noggin.com.au



 Jonathan Duncan wrote:

  I am trying to create an array to hold shopping cart information.  The
  array
  I am using is called cartArray.  What I want to do is to define a
  sub-array of cartArray with the information from one product.  Then the
  next time a product is added it appends then new information as a second
  sub-array to cartArray and so forth.  Following is some code I have been
  using to test with and so far PHP will let me use .= to append but
when
  I try to call it back with print_r or echo array[][] only the first
  entry is
  returned.  Any ideas what I am doing wrong?
 
  
   $brand=Brand1;
   $itemnumber=456789;
   $itemname=Some Item Name;
   $itemqty=3;
   $cartArray[] .= array(0=array($itemnumber=$brand, $itemqty,
  $itemname));
   print_r($cartArray).BRBR;
   $brand=Brand2;
   $itemnumber=123456;
   $itemname=Another Item Name;
   $itemqty=9;
   array_push($cartArray, array($itemnumber=$brand, $itemqty,
  $itemname));
   print_r($cartArray).BRBR;
   echo $cartArray[0][0].BRBR;
  
 
  Thank you,
  Jonathan Duncan





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




Re: [PHP-DB] sessions tutorial

2002-10-10 Thread Ruth Zhai

This is a very good tutorial about authentication using PHP and MySQL.  If
you don't use database, you may still learn some thing about sessions from
there:
http://phpcomplete.com/content.php?id=72

Ruth
- Original Message -
From: Edward Peloke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 11, 2002 3:54 AM
Subject: [PHP-DB] sessions tutorial


 Sorry, Michael, I meant to send this to the list, not just to you.  I
 apologize.




 Hello all,

 I am a php newbie and am currently developing my first php page.  My page
 will allow several people to log in at the same time sharing access to the
 mysql db.  SO, I need to use sessions.  Does anyone know of a good
tutorial
 on sessions to get me started?

 Thanks,
 Eddie


 --
 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] easier way to do this? (time interval)

2002-10-10 Thread Thoenen, Peter Mr. EPS

Hello,

Curious if there is an easier way to do this (using just SQL and not PHP).
SQL seems powerful enough to do this but can't think of the synatx.  Note, I
am using MySQL so no sub-selects (or other useful items).  Basically trying
to pull all records for a 24 hour period but instead of -2400,
0700-0700 (next day).

if (date(H)7){

  $query=mysql_query(
SELECT dtg 
FROM techs 
WHERE 
  tech='$user'
AND
  DAYOFMONTH(NOW())=DAYOFMONTH(dtg)
AND
  HOUR(dtg)=7
  );

} else {

  $query=mysql_query(
SELECT dtg 
FROM techs 
WHERE 
  tech='$user' 
AND 
(
  (DAYOFMONTH(NOW())=DAYOFMONTH(dtg) AND HOUR(dtg)7)
  OR
  ((DAYOFMONTH(NOW())-1)=DAYOFMONTH(dtg) AND HOUR(dtg)=7)
)
  );

}

Cheers,

-peter

##
Peter Thoenen - Systems Programmer
Commercial Communications
Camp Bondsteel, Kosovo
##

Stumbled Upon...heh (Score:5, Funny) /.
by $carab on 23:00 23 August 2002 (#4131637)

ForensicTec officials said they stumbled upon the military networks about
two months ago, while checking on network security for a private-sector
client.

Someone new to a Dvorak probably tried to type in lynx
http://www.google.com; but instead got nmap -v -p 1-1024 -sS -P0 army.mil
-T paranoid.

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




[PHP-DB] Re: easier way to do this? (time interval)

2002-10-10 Thread David Robley

In article 
[EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 Hello,
 
 Curious if there is an easier way to do this (using just SQL and not PHP).
 SQL seems powerful enough to do this but can't think of the synatx.  Note, I
 am using MySQL so no sub-selects (or other useful items).  Basically trying
 to pull all records for a 24 hour period but instead of -2400,
 0700-0700 (next day).
 
 if (date(H)7){
 
   $query=mysql_query(
 SELECT dtg 
 FROM techs 
 WHERE 
   tech='$user'
 AND
   DAYOFMONTH(NOW())=DAYOFMONTH(dtg)
 AND
   HOUR(dtg)=7
   );
 
 } else {
 
   $query=mysql_query(
 SELECT dtg 
 FROM techs 
 WHERE 
   tech='$user' 
 AND 
 (
   (DAYOFMONTH(NOW())=DAYOFMONTH(dtg) AND HOUR(dtg)7)
   OR
   ((DAYOFMONTH(NOW())-1)=DAYOFMONTH(dtg) AND HOUR(dtg)=7)
 )
   );
 
 }
 
 Cheers,
 
 -peter

I'd imagine that with a judicious use of mysql's IF statement and 
HOUR(NOW()) you could do pretty much what you want. I can't be hanged 
going through the docs right now, or I'd have a try at the syntax for you 
:-)

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP-DB] checkboxes names values in mySQL (newbie)

2002-10-10 Thread Andrey Sosnitsky

Hello, John.

You wrote 10 îêòÿáðÿ 2002 ã., 23:40:10:

J 2 questions:
J Should  I have a unique form name for each checkbox, and store it's
J boolean value in the database, OR (is it more streamlined) ..

J To   create   an   array   input   type=checkbox  name=apps  value
J =myarray[$i]  with  the  same  name  but  different value for each
J checkbox.
Yes, you are right. This is a good way, to create an array.

J Finally, how do I construct the query to store the array of values?
J Do  I  need  a  separate  column  (enum('n','y') for each value, or
J should I store all the true values as a long text string?
It'll be nice to store values separetly each in row.

Smth like this

INSERT INTO table (apps, value) VALUES ('apps', '$value[1]');
INSERT INTO table (apps, value) VALUES ('apps', '$value[2]');
etc.

Then, you can manupulate those values as you want.

www.pskov.ruwebmaster|programmer|DBA
www.invest.pskov.ru
www.education.pskov.ru
-- 
Best Regards,
Andrey  mailto:[EMAIL PROTECTED]



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