[PHP-DB] Re: question in ADODB

2003-02-21 Thread Philippe Saladin
 yes, but can you tell me how? I have read the manual, but they didn't tell
 how to do so!


Look at testdatabases.inc.php in the adodb release.
Basically, you would have to write something like :

include(adodb.inc.php);
$conn = NewADOConnection('ado_access');
$conn-debug = TRUE; // useful for test
$access = '\path\to\mydatabase.mdb';
$myDSN =  PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=$access;USER
ID=;PASSWORD=;;
$conn-PConnect($myDSN, '', '', '');
$recordSet = $conn-Execute('select * from products');
if (!$recordSet) { echo  $conn-ErrorMsg();}

Regards,
Philippe



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




[PHP-DB] Getting results from MySQL

2003-02-21 Thread Anders Mellström
I have a PHP-MySQl-problem. I would be very greatful if anyone would help me.
I am - with the following code - trying to get results from a database. The problem 
isn't recieving the results, it's where i get the results. All the information is 
placed far down on the site, not in top.
If you're having problems understanding what I'm trying to say, I don't blame you. I 
don't really understand either. The easiest thing would be for you to check the code, 
then got to the site link below to see for yourselves.
Thanks
//Anders

link: http://medlem.spray.se/tippafotboll/full.php

code:
?php
if (!($dblink = mysql_connect(localhost, *, *))) 
//Databaskoppling mot server.
{
print(Kunde inte skapa koppling mot databasen.);
}
if (!(mysql_select_db(tippafotboll_se_db, $dblink))) 
{
print(Kunde inte vauml;lja databasen.);
}
else
{

//Array
$getarray = mysql_db_query(tippafotboll_se_db, SELECT * FROM 
tblTeams);
while($arrayrow = mysql_fetch_array($getarray))
{
$team[$arrayrow[id]] = $arrayrow[teamname];
}

print(htmlhead/headbody);
print(table width='50%' border='1'\n);
print(form name='newbet' method='post' action='insertbet.php'\n);
//SQL-query 
$row = mysql_db_query(tippafotboll_se_db, SELECT * FROM tblGames 
ORDER BY date);


while($games = mysql_fetch_object($row))
{
$hid = $games-home;
$aid = $games-away;
$gameid = $games-id;
print(trtdnbsp;$team[$hid] - $team[$aid]nbsp; 
/td\n);
print(tdinput type='radio' name='game$gameid' 
value='1'nbsp;/td\n);
print(tdinput type='radio' name='game$gameid' 
value='x'nbsp;/td\n);
print(tdinput type='radio' name='game$gameid' 
value='2'/tdbr/tr\n);
}
print(trtdinput type='submit' value='skicka in 
rad'/form/tr/table/body/html\n);
}
//Databaskopplingen stängs
mysql_close();
?


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




[PHP-DB] Re: php/mysql query

2003-02-21 Thread Fredrik de Vibe
[EMAIL PROTECTED] (Julie Keywell) writes:
 I am querying our database for 11,000 different zip codes and it seems
 to be overloading MySQL.  However, common sense says it shouldn't.
 
 My question is:
 When needing to query 11,000 things, is it best to make 1 SQL statement
 that has 11,000 ors, or run through individual querys 11,000 times?  Any
 help would be wonderful!  I am making PHP do the counting rather than
 MySQL.

I'm thinking join somehow, but I'm not sure I completely understand
the question. Post the query and table structure (you should change
the table names first, I guess, and only the necessary tables), and
maybe I for one can say more. :-)


-- 
--Fredrik
... and furthermore ... I don't like your trousers.

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




[PHP-DB] Re: NotesSQL via ODBC in PHP

2003-02-21 Thread MH
Steve,

I have used NotesSQL succesfully to MS Access and MS SQL, but not with PHP.
The NotesSQL gives you a very basic SQL function set and to my opinion its
not even worth trying it.  This was with Notes 4.5.2.  It could be better in
later versions, I don't know.

ODBC works fine, I have connect PHP to MS Access, MS SQL and and even XLS
files.

MH

