[PHP-DB] Re: Extremely Urgent: Problem with PHP and Oracle

2004-06-10 Thread Justin Patrin
Charles Morris wrote:
Hello all, I have recently been working with OCI and when I use OCILogon
[wethere with example scripts or my own code] I get a PAge cannot be
displayed (like DNS error) when I naviagte to the page. When I comment
out the OCILogon part it works great exept for the oracle part. I am able
to accesss the database from Perl, the built in SQL*PLUS and other
languages.- The only problem is this. I have to have this working by
friday morning and I cannot risk not mailing this alias; so please any
help is greatly appreciated!!
Here are my code snippets:
dbconnection.php
?php
class OracleConnection
{
  var $CONN = ;
  var $IPADD = *.*.*.*;
  var $USER = ;
  var $PASS = ;
  var $SID = ;
  function fatal_error($text)
  {
$maillink = 'a href=mailto:[EMAIL PROTECTED]network administrator/a';
echo bFatal Error. /bbr;
echo [$text] ( 0 : 0 ) br;
echo $_SERVER['HTTP_USER_AGENT'];
echo br;
echo ORACLE_SID: .getenv(ORACLE_SID).BRORACLE_HOME: 
.getenv(ORACLE_HOME.BR;
$error = OCIError();
if ($error[offset])
{
   $sqltext = substr ($error[sqltext], 0, $error[offset]) . '*' . substr ($err 
($error[sqltext], $error[offset]);
}
else
{$sqltext = No OCI error.;}
echo $sqltext;
echo BRContact the $maillink with this message.\n;
  exit;
  function init()
  {
putenv(ORACLE_SID=PROJ);
putenv(ORACLE_HOME=/home/oracle9);
$ipadd = $this-IPADD;
$user = $this-USER;
$pass = $this-PASS;
//$dbase = $this-DBASE;
//$dbase = $DBAC_BEGIN . $DBAC_PROTO . $DBAC_HOST . $DBAC_PORT . )) . $DBAC_COTD . 
);
$dbase = (DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = 128.*.*.*)(PORT 
= 1521)))(CONNECT_DATA=(SID=PROJ)));
// use for PHP 5.0 and greater
//$conn = oci_connect($user, $pass, $dbase) || $this-fatal_error(Connection could not 
be established with server [$ipadd]);
// use for PHP 4.91 and lower
$conn = ociplogon($user, $pass, $dbase) || $this-fatal_error(Connection could not be 
established with server [$ipadd]);
$this-CONN = $conn || $this-fatal_error(Connection could not be stabalized, unable 
to continue.);
  return true;
  }
//end class: 'OracleConnection'
}
--eof--
Also, could someone please send me a working example of using variables
appended to text with array()? I am a long time experienced perl
programmer and I have tried using the . operatore a + but no luck.
Thanks everyone!!!
Please excuse types, typing on a 14.4 connection.
---
Charles Morris
[EMAIL PROTECTED]
CS Systems GroupOld Dominion University
http://www.cs.odu.edu/~cmorris
http://www.cs.odu.edu/cspage/systemstaff.html
--
They that give up essential liberty to obtain
a little temporary safety deserve neither
liberty nor safety. -- Benjamin Franklin, 1759
The only secure computer is one that's unplugged, locked in a
safe, and buried 20 feet under the ground in a secret location...
and i'm not even too sure about that one--Dennis Huges, FBI.
On first glance, your fatal_error function doesn't seem to have an ending }.
I have tried putenv myself and it doesn't seem to work for Oracle 
connections. Putting those in your shell environment, then restarting 
apache. Check to see if the env vars are set from a PHP script (without 
using putenv to set them of course).

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


Re: [PHP-DB] Re: Extremely Urgent: Problem with PHP and Oracle

2004-06-10 Thread Christopher Jones
Justin Patrin wrote:
Charles Morris wrote:
putenv(ORACLE_SID=PROJ);
putenv(ORACLE_HOME=/home/oracle9);

I have tried putenv myself and it doesn't seem to work for Oracle 
connections. Putting those in your shell environment, then restarting 
apache. Check to see if the env vars are set from a PHP script (without 
using putenv to set them of course).
I agree.  See 
http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Getting data from mysql db for html form

2004-06-10 Thread Gawie Marais
works like a bomb !!!

thanx man !



Torsten Roehr [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Gamco - Gawie Marais [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi,
 
  Could someone help me out here...
 
  I have a mysql database with a table that conatains names. I am setting
up
 a
  html form and I would like to create a multi-listing with those names so
  that you can choose one and then submit the form.


 // open db connection...

 $result = mysql_query(SELECT name FROM table);

 echo 'select name=names';

 while ($row = mysql_fetch_assoc($result)) {

 echo 'option' . $row['name'] . '/option';
 }

 echo '/select';

 Haven't tested it. Change 'name' to the name of your table column.

 Regards,

 Torsten Roehr

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



[PHP-DB] Re: Count unique visits in PHP/MySQL

2004-06-10 Thread Rui Cunha
take a look at this: 

http://otn.oracle.com/oramag/oracle/04-mar/o24asktom.html 

and search for the Analytics to the Rescue example. Instead of 3 seconds 
you want 1800 and instead of sum you want count.Don't forget to group by 
ip,of course... And you're done. No need for an extra table. 

Hope it helps you out. 

Rui Cunha 

Kim Steinhaug writes: 

Whatabout creating a table containing online users,
where you log every activity with IP, BrowserSession and Timestamp.
You also create a table to track the accual unique visits. 

So my logic to solve it : 

Update the online table like this (Some rough coding below, not tested at
all, read the logic).
30 minutes = 60sec*30 = 1800 

1delete from online where timestamp . (time() - 1800); // Delete
inactive users / uniqe ghosts or whatever
2Update online set timestamp = ' . time() . ' where ip=' . $ip . '
and browsersession = ' . $browsersession . ';
3If (!mysql_affected_rows()){
// Update the Unique visitor table
// Insert new entry with IP, Browsersession and time() into the
online database
} 

As far as my midnight brain would see it this would work nicely. 

--
--
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
-- 

[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
ast.net...
I am making a PHP/MySQL traffic report page from a table that records some
user activity using PHP referrer information.
I have a table with three rows: IP, page_name, and timestamp. The IP row
records the user's IP address, page_name records the name of the page that
the user loaded, and the timestamp row records in Unix timestamp format the
time of day that the user requested the page.
I want to be able to count unique visits per IP according to Internet
Advertising Bureau standards, which count a Unique Visit as a log in by
the same IP once every thirty minutes.
IAB verbatim definition: Visit - One or more text and/or graphics
downloads from a site qualifying as at least one page, without 30
consecutive minutes of inactivity, which can be reasonably attributed to a
single browser for a single session. A browser must pull text or graphics
content to be considered a visit.
So I need to make a MySQL query that will count how many times an IP
logged a timestamp within a given time period.
For example, the publisher checking traffic could request a date between
May 1 and May 31, and I'd like to be able to return a page that counted
unique users (count distinct IP), pages viewed (list distinct pages) and how
many times they visited in that period. I have the first two down, but not
the unique visits. Any ideas? 

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


[PHP-DB] datetime update

2004-06-10 Thread Gawie Marais
Hi all,

i have a datetime field in a mysql database and it's defined with a default
of '-00-00 00:00:00:'

now, when i add a record to the database, i want to fill that field with the
date and current time.

can anyone point me ?


Thanx,

Gawie.

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



[PHP-DB] Re: datetime update

2004-06-10 Thread roehr
Hi all,

i have a datetime field in a mysql database and it's defined with a default
of '-00-00 00:00:00:'

now, when i add a record to the database, i want to fill that field with the date 
and current time.

can anyone point me ?

Via PHP:
$dateTime = date('Y-m-d H:i:s');
mysql_query(INSERT INTO table SET dateTime = '$dateTime');

Via MySQL:
mysql_query(INSERT INTO table SET dateTime = NOW());

Take a look here for other useful MySQL date and time functions:
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

Hope it helps. Regards,

Torsten Roehr

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



[PHP-DB] automatic call reference creation

2004-06-10 Thread Gawie Marais
hi all,

i need to create an automatic call reference. i though it would work using
the date as ccyymmdd and by adding a '001', '002', etc to the end.

now, i know how to format the date but how would i increment the 001, 002 at
the end... ? i understand that i would have to check back to the database to
check the last one used. but how... ?

alternatively is to just generate a random number, check it against the
database to see if it's not already used. if not use it. if its used
already, just create another one... ?

OR

do you guys have any laternative suggestions ?


Regards,

Gawie.

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



[PHP-DB] HELP: best way to TEXT dump a MySQL table to a local file...

2004-06-10 Thread Leo G. Divinagracia III
project i'm working with, his host died or something.
but, the phpMyadmin (on that host) can NOT do a backup of 200mb table 
without running out of memory or something weird.

so what is the best way to text dump the table?
i thought i would (pseudo-code):
open DB
do while not EOF
grab 1000 rows from DB
write to a file on host www path
filename = filename000 + 1
until EOF
user would then FTP down the files to his machine.
but i figured i could use the HEADER to send it to the user.
i grabbed this from the HEADER help section:
?php
$output_file = 'something.txt';
$content_len = 666;
@ob_end_clean();
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octetstream; name=' . $output_file . 
'');
header('Content-Disposition: inline; filename=' . $output_file . '');
header(Content-length: $content_len);

?
is that the best way to send the txt file to the user?
thanks...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local file...

2004-06-10 Thread Ignatius Reilly
Hi the Third,

have you considered dumping the table into a text file?
SELECT *
FROM mytable
INTO OUTFILE c:/...

this (AFAI) does not cause memory issues

Ignatius
_
- Original Message -
From: Leo G. Divinagracia III [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 11:39 AM
Subject: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local
file...


 project i'm working with, his host died or something.

 but, the phpMyadmin (on that host) can NOT do a backup of 200mb table
 without running out of memory or something weird.

 so what is the best way to text dump the table?

 i thought i would (pseudo-code):


 open DB
 do while not EOF
  grab 1000 rows from DB
  write to a file on host www path
  filename = filename000 + 1
 until EOF

 user would then FTP down the files to his machine.


 but i figured i could use the HEADER to send it to the user.

 i grabbed this from the HEADER help section:


 ?php
 $output_file = 'something.txt';
 $content_len = 666;

 @ob_end_clean();
 @ini_set('zlib.output_compression', 'Off');
 header('Pragma: public');
 header('Content-Transfer-Encoding: none');
 header('Content-Type: application/octetstream; name=' . $output_file .
 '');
 header('Content-Disposition: inline; filename=' . $output_file . '');
 header(Content-length: $content_len);

  ?

 is that the best way to send the txt file to the user?

 thanks...

 --
 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] Re: automatic call reference creation

2004-06-10 Thread pete M
not sure what u want here but
have you looked at the identiry field ??
its called auto_increment in mysql and this gives it record in a 
database a unique number

eg
Insert into table (date_call)values(now() )
then after the insert do
select last_insert_id()
pedro
Gawie Marais wrote:
hi all,
i need to create an automatic call reference. i though it would work using
the date as ccyymmdd and by adding a '001', '002', etc to the end.
now, i know how to format the date but how would i increment the 001, 002 at
the end... ? i understand that i would have to check back to the database to
check the last one used. but how... ?
alternatively is to just generate a random number, check it against the
database to see if it's not already used. if not use it. if its used
already, just create another one... ?
OR
do you guys have any laternative suggestions ?
Regards,
Gawie.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: automatic call reference creation

2004-06-10 Thread Gawie Marais
thanx for the replys guys... basically i need a PHP formula to generate a
'call refenrence code' that is unique to give out to clients whenever they
log a call. this unique 'call reference code should be inserted into a mysql
field within a table.

all i need is a formula to get the last entered code and increment it by
one - the intended code should be forumated by php by using the current date
i.e. 20040101 + a numerical value i.e. 001 for the first 'call reference
code' for the day. when the next call is logged, the next unique available
numerical should be assigned and combined with the date to form the call
reference number.

hope this makes it a bit clearer.




Pete M [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 not sure what u want here but
 have you looked at the identiry field ??
 its called auto_increment in mysql and this gives it record in a
 database a unique number

 eg
 Insert into table (date_call)values(now() )

 then after the insert do
 select last_insert_id()

 pedro

 Gawie Marais wrote:
  hi all,
 
  i need to create an automatic call reference. i though it would work
using
  the date as ccyymmdd and by adding a '001', '002', etc to the end.
 
  now, i know how to format the date but how would i increment the 001,
002 at
  the end... ? i understand that i would have to check back to the
database to
  check the last one used. but how... ?
 
  alternatively is to just generate a random number, check it against the
  database to see if it's not already used. if not use it. if its used
  already, just create another one... ?
 
  OR
 
  do you guys have any laternative suggestions ?
 
 
  Regards,
 
  Gawie.

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



[PHP-DB] Re: automatic call reference creation

2004-06-10 Thread pete M
using the autoincrement you'd have to create the entry first !
otherwise your gonna have problems with concurrent users
Gawie Marais wrote:
thanx for the replys guys... basically i need a PHP formula to generate a
'call refenrence code' that is unique to give out to clients whenever they
log a call. this unique 'call reference code should be inserted into a mysql
field within a table.
all i need is a formula to get the last entered code and increment it by
one - the intended code should be forumated by php by using the current date
i.e. 20040101 + a numerical value i.e. 001 for the first 'call reference
code' for the day. when the next call is logged, the next unique available
numerical should be assigned and combined with the date to form the call
reference number.
hope this makes it a bit clearer.

Pete M [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
not sure what u want here but
have you looked at the identiry field ??
its called auto_increment in mysql and this gives it record in a
database a unique number
eg
Insert into table (date_call)values(now() )
then after the insert do
select last_insert_id()
pedro
Gawie Marais wrote:
hi all,
i need to create an automatic call reference. i though it would work
using
the date as ccyymmdd and by adding a '001', '002', etc to the end.
now, i know how to format the date but how would i increment the 001,
002 at
the end... ? i understand that i would have to check back to the
database to
check the last one used. but how... ?
alternatively is to just generate a random number, check it against the
database to see if it's not already used. if not use it. if its used
already, just create another one... ?
OR
do you guys have any laternative suggestions ?
Regards,
Gawie.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] MySql syntax error using PHPWiki

2004-06-10 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Greetings,

I'm trying to set up a PHPWiki using Apache 2.0.49, PHP 4.3.7, PEAR 4.1.0,
and PHPWiki 1.3.10.

I get this error when trying to load index.php:

C:\Program Files\Apache
Group\Apache2\htdocs\lib\WikiDB\backend\PearDB.php:778: Fatal[256]:
wikidb_backend_mysql: fatal database error

DB Error: syntax error 
(SELECT sess_data FROM WHERE sess_id='8e7d43511c4184e42da9ed552e431332'
[nativecode=You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near
'WHERE sess_id='8e7d43511c4184e42da9ed552e431332'' at line 1])

It seems that the SQL syntax is incorrect as no table is included in the
SQL statement. Is it something to do with adding a 'prefix' = '', line
to $DBParams in index.php? Is it something else entirely?

Any help is appreciated.

James.

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



Re: [PHP-DB] MySql syntax error using PHPWiki

2004-06-10 Thread Mikhail U. Petrov
Hi!
You missed table definition:
 ... FROM my_table where ...


Wednesday, June 9, 2004, 12:57:02 PM, PHPDiscuss wrote:

PPNaml Greetings,

PPNaml I'm trying to set up a PHPWiki using Apache 2.0.49, PHP 4.3.7, PEAR 4.1.0,
PPNaml and PHPWiki 1.3.10.

PPNaml I get this error when trying to load index.php:

PPNaml C:\Program Files\Apache
PPNaml Group\Apache2\htdocs\lib\WikiDB\backend\PearDB.php:778: Fatal[256]:
PPNaml wikidb_backend_mysql: fatal database error

PPNaml DB Error: syntax error 
PPNaml (SELECT sess_data FROM WHERE sess_id='8e7d43511c4184e42da9ed552e431332'
PPNaml [nativecode=You have an error in your SQL syntax. Check the manual that
PPNaml corresponds to your MySQL server version for the right syntax to use near
PPNaml 'WHERE sess_id='8e7d43511c4184e42da9ed552e431332'' at line 1])

PPNaml It seems that the SQL syntax is incorrect as no table is included in the
PPNaml SQL statement. Is it something to do with adding a 'prefix' = '', line
PPNaml to $DBParams in index.php? Is it something else entirely?

PPNaml Any help is appreciated.

PPNaml James.



-- 
Best regards,
Mikhail U. Petrov
mailto:[EMAIL PROTECTED]

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



[PHP-DB] Oracle syntax

2004-06-10 Thread Rafi Sheikh
Hi list.  I am a newbie and would like to ask if anyone could give me the
proper syntax for connecting with oracle DB.  For example with MySQL it is:
mysql_connect..., mysql_query...
For MS SQL Server:
mssql_connect..., mssql_query...


What would be for oracle?

TIA

RS


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified that
any dissemination, distribution or copying of this e-mail is prohibited. If
you have received this e-mail in error, please notify the sender by replying
to this message and delete this e-mail immediately.

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



RE: [PHP-DB] Oracle syntax

2004-06-10 Thread Marie Osypian

It can be found here:

http://us3.php.net/manual/en/ref.oracle.php

MAO
-Original Message-
From: Rafi Sheikh [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 10, 2004 9:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Oracle syntax


Hi list.  I am a newbie and would like to ask if anyone could give me
the proper syntax for connecting with oracle DB.  For example with MySQL
it is: mysql_connect..., mysql_query... For MS SQL Server:
mssql_connect..., mssql_query...


What would be for oracle?

TIA

RS


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.

-- 
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] HTTP header information

2004-06-10 Thread Philip Thompson
Hi all.
I am running a website to where a user needs to login to authenticate 
themselves to perform certain tasks. So a user logs in, and I start a 
session (in PHP, of course). Well, the catch is, I am doing this all 
from one page, 'viewer.php', and I just tack on the specific view/page 
that I want them to see, depending on the link selected on that page. 
Meaning, they click on the 'submit problem' link and it goes to 
'viewer.php?type=submitproblem'.

The problem comes whenever I load the view 'submitproblem' and I start 
a session with session_start(), which carries over the variable to tell 
whether or not the user is logged in. If they have not logged in 
whenever they click on 'submitproblem' then it will redirect them to 
'viewer.php?type=login'. So I log in, and then go to 'submitproblem'.

This is where I get the error: Warning: session_start(): Cannot send 
session cookie - headers already sent. Essentially, I understand why 
this is occurring, but is there an easy way to get around it without 
creating a new page, such as 'submitproblem.php' instead of 
'viewer.php?type=submitproblem'???

Thanks a bunch
~Philip
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Oracle syntax

2004-06-10 Thread Christopher Jones
Rafi Sheikh wrote:
Hi list.  I am a newbie and would like to ask if anyone could give me the
proper syntax for connecting with oracle DB.  For example with MySQL it is:
mysql_connect..., mysql_query...
For MS SQL Server:
mssql_connect..., mssql_query...
There are various examples in the PHP documentation of the oci8 functions
at http://www.php.net/manual/en/ref.oci8.php  (The oci8 functions are preferred to 
the
older oracle functions)
There are a couple of Oracle-PHP FAQ's on 
http://otn.oracle.com/tech/opensource/index.html.
For a specific connection example see 
http://otn.oracle.com/tech/opensource/php_faq.html#CONNECT
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: HTTP header information

2004-06-10 Thread Torsten Roehr
Philip Thompson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi all.

 I am running a website to where a user needs to login to authenticate
 themselves to perform certain tasks. So a user logs in, and I start a
 session (in PHP, of course). Well, the catch is, I am doing this all
 from one page, 'viewer.php', and I just tack on the specific view/page
 that I want them to see, depending on the link selected on that page.
 Meaning, they click on the 'submit problem' link and it goes to
 'viewer.php?type=submitproblem'.

 The problem comes whenever I load the view 'submitproblem' and I start
 a session with session_start(), which carries over the variable to tell
 whether or not the user is logged in. If they have not logged in
 whenever they click on 'submitproblem' then it will redirect them to
 'viewer.php?type=login'. So I log in, and then go to 'submitproblem'.

 This is where I get the error: Warning: session_start(): Cannot send
 session cookie - headers already sent. Essentially, I understand why
 this is occurring, but is there an easy way to get around it without
 creating a new page, such as 'submitproblem.php' instead of
 'viewer.php?type=submitproblem'???

Make sure that NO output is done before session_start() is called. Can you
post some of your code?

Regards,

Torsten Roehr

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



RE: [PHP-DB] Re: datetime update

2004-06-10 Thread Gary Every
Actually it would be:
UPDATE table SET dateTime=NOW() WHERE record_id='$the_one_you_want';

Or
INSERT INTO table (record_id,dateTime) VALUES
('$the_one_you_want',NOW());


Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 10, 2004 4:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: datetime update

Hi all,

i have a datetime field in a mysql database and it's defined with a
default
of '-00-00 00:00:00:'

now, when i add a record to the database, i want to fill that field
with the date and current time.

can anyone point me ?

Via PHP:
$dateTime = date('Y-m-d H:i:s');
mysql_query(INSERT INTO table SET dateTime = '$dateTime');

Via MySQL:
mysql_query(INSERT INTO table SET dateTime = NOW());

Take a look here for other useful MySQL date and time functions:
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

Hope it helps. Regards,

Torsten Roehr

-- 
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] HTTP header information

2004-06-10 Thread James Harrell
Hi Philip,

You'll probably want to move your session handling code to the
top of the main entry point of your application, rather than 
starting it in a sub-page. This way all subpages get the benefit
of being able to use the session data. Even if not strictly
necessary, the option is there in the event you add features
later on that require sessions throughout the application.

A possible alternative is to use output buffering, which allows
you to start a session even after output has been sent. Though
this is more likely a kludge rather than a good solution to the
problem.

James

-Original Message-
From: Philip Thompson [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 9:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] HTTP header information


Hi all.

I am running a website to where a user needs to login to authenticate 
themselves to perform certain tasks. So a user logs in, and I start a 
session (in PHP, of course). Well, the catch is, I am doing this all 
from one page, 'viewer.php', and I just tack on the specific view/page 
that I want them to see, depending on the link selected on that page. 
Meaning, they click on the 'submit problem' link and it goes to 
'viewer.php?type=submitproblem'.

The problem comes whenever I load the view 'submitproblem' and I start 
a session with session_start(), which carries over the variable to tell 
whether or not the user is logged in. If they have not logged in 
whenever they click on 'submitproblem' then it will redirect them to 
'viewer.php?type=login'. So I log in, and then go to 'submitproblem'.

This is where I get the error: Warning: session_start(): Cannot send 
session cookie - headers already sent. Essentially, I understand why 
this is occurring, but is there an easy way to get around it without 
creating a new page, such as 'submitproblem.php' instead of 
'viewer.php?type=submitproblem'???

Thanks a bunch
~Philip

-- 
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] Re: HTTP header information