Stefan Haas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Has anybody tried to read/write a Lotus Notes Database via ODBC
 (NotesSQL)? I don't even get a valid connection with odbc_connect. With
 other tools (QTODBC) NotesSQL/ODBC is no problem at all. Anything wrong
 with the php ODBC driver in php 4.2.3 under Win2k? Are ther more
 reliable ODBC drivers?

 Thanks
 Steve




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




[PHP-DB] Re: Getting results from MySQL

2003-02-21 Thread Fredrik de Vibe
[EMAIL PROTECTED] (Anders mellström) writes:
 I have a PHP-MySQl-problem. I would be very greatful if anyone
 would help me. I am - with the following code - trying to get
 results from a database. The problem isn't recieving the results,
 it's where i get the results. All the information is placed far down
 on the site, not in top. If you're having problems understanding
 what I'm trying to say, I don't blame you. I don't really understand
 either. The easiest thing would be for you to check the code, then
 got to the site link below to see for yourselves. Thanks //Anders
 
 link: http://medlem.spray.se/tippafotboll/full.php

As far as I can see this problem is html related. Your server, I
guess, spits out some script code after the /html tag. That _might_
cause some problems, try to strip the page of those and see if that
helps. I couldn't see anything else that would cause it.


-- 
--Fredrik
... and furthermore ... I don't like your trousers.

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




[PHP-DB] mysql to cvs file to excel

2003-02-21 Thread Snijders, Mark
hello,

does anybody know if it's possible (without php)

to export data from mysql to a cvs file, so i can import it in excel???

so is it possible, and if yes.. how?

thanks kinds regards,

Mark Snijders





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




[PHP-DB] Re: mysql to cvs file to excel

2003-02-21 Thread Fredrik de Vibe
[EMAIL PROTECTED] (Mark Snijders) writes:
 does anybody know if it's possible (without php) to export data from
 mysql to a cvs file, so i can import it in excel???

Not a cvs file, that's for sure, but I guess you mean csv. You can of
course script this with other languages than php, but you can use
mysqldump with the -T option to get a tab separated file, according to
the manual. Excel can to my knowledge import tab separated files.


-- 
--Fredrik
... and furthermore ... I don't like your trousers.

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




[PHP-DB] Re: question in ADODB

2003-02-21 Thread pei_world
thank you very much

--
Sincerely your;