2004-06-10 Thread Philip Thompson
On Jun 10, 2004, at 9:44 AM, Torsten Roehr wrote:
Philip Thompson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi all.
I am running a website to where a user needs to login to authenticate
themselves to perform certain tasks. So a user logs in, and I start a
session (in PHP, of course). Well, the catch is, I am doing this all
from one page, 'viewer.php', and I just tack on the specific view/page
that I want them to see, depending on the link selected on that page.
Meaning, they click on the 'submit problem' link and it goes to
'viewer.php?type=submitproblem'.
The problem comes whenever I load the view 'submitproblem' and I start
a session with session_start(), which carries over the variable to 
tell
whether or not the user is logged in. If they have not logged in
whenever they click on 'submitproblem' then it will redirect them to
'viewer.php?type=login'. So I log in, and then go to 'submitproblem'.

This is where I get the error: Warning: session_start(): Cannot send
session cookie - headers already sent. Essentially, I understand why
this is occurring, but is there an easy way to get around it without
creating a new page, such as 'submitproblem.php' instead of
'viewer.php?type=submitproblem'???
Make sure that NO output is done before session_start() is called. Can 
you
post some of your code?

Regards,
Torsten Roehr
See, that's the case. Because I'm essentially just changing the content 
within the page, it never leaves the page 'viewer.php' - it just 
changes the content by tacking on '?type=login, submitproblem, etc'.

But my code in the beginning of the file 'submitproblem.view' is:
?php
session_start();
if (!session_is_registered('_isLoggedIn')) {
header (Location:viewer.php?type=login);
} else {
// do the stuff to submit a problem if they have
// logged in and have pressed the submit button
// in the html
}
?
// then here is all the html for that page
So, does that help any?
~Philip
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] password () function.

2004-06-10 Thread Miguel Guirao
Is this function, password() available at PHP Ander Windows?

I get an undefinied function error message!

Miguel Guirao
Servicios Datacard
www.SIASA.com.mx

-Mensaje original-
De: James Harrell [mailto:[EMAIL PROTECTED] 
Enviado el: Jueves, 10 de Junio de 2004 09:50 a.m.
Para: Philip Thompson; [EMAIL PROTECTED]
Asunto: RE: [PHP-DB] HTTP header information

Hi Philip,

You'll probably want to move your session handling code to the
top of the main entry point of your application, rather than 
starting it in a sub-page. This way all subpages get the benefit
of being able to use the session data. Even if not strictly
necessary, the option is there in the event you add features
later on that require sessions throughout the application.

A possible alternative is to use output buffering, which allows
you to start a session even after output has been sent. Though
this is more likely a kludge rather than a good solution to the
problem.

James

-Original Message-
From: Philip Thompson [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 9:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] HTTP header information


Hi all.

I am running a website to where a user needs to login to authenticate 
themselves to perform certain tasks. So a user logs in, and I start a 
session (in PHP, of course). Well, the catch is, I am doing this all 
from one page, 'viewer.php', and I just tack on the specific view/page 
that I want them to see, depending on the link selected on that page. 
Meaning, they click on the 'submit problem' link and it goes to 
'viewer.php?type=submitproblem'.

The problem comes whenever I load the view 'submitproblem' and I start 
a session with session_start(), which carries over the variable to tell

whether or not the user is logged in. If they have not logged in 
whenever they click on 'submitproblem' then it will redirect them to 
'viewer.php?type=login'. So I log in, and then go to 'submitproblem'.

This is where I get the error: Warning: session_start(): Cannot send 
session cookie - headers already sent. Essentially, I understand why 
this is occurring, but is there an easy way to get around it without 
creating a new page, such as 'submitproblem.php' instead of 
'viewer.php?type=submitproblem'???

Thanks a bunch
~Philip

-- 
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] password () function.