pei_world ( .::IT::. )
Philippe Saladin [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  yes, but can you tell me how? I have read the manual, but they didn't
tell
  how to do so!
 

 Look at testdatabases.inc.php in the adodb release.
 Basically, you would have to write something like :

 include(adodb.inc.php);
 $conn = NewADOConnection('ado_access');
 $conn-debug = TRUE; // useful for test
 $access = '\path\to\mydatabase.mdb';
 $myDSN =  PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=$access;USER
 ID=;PASSWORD=;;
 $conn-PConnect($myDSN, '', '', '');
 $recordSet = $conn-Execute('select * from products');
 if (!$recordSet) { echo  $conn-ErrorMsg();}

 Regards,
 Philippe





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




[PHP-DB] file and https

2003-02-21 Thread Ryan Jameson (USA)
Has anyone found a way to import data through ssl into a php script? If I can pull xml 
formatted data through a secure socket it will save some major headaches with a 
problem I need to solve.

$url = file(https://www.mydomain.com;); Would be ideal, but it does not work

 Ryan

Ryan Jameson
Software Development Services Manager 
International Bible Society
W (719) 867-2692

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




Re: [PHP-DB] file and https

2003-02-21 Thread Jeffrey_N_Dyke

This works as of 4.3 with fopen(https://myserver.com).  but i dont' think
it works with file(https://myserver.com)...i may be wrong, of course.

HTH
Jeff




   
 
Ryan Jameson  
 
(USA)   To: [EMAIL PROTECTED]
 
RJameson@usa.   cc:   
 
ibs.org Subject: [PHP-DB] file and https  
 
   
 
02/21/2003 
 
09:52 AM   
 
   
 
   
 




Has anyone found a way to import data through ssl into a php script? If I
can pull xml formatted data through a secure socket it will save some major
headaches with a problem I need to solve.

$url = file(https://www.mydomain.com;); Would be ideal, but it does not
work

 Ryan

Ryan Jameson
Software Development Services Manager
International Bible Society
W (719) 867-2692

--
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] file and https

2003-02-21 Thread Paul Burney
on 2/21/03 9:52 AM, Ryan Jameson (USA) at [EMAIL PROTECTED] appended the
following bits to my mbox:

 Has anyone found a way to import data through ssl into a php script? If I can
 pull xml formatted data through a secure socket it will save some major
 headaches with a problem I need to solve.
 
 $url = file(https://www.mydomain.com;); Would be ideal, but it does not
 work


Not really related to databases so it should be on PHP-General.  That
said...


To work with HTTPS, you typically need to use the CURL library functions:

http://www.php.net/manual/en/ref.curl.php

I think in your case, specifically use:

http://www.php.net/manual/en/function.curl-exec.php

If I recall correctly, PHP 4.3 began bundling https support into its fopen
wrappers so if you upgrade, you can use https directly in fopen calls (not
sure if it works with file)

If you don't want to recompile with CURL support, nor want to upgrade to PHP
4.3.x, you may be able to call a command line utility directly.  For
example, I've used this in the past:


passthru('curl https://secure.example.com/some-file.html');


Hope that helps.

Sincerely,

Paul Burney
http://paulburney.com/

?php
while ($self != asleep) {
$sheep_count++;
}
?




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




[PHP-DB] Firebird driver

2003-02-21 Thread Philippe Makowski
Is there a plan to have a Firebird driver ?
Firebird is no longer the same as Interbase, it will have it's own libraries
when the 1.5 version will be release (there is an 1.5 beta version now)
Thanks

--
Philippe Makowski

Firebird serveur SQL open-source en français http://firebird-fr.eu.org

Ma clé PGP : http://makowski.eu.org/pgpkey.html


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




RE: [PHP-DB] mysql to cvs file to excel

2003-02-21 Thread Bruno Pereira
I had the some problem and someone told me this

What is your problem exactly?

Have you investigated the MySQL manual under:
LOAD DATA INFILE
SELECT ... INTO OUTFILE ?

And it realy helped.

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: Snijders, Mark [mailto:[EMAIL PROTECTED]]
Sent: sexta-feira, 21 de Fevereiro de 2003 9:59
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql to cvs file to excel


hello,

does anybody know if it's possible (without php)

to export data from mysql to a cvs file, so i can import it in excel???

so is it possible, and if yes.. how?

thanks kinds regards,

Mark Snijders





-- 
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] PHP4 on Windows using MSSQL

2003-02-21 Thread Kevin Gordon
Hi Coolio
Accessing the Windows NT server from Windows and Linux no longer causes
session errors (which were like: can not find session file, header
already sent and something about cookies).

Trying to access Linux Server (which previously worked 100%). now gives
errors (for example: Fatal error: Call to undefined function:
pg_connect() in E:\Inetpub\wwwroot\php\PgSQL_Driver.php on line 253).
Linux Server has now got the Windows path.

My attention is really trying to resolve: Warning: SQL error:
[Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL server not
found., SQL state 08001 in SQLConnect in
E:\Inetpub\wwwroot\php\ODBC_Driver.php on line 174
Error: failed to name the tables.

If someone is using MSSQL database and could comment on PHP.ini, perhaps
that is the area I need to work on.

Cheers for now,
Kevin Gordon
New Zealand

On Fri, 2003-02-21 at 16:23, l coolio wrote:
 Hi Kevin,
 
 Could you tell me what's wrong with the session, maybe I can help, I met 
 really headache problem with session cuz my server is windows, and all my 
 script working with session works fine in non-windows server, I work it out 
 finally, but still not figure out what really went wrong. 
 
 Coolio
 
 
 
 
 
 
 From: Kevin Gordon [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] PHP4 on Windows  using MSSQL
 Date: 20 Feb 2003 20:10:44 +1300
 
 I have written PHP which runs 100% on Linux  Postgresql. I have been
 successful installing PHP4 on windows as an ISAPI MODULE. My PHP code
 runs ok on Windows NT4 ok except:
 (a) Session functions produce errors
 
 (b) I am unable to connect to MSSQL (using ODBC). The System ODBC Driver
 tests ok.
 
 Any Suggestions please?
 
 Kevin Gordon
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 _
 享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com 
 
 
 



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




[PHP-DB] Re: NotesSQL via ODBC in PHP

2003-02-21 Thread Stefan Haas
Hi MH,

thanks for your comment, but it seems the NotesSQL-driver is basically 
fine, as I vcan access the Notes-DB from QTODBC, Access and others, but 
NOT from php. Do you anybody involved in the ODBC development?

Thanks
Steve

Mh schrieb:
Steve,

I have used NotesSQL succesfully to MS Access and MS SQL, but not with PHP.
The NotesSQL gives you a very basic SQL function set and to my opinion its
not even worth trying it.  This was with Notes 4.5.2.  It could be better in
later versions, I don't know.

ODBC works fine, I have connect PHP to MS Access, MS SQL and and even XLS
files.

MH

Stefan Haas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


Has anybody tried to read/write a Lotus Notes Database via ODBC
(NotesSQL)? I don't even get a valid connection with odbc_connect. With
other tools (QTODBC) NotesSQL/ODBC is no problem at all. Anything wrong
with the php ODBC driver in php 4.2.3 under Win2k? Are ther more
reliable ODBC drivers?

Thanks
Steve








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




RE: [PHP-DB] file and https

2003-02-21 Thread Ryan Jameson (USA)
Thanks all..

John - What do you mean have SSL installed? Does PHP have a SSL module? I'm already 
running 4.3.1 so I'm fine there. 

Also, this is quite database related as the intention is to access data on a remote 
server through a secure connection. XML is arguably a database protocol. :-)

 Ryan

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 21, 2003 8:05 AM
To: Ryan Jameson (USA); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] file and https


 Has anyone found a way to import data through
 ssl into a php script? If I can pull xml formatted
 data through a secure socket it will save some
 major headaches with a problem I need to solve.

 $url = file(https://www.mydomain.com;); Would
 be ideal, but it does not work

It does work in PHP 4.3 if you have SSL installed also (at least with
fopen). Other options would be to use cURL or make an exec call to Lynx (or
any browser) to retrieve the data.

---John Holmes...


-- 
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] testing the validity of a link

2003-02-21 Thread Matt
Does anyone know of a function, or a way for PHP to test to see if a given
link is valid (meaning that the linked page actually exists).  Please let me
know if you know of a way.  Thanks.

Matt



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




[PHP-DB] Re: testing the validity of a link

2003-02-21 Thread Peter Beckman
You could do an fopen on the URL and see if the results contain the string
404 not found or something.  Read these pages:

http://www.php.net/manual/en/function.fopen.php
http://www.php.net/manual/en/wrappers.php
http://www.php.net/manual/en/function.stream-get-meta-data.php

Looks like with 4.3+ you can use the internal functions of PHP to do what
you are asking.

You could alternatively install curl and get the resulting HTTP code.

http://www.php.net/manual/en/ref.curl.php

Peter



---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

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




[PHP-DB] How to find the autoincremented number?

2003-02-21 Thread David Chamberlin
Hey,

Most of the tables I use identify things using an id which is 
auto-generated using autoincrement.  However I can't seem to figure out 
a good way to find what value was generated for the ID.

For example, let's say I generate a new entry and want to e-mail out a 
link to it and the link identifies the entry by ID.  Currently, the only 
way I can figure to do this is to first do the INSERT and then do a 
SELECT on some unique information that I just inserted (e.g., 
submitter's ID and last-modified date).  So for example, I would have:

function addNewEntry( $stuffToPutIn ){
  $sql = INSERT INTO myTable $stuffToPutIn;
  // I use pearDB with mysql
  $result = $this-db-query( $sql );
  checkDbResult( $result );
  $sql = SELECT id FROM myTable WHERE .
  (last_modified_by = $userId) AND .
  (last_modified_time = $currentTime);
  $result = $this-db-getAll( $sql );
  checkDbResult( $result );
  $entry = $result[0];

  $linkAddress = $baseEntryURL.'?entryId='.$entry-id;

  mailOutLink( $linkAddress );
}
What I'd really like to do is get rid of that SELECT or at least make it 
less hacky to find out what the id was that got autogenerated.

Any ideas?

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


Re: [PHP-DB] How to find the autoincremented number?

2003-02-21 Thread Leif K-Brooks
http://www.php.net/manual/en/function.mysql-insert-id.php

David Chamberlin wrote:

Hey,

Most of the tables I use identify things using an id which is 
auto-generated using autoincrement.  However I can't seem to figure 
out a good way to find what value was generated for the ID.

For example, let's say I generate a new entry and want to e-mail out a 
link to it and the link identifies the entry by ID.  Currently, the 
only way I can figure to do this is to first do the INSERT and then do 
a SELECT on some unique information that I just inserted (e.g., 
submitter's ID and last-modified date).  So for example, I would have:

function addNewEntry( $stuffToPutIn ){
  $sql = INSERT INTO myTable $stuffToPutIn;
  // I use pearDB with mysql
  $result = $this-db-query( $sql );
  checkDbResult( $result );
  $sql = SELECT id FROM myTable WHERE .
  (last_modified_by = $userId) AND .
  (last_modified_time = $currentTime);
  $result = $this-db-getAll( $sql );
  checkDbResult( $result );
  $entry = $result[0];

  $linkAddress = $baseEntryURL.'?entryId='.$entry-id;

  mailOutLink( $linkAddress );
}
What I'd really like to do is get rid of that SELECT or at least make 
it less hacky to find out what the id was that got autogenerated.

Any ideas?

Thanks,
Dave

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP-DB] How to find the autoincremented number?

2003-02-21 Thread David Chamberlin
Aha.  I had seen that before, but disregarded it because I was trying to 
just use pearDB calls instead of the mysql calls.  However what I 
noticed this time when looking through there is that there's a 
LAST_INSERT_ID() that I could use in a query.

e.g.,

function addNewEntry( $stuffToPutIn ){
  $sql = INSERT INTO myTable $stuffToPutIn;
  // I use pearDB with mysql
  $result = $this-db-query( $sql );
  checkDbResult( $result );
  $sql = SELECT LAST_INSERT_ID();
  $id = $this-db-getOne( $sql );
  checkDbResult( $id );
  $linkAddress = $baseEntryURL.'?entryId='.$id;

  mailOutLink( $linkAddress );
}
Thank you!

-Dave

Leif K-Brooks wrote:
http://www.php.net/manual/en/function.mysql-insert-id.php

David Chamberlin wrote:

Hey,

Most of the tables I use identify things using an id which is 
auto-generated using autoincrement.  However I can't seem to figure 
out a good way to find what value was generated for the ID.

For example, let's say I generate a new entry and want to e-mail out a 
link to it and the link identifies the entry by ID.  Currently, the 
only way I can figure to do this is to first do the INSERT and then do 
a SELECT on some unique information that I just inserted (e.g., 
submitter's ID and last-modified date).  So for example, I would have:

function addNewEntry( $stuffToPutIn ){
  $sql = INSERT INTO myTable $stuffToPutIn;
  // I use pearDB with mysql
  $result = $this-db-query( $sql );
  checkDbResult( $result );
  $sql = SELECT id FROM myTable WHERE .
  (last_modified_by = $userId) AND .
  (last_modified_time = $currentTime);
  $result = $this-db-getAll( $sql );
  checkDbResult( $result );
  $entry = $result[0];

  $linkAddress = $baseEntryURL.'?entryId='.$entry-id;

  mailOutLink( $linkAddress );
}
What I'd really like to do is get rid of that SELECT or at least make 
it less hacky to find out what the id was that got autogenerated.

Any ideas?

Thanks,
Dave




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