2004-06-10 Thread Larry E . Ullman
Is this function, password() available at PHP Ander Windows?
I get an undefinied function error message!
There is no PASSWORD() function in PHP. There is, however, a PASSWORD() 
function in MySQL and other database applications.

Larry
PS It looks like you hijacked someone else's thread, which you 
shouldn't do.

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


Re: [PHP-DB] Re: HTTP header information

2004-06-10 Thread Torsten Roehr
Philip Thompson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 On Jun 10, 2004, at 9:44 AM, Torsten Roehr wrote:

  Philip Thompson [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
  Hi all.
 
  I am running a website to where a user needs to login to authenticate
  themselves to perform certain tasks. So a user logs in, and I start a
  session (in PHP, of course). Well, the catch is, I am doing this all
  from one page, 'viewer.php', and I just tack on the specific view/page
  that I want them to see, depending on the link selected on that page.
  Meaning, they click on the 'submit problem' link and it goes to
  'viewer.php?type=submitproblem'.
 
  The problem comes whenever I load the view 'submitproblem' and I start
  a session with session_start(), which carries over the variable to
  tell
  whether or not the user is logged in. If they have not logged in
  whenever they click on 'submitproblem' then it will redirect them to
  'viewer.php?type=login'. So I log in, and then go to 'submitproblem'.
 
  This is where I get the error: Warning: session_start(): Cannot send
  session cookie - headers already sent. Essentially, I understand why
  this is occurring, but is there an easy way to get around it without
  creating a new page, such as 'submitproblem.php' instead of
  'viewer.php?type=submitproblem'???
 
  Make sure that NO output is done before session_start() is called. Can
  you
  post some of your code?
 
  Regards,
 
  Torsten Roehr
 

 See, that's the case. Because I'm essentially just changing the content
 within the page, it never leaves the page 'viewer.php' - it just
 changes the content by tacking on '?type=login, submitproblem, etc'.

 But my code in the beginning of the file 'submitproblem.view' is:

 ?php
 session_start();

 if (!session_is_registered('_isLoggedIn')) {
 header (Location:viewer.php?type=login);
 } else {
 // do the stuff to submit a problem if they have
 // logged in and have pressed the submit button
 // in the html
 }

 ?

 // then here is all the html for that page

 So, does that help any?

Looks okay, but PHP complains when you are trying to set the cookie. Can you
post some lines from where you're setting the cookie?

Torsten

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



RE: [PHP-DB] password () function.

2004-06-10 Thread Miguel Guirao
OK, now I understand why it doesn't works under SQL Server.!!
Thanks!

P.S. Yes, I do hijacked someone else's thread. I won't do it again!
THANKS!


Miguel Guirao
Servicios Datacard
www.SIASA.com.mx

-Mensaje original-
De: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
Enviado el: Jueves, 10 de Junio de 2004 10:13 a.m.
Para: Miguel Guirao
CC: [EMAIL PROTECTED]
Asunto: Re: [PHP-DB] password () function.

 Is this function, password() available at PHP Ander Windows?

 I get an undefinied function error message!

There is no PASSWORD() function in PHP. There is, however, a PASSWORD() 
function in MySQL and other database applications.

Larry

PS It looks like you hijacked someone else's thread, which you 
shouldn't do.

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



RE: [PHP-DB] Re: HTTP header information

2004-06-10 Thread James Harrell
 Make sure that NO output is done before session_start() is called. Can 
 you post some of your code?


See, that's the case. Because I'm essentially just changing the content 
within the page, it never leaves the page 'viewer.php' - it just 
changes the content by tacking on '?type=login, submitproblem, etc'.

Look for an errant space or CR after your original closing PHP tag. Also
check the file CR/LF/EOF spec is the same as that of your server. For
example, if your server is unix and your dev machine in Win32, dos2unix
the file to make certain there are no extra characters after the closing
php tag.

Any output- even a space or extra CR/LF will cause PHP to send the headers.

James

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



RE: [PHP-DB] Re: automatic call reference creation

2004-06-10 Thread Gary Every
Here's what you can do:

1. CREATE your table with an autoincrement column as well as a date
column.

2. When the customer service rep logs the call, they click on the submit
button, which will place the data into the DB

3. Right after you do the insert, (in PHP) do:
$suffix = mysql_insert_id($Resource_id);

4. $padded_suffix = str_pad($suffix, 5, 0, STR_PAD_LEFT); // This will

// pad the $suffix with 0's (up to five characters)

5. $dat = dat(Y-m-d);

6. $callcode = $dat . $padded_suffix;

7. // Show them the call code
echo Your call code is $callcode;

You don't need to store the call code, since you can recreate it using
the autoincrement, the date field, and str_pad. Of course, if space is
not an issue, you could always store the concatenated string into
another column.



Gary Every
Sr. UNIX Administrator
Ingram Entertainment Inc.
2 Ingram Blvd, La Vergne, TN 37089
Pay It Forward!

-Original Message-
From: pete M [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 10, 2004 5:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: automatic call reference creation

using the autoincrement you'd have to create the entry first !

otherwise your gonna have problems with concurrent users

Gawie Marais wrote:

 thanx for the replys guys... basically i need a PHP formula to
generate a
 'call refenrence code' that is unique to give out to clients whenever
they
 log a call. this unique 'call reference code should be inserted into a
mysql
 field within a table.
 
 all i need is a formula to get the last entered code and increment it
by
 one - the intended code should be forumated by php by using the
current date
 i.e. 20040101 + a numerical value i.e. 001 for the first 'call
reference
 code' for the day. when the next call is logged, the next unique
available
 numerical should be assigned and combined with the date to form the
call
 reference number.
 
 hope this makes it a bit clearer.
 
 
 
 
 Pete M [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
not sure what u want here but
have you looked at the identiry field ??
its called auto_increment in mysql and this gives it record in a
database a unique number

eg
Insert into table (date_call)values(now() )

then after the insert do
select last_insert_id()

pedro

Gawie Marais wrote:

hi all,

i need to create an automatic call reference. i though it would work
 
 using
 
the date as ccyymmdd and by adding a '001', '002', etc to the end.

now, i know how to format the date but how would i increment the 001,
 
 002 at
 
the end... ? i understand that i would have to check back to the
 
 database to
 
check the last one used. but how... ?

alternatively is to just generate a random number, check it against
the
database to see if it's not already used. if not use it. if its used
already, just create another one... ?

OR

do you guys have any laternative suggestions ?


Regards,

Gawie.

-- 
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] Re: automatic call reference creation

2004-06-10 Thread Justin Patrin
Gawie Marais wrote:
thanx for the replys guys... basically i need a PHP formula to generate a
'call refenrence code' that is unique to give out to clients whenever they
log a call. this unique 'call reference code should be inserted into a mysql
field within a table.
all i need is a formula to get the last entered code and increment it by
one - the intended code should be forumated by php by using the current date
i.e. 20040101 + a numerical value i.e. 001 for the first 'call reference
code' for the day. when the next call is logged, the next unique available
numerical should be assigned and combined with the date to form the call
reference number.
hope this makes it a bit clearer.

Pete M [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
not sure what u want here but
have you looked at the identiry field ??
its called auto_increment in mysql and this gives it record in a
database a unique number
eg
Insert into table (date_call)values(now() )
then after the insert do
select last_insert_id()
pedro
Gawie Marais wrote:
hi all,
i need to create an automatic call reference. i though it would work
using
the date as ccyymmdd and by adding a '001', '002', etc to the end.
now, i know how to format the date but how would i increment the 001,
002 at
the end... ? i understand that i would have to check back to the
database to
check the last one used. but how... ?
alternatively is to just generate a random number, check it against the
database to see if it's not already used. if not use it. if its used
already, just create another one... ?
OR
do you guys have any laternative suggestions ?
Regards,
Gawie.
You should really just use an auto_increment field in mysql or a 
sequence in any other DB. This will let the DB give you a unique ID. If 
you try to make one yourself, it's possible that you'll have concurrency 
problems.

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


[PHP-DB] Re: HELP: best way to TEXT dump a MySQL table to a local file...

2004-06-10 Thread Justin Patrin
Leo G. Divinagracia III wrote:
project i'm working with, his host died or something.
but, the phpMyadmin (on that host) can NOT do a backup of 200mb table 
without running out of memory or something weird.

so what is the best way to text dump the table?
i thought i would (pseudo-code):
open DB
do while not EOF
grab 1000 rows from DB
write to a file on host www path
filename = filename000 + 1
until EOF
user would then FTP down the files to his machine.
but i figured i could use the HEADER to send it to the user.
i grabbed this from the HEADER help section:
?php
$output_file = 'something.txt';
$content_len = 666;
@ob_end_clean();
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octetstream; name=' . $output_file . 
'');
header('Content-Disposition: inline; filename=' . $output_file . '');
header(Content-length: $content_len);

 ?
is that the best way to send the txt file to the user?
thanks...
Try using mysqldump from the command line. If you need a PHP script to 
do this, use system() or `` or one of the other system call functions.

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


Re: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local file...

2004-06-10 Thread Leo G. Divinagracia III
would be nice... but since this is a hosted site and no shell access or 
anything, i thought i would write the php script to dump the file to my 
web path...


Ignatius Reilly wrote:
Hi the Third,
have you considered dumping the table into a text file?
SELECT *
FROM mytable
INTO OUTFILE c:/...
this (AFAI) does not cause memory issues
Ignatius
_
- Original Message -
From: Leo G. Divinagracia III [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 11:39 AM
Subject: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local
file...

project i'm working with, his host died or something.
but, the phpMyadmin (on that host) can NOT do a backup of 200mb table
without running out of memory or something weird.
so what is the best way to text dump the table?
i thought i would (pseudo-code):
open DB
do while not EOF
grab 1000 rows from DB
write to a file on host www path
filename = filename000 + 1
until EOF
user would then FTP down the files to his machine.
but i figured i could use the HEADER to send it to the user.
i grabbed this from the HEADER help section:
?php
$output_file = 'something.txt';
$content_len = 666;
@ob_end_clean();
@ini_set('zlib.output_compression', 'Off');
header('Pragma: public');
header('Content-Transfer-Encoding: none');
header('Content-Type: application/octetstream; name=' . $output_file .
'');
header('Content-Disposition: inline; filename=' . $output_file . '');
header(Content-length: $content_len);
?
is that the best way to send the txt file to the user?
thanks...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
Leo G. Divinagracia III
[EMAIL PROTECTED]
z
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] PHP/MySQL learning project

2004-06-10 Thread news.php.net
Hi everyone!

In trying to learn PHP and MySQL, I'm trying to create a web-based database
application that will keep track of my movies.  I have five tables (shown in
the graphic).  I'm trying to be able to display the results of the tables
with one movie title, all of the actors associated with it, and all of the
genre's associated with it.

Of course I can do the query:
  Select *
  From MovieMain, MovieActor, MovieGenre, Genre, Actors
  Where MovieMain.MovieID=MovieGenre.MovieID
  And MovieMain.MovieID=MovieActor.MovieID
  And MovieActor.ActorID=Actors.ActorID
  And MovieGenre.GenreID=Genre.GenreID

But that displays the movie title for every genre and actor there is.  Is
there another way to perform the query that will display the title once, and
all of the associated genres and all of the associated actors for that
movie?  Or should I try to code it using PHP to find the movie title first?

Thanks in advance, everyone!


begin 666 Drawing1.jpg
M_]C_X `02D9)[EMAIL PROTECTED] [EMAIL PROTECTED]@!@!0@'!P)[EMAIL PROTECTED] L+
M#!D2$P\4'1H?'AT:'!P@)XG((L(QP*#I+# Q-#0T'RY/[EMAIL PROTECTED]/XS-#+_
MVP!#`0D)[EMAIL PROTECTED]@R(1PA,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R
M,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C+_P `1 !8`KD#`2(``A$!`Q$!_\0`
M'P```04!`0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2=3NM2ENVSCAMH9Y8$3[FHY4G;M `./4_U
MH Z3P'+$:W;3WESI;WRI$US,[EMAIL PROTECTED]W.,L3^-=?7'^!?^/KQ)_V$$_]
M)H:[@[EMAIL PROTECTED]FPK--DVHQQR3*T99=KG5(.,@?E76UR7C[_CQ
MTC_L*1?^@/0!S?\`8=I_SUO_`/P83_\`Q=']AVG_`#UO_P#P83__`!=:5% 
M;_8=I_SUO_\`P83_`/Q=']AVG_/6_P#_``83_P#Q=:5%`;_`':?\];_P#\
M$__`,71_8=I_P`];_\`\$__P`77,P:_GQ2M[Y]R;6Z:P$6Q_*8 20-C9
MDR!AUSAQZ5MVNH:I?$W,'V%+1IY8$24-O[EMAIL PROTECTED]/RX'!ZT 6_PP[3_G

[PHP-DB] Re: PHP/MySQL learning project

2004-06-10 Thread Justin Patrin
News.Php.Net wrote:
Hi everyone!
In trying to learn PHP and MySQL, I'm trying to create a web-based database
application that will keep track of my movies.  I have five tables (shown in
the graphic).  I'm trying to be able to display the results of the tables
with one movie title, all of the actors associated with it, and all of the
genre's associated with it.
Of course I can do the query:
  Select *
  From MovieMain, MovieActor, MovieGenre, Genre, Actors
  Where MovieMain.MovieID=MovieGenre.MovieID
  And MovieMain.MovieID=MovieActor.MovieID
  And MovieActor.ActorID=Actors.ActorID
  And MovieGenre.GenreID=Genre.GenreID
But that displays the movie title for every genre and actor there is.  Is
there another way to perform the query that will display the title once, and
all of the associated genres and all of the associated actors for that
movie?  Or should I try to code it using PHP to find the movie title first?
Thanks in advance, everyone!

There's no way to do that in SQL alone. You should do it in PHP. :-)
--
paperCrane Justin Patrin
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Anyone using MSQL Server with PHP?

2004-06-10 Thread Miguel Guirao
Hi!!
 
Anybody here using PHP with SQL Server? I would like to use a similar
function to password () from MySQL under SQL Server.
 
Anybody knows of a similar function under SQL Server?
 
Kind Regards,
 
Miguel Guirao
Servicios Datacard
www.SIASA.com.mx
 


[PHP-DB] Re: Anyone using MSQL Server with PHP?

2004-06-10 Thread Justin Patrin
Miguel Guirao wrote:
Hi!!
 
Anybody here using PHP with SQL Server? I would like to use a similar
function to password () from MySQL under SQL Server.
 
Anybody knows of a similar function under SQL Server?
 
Kind Regards,
 
Miguel Guirao
Servicios Datacard
www.SIASA.com.mx
 

If it's for your app only, you could use md5() in PHP.
--
paperCrane Justin Patrin
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: PHP/MySQL learning project

2004-06-10 Thread news.php.net
Excellent!  That's exactly what I needed to know!  Thanks a million!


Justin Patrin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 News.Php.Net wrote:
  Hi everyone!
 
  In trying to learn PHP and MySQL, I'm trying to create a web-based
database
  application that will keep track of my movies.  I have five tables
(shown in
  the graphic).  I'm trying to be able to display the results of the
tables
  with one movie title, all of the actors associated with it, and all of
the
  genre's associated with it.
 
  Of course I can do the query:
Select *
From MovieMain, MovieActor, MovieGenre, Genre, Actors
Where MovieMain.MovieID=MovieGenre.MovieID
And MovieMain.MovieID=MovieActor.MovieID
And MovieActor.ActorID=Actors.ActorID
And MovieGenre.GenreID=Genre.GenreID
 
  But that displays the movie title for every genre and actor there is.
Is
  there another way to perform the query that will display the title once,
and
  all of the associated genres and all of the associated actors for that
  movie?  Or should I try to code it using PHP to find the movie title
first?
 
  Thanks in advance, everyone!
 
 
 

 There's no way to do that in SQL alone. You should do it in PHP. :-)

 -- 
 paperCrane Justin Patrin

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



RE: [PHP-DB] Re: Anyone using MSQL Server with PHP?

2004-06-10 Thread Miguel Guirao
Thanks!!

It Works out pretty nice!!

Miguel Guirao
Servicios Datacard
www.SIASA.com.mx

-Mensaje original-
De: Justin Patrin [mailto:[EMAIL PROTECTED] 
Enviado el: Jueves, 10 de Junio de 2004 05:51 p.m.
Para: [EMAIL PROTECTED]
Asunto: [PHP-DB] Re: Anyone using MSQL Server with PHP?

Miguel Guirao wrote:

 Hi!!
  
 Anybody here using PHP with SQL Server? I would like to use a similar
 function to password () from MySQL under SQL Server.
  
 Anybody knows of a similar function under SQL Server?
  
 Kind Regards,
  
 Miguel Guirao
 Servicios Datacard
 www.SIASA.com.mx
  
 

If it's for your app only, you could use md5() in PHP.

-- 
paperCrane Justin Patrin

-- 
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] Re: datetime update

2004-06-10 Thread Jonathan Haddad
[EMAIL PROTECTED] wrote:
Hi all,
i have a datetime field in a mysql database and it's defined with a default
of '-00-00 00:00:00:'
now, when i add a record to the database, i want to fill that field with the date and 
current time.
can anyone point me ?
   

Via PHP:
$dateTime = date('Y-m-d H:i:s');
mysql_query(INSERT INTO table SET dateTime = '$dateTime');
Via MySQL:
mysql_query(INSERT INTO table SET dateTime = NOW());
Take a look here for other useful MySQL date and time functions:
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html
Hope it helps. Regards,
Torsten Roehr
 

Yeah, if you are looking for something that automatically sets itself 
you can use the timestamp type instead.  with date or date time you must 
explicitly use now.  remember though, with timestamp, if you update the 
row the timestamp will automatically update to the current time. 

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


RE: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local file...

2004-06-10 Thread tech.evisionmgr.com
I agree to use mysqldump to export the data to a text file.  If you want to 
save time, you could write a php script to ftp the text file from the dead 
host to the new host.  Then load the data back into the new database.  

I guess if you have broadband connection, then you might not be saving too 
much time.

Ryan

Leo G. Divinagracia III wrote:

 project i'm working with, his host died or something.
 
 but, the phpMyadmin (on that host) can NOT do a backup of 200mb table 
 without running out of memory or something weird.
 
 so what is the best way to text dump the table?
 
 i thought i would (pseudo-code):
 
 
 open DB
 do while not EOF
 grab 1000 rows from DB
 write to a file on host www path
 filename = filename000 + 1
 until EOF
 
 user would then FTP down the files to his machine.
 
 
 but i figured i could use the HEADER to send it to the user.
 
 i grabbed this from the HEADER help section:
 
 
 ?php
 $output_file = 'something.txt';
 $content_len = 666;
 
 @ob_end_clean();
 @ini_set('zlib.output_compression', 'Off');
 header('Pragma: public');
 header('Content-Transfer-Encoding: none');
 header('Content-Type: application/octetstream; name=' . $output_file . 
 '');
 header('Content-Disposition: inline; filename=' . $output_file . '');
 header(Content-length: $content_len);
 
  ?
 
 is that the best way to send the txt file to the user?
 
 thanks...

Try using mysqldump from the command line. If you need a PHP script to 
do this, use system() or `` or one of the other system call functions.

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



Re: [PHP-DB] Re: Anyone using MSQL Server with PHP?

2004-06-10 Thread Hans Lellelid
Hi Miguel,
I would also strongly suggest that you use a salted hash if you are 
concerned with security -- especially if that md5 could ever be 
compromised or pass in clear text over an internet connection.  The 
md5() function in PHP produces unsalted hashes, which are fairly easy to 
crack.

Unlike md5(), the PHP crypt() function will generate salted hashes.  On 
my windows system it creates salted MD5 hashes (other operating systems 
may have other options like SHA1).  A salt is essentially an 
additional random element that gets added into the password hash.  This 
means that unlike md5() you will get a different hash each time you run 
crypt() on an identical string:

crypt(hello) = $1$bJoW4DmS$GDNwsRSjd5rwkfra6KOh10
crypt(hello) = $1$DnL7LQXm$eioj87M92X3IQvoTEquY21
crypt(hello) = $1$h488/RAa$e8tA4K1hEuBBRnagJbBnV1
instead of:
md5(hello) = 5d41402abc4b2a76b9719d911017c592
md5(hello) = 5d41402abc4b2a76b9719d911017c592
md5(hello) = 5d41402abc4b2a76b9719d911017c592
Why does this matter?  Well, because of something called the time-memory 
tradeoff (try a google search to see the math behind this).  The basic 
principle of the time-memory tradeoff is that you could either spend a 
long time trying to brute force each password hash or you could just 
spend time once creating really big (memory) tables that contain all the 
possibilities and then crack a hashed password in seconds.  Of course 
the more complex the passwords you want to crack the longer it takes to 
build these tables (could be days, weeks, months, etc.), but the idea is 
that once you've built these tables it only takes a few seconds to crack 
any supported password.  Time-memory tradeoff only works with unsalted 
passwords because these are 100% predicatble (hash of unsalted MD5 is 
always the same, as seen above).

To check an entered password against the original when using salted 
hashes, you need to do something a little different: you have to pass 
the original encrypted password as the salt to the crypt() function (the 
crypt() function extracts the salt from the passed password and uses 
that same salt to encrypt the entered password).

For example in PHP, check entered password against real password like this:
if (crypt($entered_pw, $real_pw) == $real_pw) {
  // login success
}
Hope that helps.  (Anyone, please correct any errors or misinformation 
above!)

Hans
Miguel Guirao wrote:
Thanks!!
It Works out pretty nice!!
Miguel Guirao
Servicios Datacard
www.SIASA.com.mx
-Mensaje original-
De: Justin Patrin [mailto:[EMAIL PROTECTED] 
Enviado el: Jueves, 10 de Junio de 2004 05:51 p.m.
Para: [EMAIL PROTECTED]
Asunto: [PHP-DB] Re: Anyone using MSQL Server with PHP?

Miguel Guirao wrote:

Hi!!
Anybody here using PHP with SQL Server? I would like to use a similar
function to password () from MySQL under SQL Server.
Anybody knows of a similar function under SQL Server?
Kind Regards,
Miguel Guirao
Servicios Datacard
www.SIASA.com.mx


If it's for your app only, you could use md5() in PHP.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php