[PHP-DB] php installer

2004-05-12 Thread
Hi:
I want to make a php install package on Win32 contain my php.ini 
and auto add .php file map to IIS5.0,but i don't know where the IIS 
file map is stored,i searched 'php' in registry and all ini file in
system dir,but no result returned.
who know the key?


 Best Regards
 beforefly
 [EMAIL PROTECTED]
 2004-05-12 15:40:54

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



Re: [PHP-DB] no temp var for mysql_fetch_array results

2004-05-12 Thread David T-G
Justin, et al --


...and then Justin Patrin said...
% 
% David T-G wrote:
% 
% ...and then Justin Patrin said...
% % 
...
% % Of course, this leaves the result handle open. It's best to store the 
% % result handle and free it with mysql_free_result().
% 
% Makes sense.  I actually hadn't thought of that; do I need to do that
% after a typical while(mysql_fetch_array()) or does the exhaustion caused
% by the while loop then close and free for me?
% 
% Nope, it's kept open so that you can use a seek to go back to the 
% beginning i fyou want to (at least, I'm pretty sure that's what it's 
% doing). You should always use mysql_free_result on your statement/result 
% handle.

Ah...  Very interesting.  One learns something every day :-)


% 
% Of course, you don't *really* need to do this if your script is small as 
% PHP will free everything when it's done, but it's good coding style and 
% can keep you from (possibly) running out of memory in larger scripts.

Right.  And surely someone who so fastidiously fclose()s every fopen()ed
file, even if it was opened read-only, would want to tie up any loose db
ends in the same way!

One last question...  If I make a query and run through the results and
then make another query, reusing the same result handle, should I have
freed the first result before assigning the second?  That is, does that
handle get closed automatically or orphaned for garbage collection at the
end of the script?


% 
% -- 
% paperCrane Justin Patrin


Thanks again  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP-DB] Edit with notepad

2004-05-12 Thread Ng Hwee Hwee
Hi all

thanx for the suggestions! yah, now i give my customers 2 buttons that will
direct them to 2 functionalities.

however, I still have a problem!! =(

i'm using 2 headers:
 header(Content-type: application/vnd-ms.word);
 header(Content-Disposition: attachment; filename=agent.doc);

why is it that the core of my .doc file is still in html?? i mean, i pulled
the file agent.doc into Notepad and I see html codes being generated. This
is very bad for me because my file has some graphics in it. If the core of
my file is html, the graphics will be a link instead of being embedded into
my documents. As a result, whoever tries to save that page will not be able
to see the graphics, unless they save the graphics into their computer with
the exact folder directory too! Please help me.

thank you!!

regards,
hwee

- Original Message - 
From: Neil Smith [MVP, Digital media] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 1:45 AM
Subject: Re: [PHP-DB] Edit with notepad


 Just offer them a link to the next page. Put amp;format=word in as the
 query string if they choose the 'view word document' link or no query
 string if they choose the plain text view as html page. Then go for

 if ($_GET[format]=='word') {
  header(Content-type: application/vnd-ms.word);
 }

 Really, offering your customers what they want is what we're all about -
 you have to take some responsibility for implementing snippets of code
like
 this ;-)

 Cheers - Neil

 At 10:39 11/05/2004 +, you wrote:
 Message-ID: [EMAIL PROTECTED]
 From: Ng Hwee Hwee [EMAIL PROTECTED]
 To: DBList [EMAIL PROTECTED]
 Date: Tue, 11 May 2004 09:25:08 +0800
 MIME-Version: 1.0
 Content-Type: text/plain;
  charset=iso-8859-1
 Content-Transfer-Encoding: 7bit
 Subject: Re: [PHP-DB] Edit with notepad
 
 hi,
 
 header(Content-type: application/vnd-ms.word); is not what my customers
 want. They may or may not want to save it in their harddisk.. but having
the
 header at the beginning of my page will force them to save it in their
 harddisk. Some of the customers just want to view it on the web while
others
 want to view it in Word and possibly edit it and then save it.. how can i
 achieve such flexibility for them?
 
 thank you!!
 
 regards,
 hwee

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



[PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell








Hello all,



I am fairly new to Linux/PHP so please bear with me. I have an awfully awkward problem to solve
 a stop gap solution for the next 6 months until we have out in-house
servers set up and running. I also
have a very short timeframe to sort this out. I am using PHP on a remotely hosted Linux
web server to build my website, however I have been given a MS Access database
to use! Despite my best efforts
(and two days Google trawling) I havent found a suitable solution so I
am turning to your collective knowledge



First things first  I do not run the server and
cannot install any new tools on to it (I cannot access the folders above my web
root). There are lots of
suggestions on the net about installing MDBTools and UnixODBC RPM (http://bryanmills.net:8086/archives/99.html)
 but that involves the admin who wont do it! I can, of
course, put scripts that may help in the actual web folder and reference them
if anyone has any ideas



I know I must use a DSN-less connection. I first tried connecting directly to the
mdb file using:

 $conn
= new COM(ADODB.Connection) or die (Cannot
create ADODB Connection object.); 

 

 //$connstr
= PROVIDER=MSDASQL;DBQ=/prices/mydb.mdb;.DRIVER={Microsoft Access Driver (*.mdb)}; 

 //$connstr
= Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=.
realpath(prices/mydb.mdb) . ;;

 //
Ive never got the above two connection strings to work but I include
them for completeness and in case any realises they might help me!

 $connstr
= DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=.
realpath(prices/mydb.mdb) . ;;



$conn-open($connstr);



This worked on my localhost running IIS 5 (unsurprisingly)
but fell over immediately on the Linux box. I am told this is because COM support in PHP
before version 4.3.x is buggy (he PHP version installed on the server is 4.1.2).
Is this true? Will upgrading to version 4.3.x solve
all my problems?



Also, I heard that converting the .mdb file to a .dbf file might
help  but how do I connect to that with PHP? The PHP manual says this about dbase
functions:

These functions allow you to access records stored in
dBase-format (dbf) databases. There is no support for indexes or memo fields.

Thats no good because I have long text fields in the
Access database that are of type memo!

The Manual also says we recommend that you do not use
dBase files as your production database  eek! Its only a small database (one
table with about 50 records, each with no more than 20 fields) so hopefully it
will suffice.



Am I right in thinking I have very few options? I dont want to move over to ASP
(would that even help?) because it means learning VBScript and I dont
have a lot of time. Also, I cant
use another database (e.g. MySQL) cos the server admin is NOT helping me and
wont install anything new.



I know 99% of you will want to tell me to just back out of
this horrible tangle and take a different route, but is there one person out
there who can help me get through this nightmare?



Thank you!



























Alex Gemmell

: Reply-to: [EMAIL PROTECTED]:



Or call me for free using Skype: 



































Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread jeffrey_n_Dyke



Hello all,


Am I right in thinking I have very few options?   I don't want to move
over to ASP (would that even help?) because it means learning VBScript and
I don't have a lot of time.  Also, I can't use another database (e.g.
MySQL) cos the server admin is NOT helping me and won't install anything
new.


ok.  I have not entirely thought this through, but if you're running a
linux machine and can install stuff in your web space, then potentially you
have another option.  But _only_ if PHP is already compiled with mysql
support.  Couldn't you grab a mysql binary from mysql.com(that matches your
client version compiled into PHP), and install it in your web space?  And
then use your linux user as the mysql user, and assign appropriate
permissions to the directory per the INSTALL-BINARY document in the
distrobution.  or, even better, if you know the name of your web user
(apache user)..you could also start it as that user, removing the security
hole of using yours (which i'm sure has elevated rights).


And i didn't think you could run COM on anything but a Widoze PHP build?
adn you're on Linux?


anyway... just an idea and maybe not a good one.  But looks like you're
stuck.  There are potential issues, but  well, again..just an idea.


HTHGood Luck!


Jeff








Alex Gemmell


¦:¦ Reply-to: [EMAIL PROTECTED] ¦:¦





Or call me for free using Skype:











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



RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell

|-Original Message-
|From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
|Sent: 12 May 2004 13:43
|To: Alex Gemmell
|Cc: PHP List
|Subject: Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|
|Hello all,
|
|Am I right in thinking I have very few options?   I don't want to move
|over to ASP (would that even help?) because it means learning VBScript and
|I don't have a lot of time.  Also, I can't use another database (e.g.
|MySQL) cos the server admin is NOT helping me and won't install anything
|new.
|
|ok.  I have not entirely thought this through, but if you're running a
|linux machine and can install stuff in your web space, then potentially you
|have another option.  But _only_ if PHP is already compiled with mysql
|support.  Couldn't you grab a mysql binary from mysql.com(that matches your
|client version compiled into PHP), and install it in your web space?  And
|then use your linux user as the mysql user, and assign appropriate
|permissions to the directory per the INSTALL-BINARY document in the
|distrobution.  or, even better, if you know the name of your web user
|(apache user)..you could also start it as that user, removing the security
|hole of using yours (which i'm sure has elevated rights).
|
|And I didn't think you could run COM on anything but a Widoze PHP build?
|adn you're on Linux?
|
|anyway... just an idea and maybe not a good one.  But looks like you're
|stuck.  There are potential issues, but  well, again..just an idea.
|
|HTHGood Luck!
|
|Jeff

Thank you Jeff!  I will try to install the MySQL binary.  Bit scary for me
(I'm a Microsoft-baby, we only PLAY at being good at this stuff ;) )...

Let me simplify my question so perhaps more people can offer an answer:

Does anyone know if it is possible to set up a DSN-less ODBC connection to a
Microsoft Access or dbase database file from a PHP page running on
Linux/Apache?

If it is possible can anyone provide an example (or a URL to one)?  The
connection string is of particular interest to me!  What Driver do I use
for connecting to a dbase database (exported from the MS Access database!).

Thanks again.

Alex

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



Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Robert Twitty
On Wed, 12 May 2004, Alex Gemmell wrote:

 Hello all,

 I am fairly new to Linux/PHP so please bear with me.  I have an awfully
 awkward problem to solve - a stop gap solution for the next 6 months until
 we have out in-house servers set up and running.  I also have a very short
 timeframe to sort this out.  I am using PHP on a remotely hosted Linux web
 server to build my website, however I have been given a MS Access database
 to use!  Despite my best efforts (and two days Google trawling) I haven't
 found a suitable solution so I am turning to your collective knowledge.

 First things first - I do not run the server and cannot install any new
 tools on to it (I cannot access the folders above my web root).  There are
 lots of suggestions on the net about installing MDBTools and UnixODBC RPM
 (http://bryanmills.net:8086/archives/99.html) - but that involves the
 admin who won't do it!  I can, of course, put scripts that may help in the
 actual web folder and reference them if anyone has any ideas.

 I know I must use a DSN-less connection.  I first tried connecting directly
 to the mdb file using:
 $conn = new COM(ADODB.Connection) or die (Cannot create ADODB
 Connection object.);

You cannot do this on Linux because I don't believe it supports COM nor
OLEDB. If your ISP allows you to use dynamically loadable PHP extensions,
then you might be able to use ODBTP.  But, this solution requires the use
of a Windows machine that can be accessed by the Linux box via port 2799,
which may not be possible for you.  Thus, your only option would be
MDBTools and unixODBC.

If your provider won't let you install MDBTools or ODBTP, then your only
solution is to get a new provider.

-- bob

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



[PHP-DB] question on select

2004-05-12 Thread hengameh
 

Hello,

I am very new to php and mysql so please be patient with me. I don't even
know if I am using the right listing, but I hope someone can help me!

 

I need to create a select and the possible options are from my mysql
database ( so far so good, I was able to find code to do that).

Now I need to use the user selected option to drive the options of me next
select.  I need to know how to capture what user selected and how to pass
that around? I have used onchange attribute of the select to capture the
selected line but now how can I pass that to other php scripts?  ( I need to
get the name of the country so that I can show a list of possible
state/province. I setting the value of the newcountry input to the
selected country but when I do echo $newcountry in quicksearch.php, its
blank!!) 

Please help!!

 

Thanks so much

 

Here is what I have so far:

 

Quicksearch.php file has the following code

br

table class='form'

  tr

thSteps 1-4/th

  /tr

 

  trtd

form name=fcountry method=post

  ?php  require(country_build.php);?

  input type=text name=newcountry value=

  

  /form

 

/td/tr

/table

!-- quicksearch.php   end --

 

script language=JavaScript

!--

function changeMenu()

  {

  document.fcountry.newcountry.value =
document.fcountry.country.options[document.fcountry.country.selectedIndex].v
alue;

 } 

-- 

/script

 

Countrty_buil.php has the following

 

?php

require_once(util.php);

 

echo SELECT name=\country\ class=\input\  onchange=\changeMenu()\;

//

// initialize or capture the country variable

$country = !isset($_REQUEST['country'])? Select a country:
$_REQUEST['country'];

$countrySQL = !isset($_REQUEST['country'])? *: $_REQUEST['country'];

echo option value='$countrySQL' SELECTED$country/option;

$query = SELECT country FROM . TABLECOUNTRY .  ORDER BY country ASC;

// pconnect, select and query

if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME, DBPASSWORD))
{

  if ( mysql_select_db(DBNAME, $link_identifier)) {

// run the query

 $queryResultHandle = mysql_query($query, $link_identifier) or die(
mysql_error() );

 $ctrRows = mysql_num_rows($queryResultHandle); // row counter

// if data exists then $rows will be 1 or greater

if( $ctrRows == 0 ) {

  echooption value='*'No data found/option/select;

}else{

  // build the select list

  while($row = mysql_fetch_object($queryResultHandle)) { //
grab a row

echo option
value=\$row-country\$row-country/option;

  }

  echo /SELECTbrbr;



}

  }else{ // select

echo mysql_error();

  }

}else{ //pconnect

  echo mysql_error();

}

?

 

 

 

 



RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Gryffyn, Trevor
First, I don't think you are likely to use COM calls on a linux box
since COM and DCOM are MS things aren't they?   Even if not, it might
require some configuration on the server end which you can't do.
 
I use the ADOdb database library for PHP in all the things I do:
http://php.weblogs.com/adodb
 
I have a dbconnect.inc file that has all my connect strings in a
switch/case statement that dynamically changes the connect string.
 
I think you can connect DSNLess to an Access database this way.
 
I'll paste a stripped down version of the dbconnect.inc to my message
since I don't know if this list accepts attachments.   Let me know if
you have any questions.. good luck!
 
-TG
 
?php
include(adodb/adodb.inc.php);
 
ADOLoadCode(ado_mssql);
$db = ADONewConnection(ado_mssql);
 
switch ($database) {
  
  # Cargo System databases
  
 
  case PhotoGallery:
# Where the photos are stored
$myDSN=PROVIDER=MSDASQL;DRIVER={SQL
Server};SERVER=PhotoServe;DATABASE=Photos;UID=username;PWD=password;;
break;
  case UserLogin:
# Where the user login information is
$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft ODBC for
ORACLE};SERVER=TMPROD;UID=ops;PWD=ops;;
break;
  case OtherDB:
# Sample connect string to Access MDB file
$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
(*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
break;
}
 
$db-Connect($myDSN);
#$db-debug=true;
 
if ($sqlquery  ) {
  $rs = $db-Execute($sqlquery);
  if ($rs === false) {
print h2Error: ( . $db-ErrorNo() . )  . $db-ErrorMsg() .
/h2br\n;
  } else {
$arr = $rs-GetArray();
print Status: ( . $db-ErrorNo() . )  . $db-ErrorMsg() .
br\n;
  }
} else {
  $rs = $db-Execute($sql);
  if ($rs === false) {
print h2Error: ( . $db-ErrorNo() . )  .
$db-ErrorMsg().br$sqlbr\n;
  }
}
 
$sqlquery = ;
$sql = ;
 
$db-Close();
?
-Original Message-
From: Alex Gemmell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 8:12 AM
To: PHP List
Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :(


Hello all,
 
I am fairly new to Linux/PHP so please bear with me.  I have an
awfully awkward problem to solve - a stop gap solution for the next 6
months until we have out in-house servers set up and running.  I also
have a very short timeframe to sort this out.  I am using PHP on a
remotely hosted Linux web server to build my website, however I have
been given a MS Access database to use!  Despite my best efforts (and
two days Google trawling) I haven't found a suitable solution so I am
turning to your collective knowledge...
 
First things first - I do not run the server and cannot install
any new tools on to it (I cannot access the folders above my web root).
There are lots of suggestions on the net about installing MDBTools and
UnixODBC RPM (http://bryanmills.net:8086/archives/99.html) - but
that involves the admin who won't do it!  I can, of course, put scripts
that may help in the actual web folder and reference them if anyone has
any ideas...
 
I know I must use a DSN-less connection.  I first tried
connecting directly to the mdb file using:
$conn = new COM(ADODB.Connection) or die (Cannot
create ADODB Connection object.); 

//$connstr =
PROVIDER=MSDASQL;DBQ=/prices/mydb.mdb;.DRIVER={Microsoft Access
Driver (*.mdb)}; 
//$connstr = Provider=Microsoft,.Jet.OLEDB.4.0;
Data Source=. realpath(prices/mydb.mdb) . ;;
// I've never got the above two connection strings
to work but I include them for completeness and in case any realises
they might help me!
$connstr = DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ=. realpath(prices/mydb.mdb) . ;;
 
$conn-open($connstr);
 
This worked on my localhost running IIS 5 (unsurprisingly) but
fell over immediately on the Linux box.  I am told this is because COM
support in PHP before version 4.3.x is buggy (he PHP version installed
on the server is 4.1.2).  Is this true?  Will upgrading to version 4.3.x
solve all my problems?
 
Also, I heard that converting the .mdb file to a .dbf file might
help - but how do I connect to that with PHP?  The PHP manual says this
about dbase functions:
These functions allow you to access records stored in
dBase-format (dbf) databases. There is no support for indexes or memo
fields.
That's no good because I have long text fields in the Access
database that are of type memo!
The Manual also says we recommend that you do not use dBase
files as your production database - eek!  It's only a small database
(one table with about 50 records, each with no more than 20 fields) so
hopefully it will suffice.
 
Am I right in 

RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell
Thank you Trevor!

Funny you should mention ADOdb.  I just d/l it and uploaded it to my web
site!  I am working through the docs now.  I was losing hope because I
couldn't find what I was looking for but if you don't mind I will help
myself to your connection string:
 
case OtherDB:
# Sample connect string to Access MDB file
$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
(*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
 
I have been using the realpath function of PHP in other connection strings
to map the path from the server root to the database location.  I assume
will work fine here:
 
  $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)}; Dbq=.
realpath(prices/mydb.mdb) .;UID=;PWD=;;
 
I'm still not sure this will work.  I'm getting a lot of information from
people saying a .mdb file (the MS Access database) just can't be accessed
this way and I should use an intermediate database format, like .dbf which
can be made by exporting the database out of MS Access into  dbase 5.
 
Does anyone know what the connection string for a .dbf (dbase 5) format
database is?
 
Alex
|:| Reply-to:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] |:|
  _  

From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] 
Sent: 12 May 2004 15:09
To: PHP List
Cc: Alex Gemmell
Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 
First, I don't think you are likely to use COM calls on a linux box since
COM and DCOM are MS things aren't they?   Even if not, it might require some
configuration on the server end which you can't do.
 
I use the ADOdb database library for PHP in all the things I do:
http://php.weblogs.com/adodb
 
I have a dbconnect.inc file that has all my connect strings in a switch/case
statement that dynamically changes the connect string.
 
I think you can connect DSNLess to an Access database this way.
 
I'll paste a stripped down version of the dbconnect.inc to my message since
I don't know if this list accepts attachments.   Let me know if you have any
questions.. good luck!
 
-TG
 
?php
include(adodb/adodb.inc.php);
 
ADOLoadCode(ado_mssql);
$db = ADONewConnection(ado_mssql);
 
switch ($database) {
  
  # Cargo System databases
  
 
  case PhotoGallery:
# Where the photos are stored
$myDSN=PROVIDER=MSDASQL;DRIVER={SQL
Server};SERVER=PhotoServe;DATABASE=Photos;UID=username;PWD=password;;
break;
  case UserLogin:
# Where the user login information is
$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft ODBC for
ORACLE};SERVER=TMPROD;UID=ops;PWD=ops;;
break;
  case OtherDB:
# Sample connect string to Access MDB file
$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
(*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
break;
}
 
$db-Connect($myDSN);
#$db-debug=true;
 
if ($sqlquery  ) {
  $rs = $db-Execute($sqlquery);
  if ($rs === false) {
print h2Error: ( . $db-ErrorNo() . )  . $db-ErrorMsg() .
/h2br\n;
  } else {
$arr = $rs-GetArray();
print Status: ( . $db-ErrorNo() . )  . $db-ErrorMsg() . br\n;
  }
} else {
  $rs = $db-Execute($sql);
  if ($rs === false) {
print h2Error: ( . $db-ErrorNo() . )  .
$db-ErrorMsg().br$sqlbr\n;
  }
}
 
$sqlquery = ;
$sql = ;
 
$db-Close();
?
-Original Message-
From: Alex Gemmell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 8:12 AM
To: PHP List
Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :(
Hello all,
 
I am fairly new to Linux/PHP so please bear with me.  I have an awfully
awkward problem to solve - a stop gap solution for the next 6 months until
we have out in-house servers set up and running.  I also have a very short
timeframe to sort this out.  I am using PHP on a remotely hosted Linux web
server to build my website, however I have been given a MS Access database
to use!  Despite my best efforts (and two days Google trawling) I haven't
found a suitable solution so I am turning to your collective knowledge.
 
First things first - I do not run the server and cannot install any new
tools on to it (I cannot access the folders above my web root).  There are
lots of suggestions on the net about installing MDBTools and UnixODBC RPM
(http://bryanmills.net:8086/archives/99.html) - but that involves the
admin who won't do it!  I can, of course, put scripts that may help in the
actual web folder and reference them if anyone has any ideas.
 
I know I must use a DSN-less connection.  I first tried connecting directly
to the mdb file using:
   $conn = new COM(ADODB.Connection) or die (Cannot create ADODB
Connection object.); 
   
   //$connstr =
PROVIDER=MSDASQL;DBQ=/prices/mydb.mdb;.DRIVER={Microsoft Access Driver
(*.mdb)}; 
   //$connstr = Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=.
realpath(prices/mydb.mdb) . ;;
   // I've never got the above two connection strings to work but I
include them for completeness and in case any realises they might help 

RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell
Thanks Bob,

I was afraid of that!  Ah well.  I have one or two more glimmers of hope
left before I abandon this entirely and learn some ASP super-quickly!


Alex
|:| Reply-to: [EMAIL PROTECTED] |:|

|-Original Message-
|From: Robert Twitty [mailto:[EMAIL PROTECTED]
|Sent: 12 May 2004 14:54
|To: Alex Gemmell
|Cc: PHP List
|Subject: Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|On Wed, 12 May 2004, Alex Gemmell wrote:
|
| Hello all,
|
| I am fairly new to Linux/PHP so please bear with me.  I have an awfully
| awkward problem to solve - a stop gap solution for the next 6 months
|until
| we have out in-house servers set up and running.  I also have a very
|short
| timeframe to sort this out.  I am using PHP on a remotely hosted Linux
|web
| server to build my website, however I have been given a MS Access
|database
| to use!  Despite my best efforts (and two days Google trawling) I haven't
| found a suitable solution so I am turning to your collective knowledge.
|
| First things first - I do not run the server and cannot install any new
| tools on to it (I cannot access the folders above my web root).  There
|are
| lots of suggestions on the net about installing MDBTools and UnixODBC RPM
| (http://bryanmills.net:8086/archives/99.html) - but that involves the
| admin who won't do it!  I can, of course, put scripts that may help in
|the
| actual web folder and reference them if anyone has any ideas.
|
| I know I must use a DSN-less connection.  I first tried connecting
|directly
| to the mdb file using:
| $conn = new COM(ADODB.Connection) or die (Cannot create
|ADODB
| Connection object.);
|
|You cannot do this on Linux because I don't believe it supports COM nor
|OLEDB. If your ISP allows you to use dynamically loadable PHP extensions,
|then you might be able to use ODBTP.  But, this solution requires the use
|of a Windows machine that can be accessed by the Linux box via port 2799,
|which may not be possible for you.  Thus, your only option would be
|MDBTools and unixODBC.
|
|If your provider won't let you install MDBTools or ODBTP, then your only
|solution is to get a new provider.
|
|-- bob

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



RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell
Thanks Peter,

A very kind offer, but I'm tied to my hosts and to using MS Access.  I have
been using PHP throughout the website but could possibly use ASP for this
very small part of the site (i.e. display a record of 20 fields depending on
who logins in).  I need to learn ASP however and I don't have much time so I
was hoping to avoid it.


Alex
|:| Reply-to: [EMAIL PROTECTED] |:|
 
|-Original Message-
|From: Peter Lovatt [mailto:[EMAIL PROTECTED]
|Sent: 12 May 2004 15:03
|To: Alex Gemmell
|Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|Hi
|
|Are you tied to the database(could you just export it to MySql?)
|Are you tied to the hosting provider?
|Are you tied to php?
|
|We might be able to add the tools to a Linux server or sort you out with a
|php enabled windows server if you don't mind covering some admin time.
|
|
|Peter
|
|
|---
|Excellence in internet and open source software
|---
|Sunmaia
|Birmingham
|UK
|www.sunmaia.net
|tel : 0121-242-1473
|fax : 0870 7621758
|International +44-121-242-1473
|---
|
|
|
|
|
| -Original Message-
| From: Robert Twitty [mailto:[EMAIL PROTECTED]
| Sent: 12 May 2004 14:54
| To: Alex Gemmell
| Cc: PHP List
| Subject: Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|
| On Wed, 12 May 2004, Alex Gemmell wrote:
|
|  Hello all,
| 
|  I am fairly new to Linux/PHP so please bear with me.  I have an awfully
|  awkward problem to solve - a stop gap solution for the next 6
| months until
|  we have out in-house servers set up and running.  I also have a
| very short
|  timeframe to sort this out.  I am using PHP on a remotely
| hosted Linux web
|  server to build my website, however I have been given a MS
| Access database
|  to use!  Despite my best efforts (and two days Google trawling)
| I haven't
|  found a suitable solution so I am turning to your collective knowledge.
| 
|  First things first - I do not run the server and cannot install any new
|  tools on to it (I cannot access the folders above my web root).
|  There are
|  lots of suggestions on the net about installing MDBTools and
| UnixODBC RPM
|  (http://bryanmills.net:8086/archives/99.html) - but that
| involves the
|  admin who won't do it!  I can, of course, put scripts that may
| help in the
|  actual web folder and reference them if anyone has any ideas.
| 
|  I know I must use a DSN-less connection.  I first tried
| connecting directly
|  to the mdb file using:
|  $conn = new COM(ADODB.Connection) or die (Cannot
| create ADODB
|  Connection object.);
|
| You cannot do this on Linux because I don't believe it supports COM nor
| OLEDB. If your ISP allows you to use dynamically loadable PHP extensions,
| then you might be able to use ODBTP.  But, this solution requires the use
| of a Windows machine that can be accessed by the Linux box via port 2799,
| which may not be possible for you.  Thus, your only option would be
| MDBTools and unixODBC.
|
| If your provider won't let you install MDBTools or ODBTP, then your only
| solution is to get a new provider.
|
| -- bob
|
| --
| 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] question on select

2004-05-12 Thread Tony S . Wu
sounds like a job for JavaScript.

Tony S. Wu
[EMAIL PROTECTED]
Look into the right places, you can find some good offerings.
http://homepage.mac.com/tonyswu/stw- The perfect business.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
 
---



On May 12, 2004, at 7:02 AM, hengameh wrote:



Hello,

I am very new to php and mysql so please be patient with me. I don't  
even
know if I am using the right listing, but I hope someone can help me!



I need to create a select and the possible options are from my mysql
database ( so far so good, I was able to find code to do that).
Now I need to use the user selected option to drive the options of me  
next
select.  I need to know how to capture what user selected and how to  
pass
that around? I have used onchange attribute of the select to  
capture the
selected line but now how can I pass that to other php scripts?  ( I  
need to
get the name of the country so that I can show a list of possible
state/province. I setting the value of the newcountry input to the
selected country but when I do echo $newcountry in quicksearch.php,  
its
blank!!)

Please help!!



Thanks so much



Here is what I have so far:



Quicksearch.php file has the following code

br

table class='form'

  tr

thSteps 1-4/th

  /tr



  trtd

form name=fcountry method=post

  ?php  require(country_build.php);?

  input type=text name=newcountry value=



  /form



/td/tr

/table

!-- quicksearch.php   end --



script language=JavaScript

!--

function changeMenu()

  {

  document.fcountry.newcountry.value =
document.fcountry.country.options[document.fcountry.country.selectedInd 
ex].v
alue;

 }

--

/script



Countrty_buil.php has the following



?php

require_once(util.php);



echo SELECT name=\country\ class=\input\   
onchange=\changeMenu()\;

//

// initialize or capture the country variable

$country = !isset($_REQUEST['country'])? Select a country:
$_REQUEST['country'];
$countrySQL = !isset($_REQUEST['country'])? *: $_REQUEST['country'];

echo option value='$countrySQL' SELECTED$country/option;

$query = SELECT country FROM . TABLECOUNTRY .  ORDER BY country  
ASC;

// pconnect, select and query

if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME,  
DBPASSWORD))
{

  if ( mysql_select_db(DBNAME, $link_identifier)) {

// run the query

 $queryResultHandle = mysql_query($query, $link_identifier) or  
die(
mysql_error() );

 $ctrRows = mysql_num_rows($queryResultHandle); // row counter

// if data exists then $rows will be 1 or greater

if( $ctrRows == 0 ) {

  echooption value='*'No data  
found/option/select;

}else{

  // build the select list

  while($row = mysql_fetch_object($queryResultHandle))  
{ //
grab a row

echo option
value=\$row-country\$row-country/option;
  }

  echo /SELECTbrbr;



}

  }else{ // select

echo mysql_error();

  }

}else{ //pconnect

  echo mysql_error();

}

?











[PHP-DB] MySQL InnoDB vs MaxDB / SAP DB

2004-05-12 Thread Uzi Klein
Hello

We currently  run mysql 4.0.14 in MyISAM table format.
Server config :
Dual P-3 600
1GB of ECC SDRAM
6 SCSI drives 10,000 RPM using RAID 5 Array.

OS :
RedHat Linux 9.

We just realized we really need the adnvaned futures of InnoDB or MaxDB/SAP DB.
What would it takes (System preformance, code optimization etc.) to do such un upgrade,
and what would you sugest as the most stable / reliable database / table format to 
suit our needs?
(what we really lack right now is the use of foreign keys and replications).

Kind Regards

Uzi Klein
Web Development
BMBY Ltd



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



RE: [PHP-DB] question on select

2004-05-12 Thread hengameh
Well I am suing Java script to capture the selected item and make it the
value of my input box. But my problem is how to access this information from
this point on. Can someone please tell me how I can use the selected item in
my next SQL query?

-Original Message-
From: Tony S. Wu [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 11:07 AM
To: hengameh
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] question on select

sounds like a job for JavaScript.

Tony S. Wu
[EMAIL PROTECTED]

Look into the right places, you can find some good offerings.
http://homepage.mac.com/tonyswu/stw- The perfect business.
http://homepage.mac.com/tonyswu/tonyswu- My web page.
 
---



On May 12, 2004, at 7:02 AM, hengameh wrote:



 Hello,

 I am very new to php and mysql so please be patient with me. I don't  
 even
 know if I am using the right listing, but I hope someone can help me!



 I need to create a select and the possible options are from my mysql
 database ( so far so good, I was able to find code to do that).

 Now I need to use the user selected option to drive the options of me  
 next
 select.  I need to know how to capture what user selected and how to  
 pass
 that around? I have used onchange attribute of the select to  
 capture the
 selected line but now how can I pass that to other php scripts?  ( I  
 need to
 get the name of the country so that I can show a list of possible
 state/province. I setting the value of the newcountry input to the
 selected country but when I do echo $newcountry in quicksearch.php,  
 its
 blank!!)

 Please help!!



 Thanks so much



 Here is what I have so far:



 Quicksearch.php file has the following code

 br

 table class='form'

   tr

 thSteps 1-4/th

   /tr



   trtd

 form name=fcountry method=post

   ?php  require(country_build.php);?

   input type=text name=newcountry value=



   /form



 /td/tr

 /table

 !-- quicksearch.php   end --



 script language=JavaScript

 !--

 function changeMenu()

   {

   document.fcountry.newcountry.value =
 document.fcountry.country.options[document.fcountry.country.selectedInd 
 ex].v
 alue;

  }

 --

 /script



 Countrty_buil.php has the following



 ?php

 require_once(util.php);



 echo SELECT name=\country\ class=\input\   
 onchange=\changeMenu()\;

 //

 // initialize or capture the country variable

 $country = !isset($_REQUEST['country'])? Select a country:
 $_REQUEST['country'];

 $countrySQL = !isset($_REQUEST['country'])? *: $_REQUEST['country'];

 echo option value='$countrySQL' SELECTED$country/option;

 $query = SELECT country FROM . TABLECOUNTRY .  ORDER BY country  
 ASC;

 // pconnect, select and query

 if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME,  
 DBPASSWORD))
 {

   if ( mysql_select_db(DBNAME, $link_identifier)) {

 // run the query

  $queryResultHandle = mysql_query($query, $link_identifier) or  
 die(
 mysql_error() );

  $ctrRows = mysql_num_rows($queryResultHandle); // row counter

 // if data exists then $rows will be 1 or greater

 if( $ctrRows == 0 ) {

   echooption value='*'No data  
 found/option/select;

 }else{

   // build the select list

   while($row = mysql_fetch_object($queryResultHandle))  
 { //
 grab a row

 echo option
 value=\$row-country\$row-country/option;

   }

   echo /SELECTbrbr;



 }

   }else{ // select

 echo mysql_error();

   }

 }else{ //pconnect

   echo mysql_error();

 }

 ?










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



RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Gryffyn, Trevor
Yeah, go ahead and steal the connection strings, that's why I posted
them :)
 
Also check out:
http://www.connectionstrings.com/
http://www.afn.org/~afn45181/Ben/SPSS/Merant/merant/client/win32/program
%20files/SPSSOEM/ODBC42/help/wwhelp/wwhimpl/common/html/wwhelp.htm?conte
xt=ODBCfile=Rdbasfox6.html
 
The first one has sample connection strings for lots of databases and
the second seems to have info on dbase5 specifically.   If not,
searching the web should work.  The connection string should be the same
or very similar to what ASP and other such things use.
 
As for not being able to access MDB files from PHP..   I really think
there's got to be a way.  I could be wrong, but when I was reading
around it seems like PHP doesn't like to do DSNless connections which is
why I started using ADOdb because it let me do DSNless connection
strings and all.  Maybe it's just the fact that most people use ODBC
sources to connect and aren't used to dealing with DSNless connections
that they're telling you that it won't work without ODBC or some other
intermediary.  Worth trying ADOdb though I think.
 
realpath is a good idea and it's something I used when I used to do ASP
in order to do the DSNless connections.  You kind of have to anyway
because you need the actual path of the MDB file that you're using.
 
I actually had a hosting company try to charge me $35 apiece for
database setup fees something like 6 months after I set up some ASP
with MDB using DSNless connections.   I argued with them that they
didn't set anything up, I did.   They wanted $35 to set up an ODBC
source (and to cover part of the server load that database connections
were likely to cause I guess).  But since I circumvented that, they
couldn't legally justify themselves in charging me the money and ended
up refunding the auto-charge to my credit card.
 
Something to think about for anyone settnig up PHP or ASP stuff with a
DSNless connection on a web hosting site.
 
-TG
-Original Message-
From: Alex Gemmell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 10:27 AM
To: 'PHP List'
Cc: Gryffyn, Trevor
Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(


Thank you Trevor!

Funny you should mention ADOdb.  I just d/l it and uploaded it
to my web site!  I am working through the docs now.  I was losing hope
because I couldn't find what I was looking for but if you don't mind I
will help myself to your connection string:
 
case OtherDB:
# Sample connect string to Access MDB file
$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
(*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
 
I have been using the realpath function of PHP in other
connection strings to map the path from the server root to the database
location.  I assume will work fine here:
 
  $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
(*.mdb)}; Dbq=. realpath(prices/mydb.mdb) .;UID=;PWD=;;
 
I'm still not sure this will work.  I'm getting a lot of
information from people saying a .mdb file (the MS Access database) just
can't be accessed this way and I should use an intermediate database
format, like .dbf which can be made by exporting the database out of MS
Access into  dbase 5.
 
Does anyone know what the connection string for a .dbf (dbase 5)
format database is?
 
Alex
|:| Reply-to: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  |:|

  _  

From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] 
Sent: 12 May 2004 15:09
To: PHP List
Cc: Alex Gemmell
Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 
First, I don't think you are likely to use COM calls on a linux
box since COM and DCOM are MS things aren't they?   Even if not, it
might require some configuration on the server end which you can't do.
 
I use the ADOdb database library for PHP in all the things I do:
http://php.weblogs.com/adodb
 
I have a dbconnect.inc file that has all my connect strings in a
switch/case statement that dynamically changes the connect string.
 
I think you can connect DSNLess to an Access database this way.
 
I'll paste a stripped down version of the dbconnect.inc to my
message since I don't know if this list accepts attachments.   Let me
know if you have any questions.. good luck!
 
-TG
 
?php
include(adodb/adodb.inc.php);
 
ADOLoadCode(ado_mssql);
$db = ADONewConnection(ado_mssql);
 
switch ($database) {


  # Cargo System databases


 
  case PhotoGallery:
# Where the 

RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Robert Twitty
Hi Alex

ADODb will not work either.  ADODb is basically a PHP abstraction class
library that relies on lower level database extensions to connect to the
various databases.  The problem for you is that other than the odbc
extension combined with MDBTools, and the odbtp extension, there is no
other way to connect to an MS Access database from Linux under PHP.

BTW, you mention that your other alternaive is to learn ASP.  This implies
that you will be using IIS on another machine.  Can PHP be installed on
that machine?

-- bob

On Wed, 12 May 2004, Alex Gemmell wrote:

 Thank you Trevor!

 Funny you should mention ADOdb.  I just d/l it and uploaded it to my web
 site!  I am working through the docs now.  I was losing hope because I
 couldn't find what I was looking for but if you don't mind I will help
 myself to your connection string:

 case OtherDB:
 # Sample connect string to Access MDB file
 $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
 (*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;

 I have been using the realpath function of PHP in other connection strings
 to map the path from the server root to the database location.  I assume
 will work fine here:

   $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)}; Dbq=.
 realpath(prices/mydb.mdb) .;UID=;PWD=;;

 I'm still not sure this will work.  I'm getting a lot of information from
 people saying a .mdb file (the MS Access database) just can't be accessed
 this way and I should use an intermediate database format, like .dbf which
 can be made by exporting the database out of MS Access into  dbase 5.

 Does anyone know what the connection string for a .dbf (dbase 5) format
 database is?

 Alex
 |:| Reply-to:  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] |:|
   _

 From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
 Sent: 12 May 2004 15:09
 To: PHP List
 Cc: Alex Gemmell
 Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

 First, I don't think you are likely to use COM calls on a linux box since
 COM and DCOM are MS things aren't they?   Even if not, it might require some
 configuration on the server end which you can't do.

 I use the ADOdb database library for PHP in all the things I do:
 http://php.weblogs.com/adodb

 I have a dbconnect.inc file that has all my connect strings in a switch/case
 statement that dynamically changes the connect string.

 I think you can connect DSNLess to an Access database this way.

 I'll paste a stripped down version of the dbconnect.inc to my message since
 I don't know if this list accepts attachments.   Let me know if you have any
 questions.. good luck!

 -TG

 ?php
 include(adodb/adodb.inc.php);

 ADOLoadCode(ado_mssql);
 $db = ADONewConnection(ado_mssql);

 switch ($database) {
   
   # Cargo System databases
   

   case PhotoGallery:
 # Where the photos are stored
 $myDSN=PROVIDER=MSDASQL;DRIVER={SQL
 Server};SERVER=PhotoServe;DATABASE=Photos;UID=username;PWD=password;;
 break;
   case UserLogin:
 # Where the user login information is
 $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft ODBC for
 ORACLE};SERVER=TMPROD;UID=ops;PWD=ops;;
 break;
   case OtherDB:
 # Sample connect string to Access MDB file
 $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
 (*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
 break;
 }

 $db-Connect($myDSN);
 #$db-debug=true;

 if ($sqlquery  ) {
   $rs = $db-Execute($sqlquery);
   if ($rs === false) {
 print h2Error: ( . $db-ErrorNo() . )  . $db-ErrorMsg() .
 /h2br\n;
   } else {
 $arr = $rs-GetArray();
 print Status: ( . $db-ErrorNo() . )  . $db-ErrorMsg() . br\n;
   }
 } else {
   $rs = $db-Execute($sql);
   if ($rs === false) {
 print h2Error: ( . $db-ErrorNo() . )  .
 $db-ErrorMsg().br$sqlbr\n;
   }
 }

 $sqlquery = ;
 $sql = ;

 $db-Close();
 ?
 -Original Message-
 From: Alex Gemmell [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 12, 2004 8:12 AM
 To: PHP List
 Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 Hello all,

 I am fairly new to Linux/PHP so please bear with me.  I have an awfully
 awkward problem to solve - a stop gap solution for the next 6 months until
 we have out in-house servers set up and running.  I also have a very short
 timeframe to sort this out.  I am using PHP on a remotely hosted Linux web
 server to build my website, however I have been given a MS Access database
 to use!  Despite my best efforts (and two days Google trawling) I haven't
 found a suitable solution so I am turning to your collective knowledge.

 First things first - I do not run the server and cannot install any new
 tools on to it (I cannot access the folders above my web root).  There are
 lots of suggestions on the net about installing MDBTools and UnixODBC RPM
 (http://bryanmills.net:8086/archives/99.html) - but that involves the
 admin who won't do it!  I can, 

RE: [PHP-DB] question on select

2004-05-12 Thread Hutchins, Richard
You'd have to take the value of the first select box in your form and pass
it to another script. You can do that by setting the form's ACTION property
to either GET or POST. Personally, I prefer POST.

In the script to which you submit your form, you can access the value of the
select object thusly: $_POST[varname] and insert it into your query
however you want (using the appropriate input sanitization methods).

The important concept to understand here is that you cannot use PHP to drive
the contents of your second select object without a round-trip to the
server. Since PHP is a server-side technology, it HAS to work that way.

To make a client-side solution possible, you'd have to send ALL POSSIBLE
data to the page all at the same time then manipulate it with JavaScript.

You can make it LOOK like a dynamic solution by repeatedly resubmitting the
page to itself and using a combo platter of JS and PHP functions on the page
to handle data as it is progressively requested/sent, but you're still doing
a round-trip each time. It only looks like a client-side solution because
you submit to the same page all the time until certain conditions are
satisfied or your user clicks on a specific link or button.

If you're truly in search of a completely client-side solution using
JavaScript, I suggest checking the Javascript Boutique or Javascript Source
or any one of the hundreds of JS repositories you'll find in a google
search. There are many great examples of this problem such as selecting a
State in one select box then having the major cities in that State show up
in a second select object.

Hope this helped.

Rich



 -Original Message-
 From: hengameh [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 12, 2004 11:34 AM
 To: 'Tony S. Wu'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] question on select
 
 
 Well I am suing Java script to capture the selected item and 
 make it the
 value of my input box. But my problem is how to access this 
 information from
 this point on. Can someone please tell me how I can use the 
 selected item in
 my next SQL query?
 
 -Original Message-
 From: Tony S. Wu [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 12, 2004 11:07 AM
 To: hengameh
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] question on select
 
 sounds like a job for JavaScript.
 
 Tony S. Wu
 [EMAIL PROTECTED]
 
 Look into the right places, you can find some good offerings.
 http://homepage.mac.com/tonyswu/stw- The perfect business.
 http://homepage.mac.com/tonyswu/tonyswu- My web page.
 --
 -- 
 ---
 
 
 
 On May 12, 2004, at 7:02 AM, hengameh wrote:
 
 
 
  Hello,
 
  I am very new to php and mysql so please be patient with 
 me. I don't  
  even
  know if I am using the right listing, but I hope someone 
 can help me!
 
 
 
  I need to create a select and the possible options are 
 from my mysql
  database ( so far so good, I was able to find code to do that).
 
  Now I need to use the user selected option to drive the 
 options of me  
  next
  select.  I need to know how to capture what user selected 
 and how to  
  pass
  that around? I have used onchange attribute of the select to  
  capture the
  selected line but now how can I pass that to other php 
 scripts?  ( I  
  need to
  get the name of the country so that I can show a list of possible
  state/province. I setting the value of the newcountry input to the
  selected country but when I do echo $newcountry in 
 quicksearch.php,  
  its
  blank!!)
 
  Please help!!
 
 
 
  Thanks so much
 
 
 
  Here is what I have so far:
 
 
 
  Quicksearch.php file has the following code
 
  br
 
  table class='form'
 
tr
 
  thSteps 1-4/th
 
/tr
 
 
 
trtd
 
  form name=fcountry method=post
 
?php  require(country_build.php);?
 
input type=text name=newcountry value=
 
 
 
/form
 
 
 
  /td/tr
 
  /table
 
  !-- quicksearch.php   end --
 
 
 
  script language=JavaScript
 
  !--
 
  function changeMenu()
 
{
 
document.fcountry.newcountry.value =
  
 document.fcountry.country.options[document.fcountry.country.se
 lectedInd 
  ex].v
  alue;
 
   }
 
  --
 
  /script
 
 
 
  Countrty_buil.php has the following
 
 
 
  ?php
 
  require_once(util.php);
 
 
 
  echo SELECT name=\country\ class=\input\   
  onchange=\changeMenu()\;
 
  //
 
  // initialize or capture the country variable
 
  $country = !isset($_REQUEST['country'])? Select a country:
  $_REQUEST['country'];
 
  $countrySQL = !isset($_REQUEST['country'])? *: 
 $_REQUEST['country'];
 
  echo option value='$countrySQL' SELECTED$country/option;
 
  $query = SELECT country FROM . TABLECOUNTRY .  ORDER BY country  
  ASC;
 
  // pconnect, select and query
 
  if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME,  
  DBPASSWORD))
  {
 
if ( mysql_select_db(DBNAME, $link_identifier)) {
 
 

RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Gryffyn, Trevor
Good point Bob.  If you're running IIS and can get PHP installed then
you can use the ADOdb or probably various other methods for accessing
the MDB files. No need to learn ASP then!  That should speed up
development time a little at least.

So looks like the options are:

1. Get various database tools installed on the linux box that probably
aren't going to really help you out too much
2. Get PHP installed on the Windows box and use ADOdb or something
similar to connect to the MDB files
3. Learn enough ASP to pull the data.  You could always just create an
ASP file that all it does is pull the data from the MDB and use PHP for
all the rest of your processing.

-TG

 -Original Message-
 From: Robert Twitty [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 12, 2004 11:46 AM
 To: Alex Gemmell
 Cc: 'PHP List'; Gryffyn, Trevor
 Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 
 
 Hi Alex
 
 ADODb will not work either.  ADODb is basically a PHP 
 abstraction class library that relies on lower level database
extensions to 
 connect to the various databases.  The problem for you is that other
than the odbc
 extension combined with MDBTools, and the odbtp extension, there is no
 other way to connect to an MS Access database from Linux under PHP.
 
 BTW, you mention that your other alternaive is to learn ASP.  
 This implies that you will be using IIS on another machine.  Can PHP
be 
 installed on that machine?
 
 -- bob
 
 On Wed, 12 May 2004, Alex Gemmell wrote:
 
  Thank you Trevor!
 
  Funny you should mention ADOdb.  I just d/l it and uploaded 
 it to my web
  site!  I am working through the docs now.  I was losing 
 hope because I
  couldn't find what I was looking for but if you don't mind 
 I will help
  myself to your connection string:
 
  case OtherDB:
  # Sample connect string to Access MDB file
  $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
  (*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
 
  I have been using the realpath function of PHP in other 
 connection strings
  to map the path from the server root to the database 
 location.  I assume
  will work fine here:
 
$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver 
 (*.mdb)}; Dbq=.
  realpath(prices/mydb.mdb) .;UID=;PWD=;;
 
  I'm still not sure this will work.  I'm getting a lot of 
 information from
  people saying a .mdb file (the MS Access database) just 
 can't be accessed
  this way and I should use an intermediate database format, 
 like .dbf which
  can be made by exporting the database out of MS Access into 
  dbase 5.
 
  Does anyone know what the connection string for a .dbf 
 (dbase 5) format
  database is?
 
  Alex
  |:| Reply-to:  mailto:[EMAIL PROTECTED] 
 [EMAIL PROTECTED] |:|
_
 
  From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
  Sent: 12 May 2004 15:09
  To: PHP List
  Cc: Alex Gemmell
  Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 
  First, I don't think you are likely to use COM calls on a 
 linux box since
  COM and DCOM are MS things aren't they?   Even if not, it 
 might require some
  configuration on the server end which you can't do.
 
  I use the ADOdb database library for PHP in all the things I do:
  http://php.weblogs.com/adodb
 
  I have a dbconnect.inc file that has all my connect strings 
 in a switch/case
  statement that dynamically changes the connect string.
 
  I think you can connect DSNLess to an Access database this way.
 
  I'll paste a stripped down version of the dbconnect.inc to 
 my message since
  I don't know if this list accepts attachments.   Let me 
 know if you have any
  questions.. good luck!
 
  -TG
 
  ?php
  include(adodb/adodb.inc.php);
 
  ADOLoadCode(ado_mssql);
  $db = ADONewConnection(ado_mssql);
 
  switch ($database) {

# Cargo System databases

 
case PhotoGallery:
  # Where the photos are stored
  $myDSN=PROVIDER=MSDASQL;DRIVER={SQL
  
 Server};SERVER=PhotoServe;DATABASE=Photos;UID=username;PWD=password;;
  break;
case UserLogin:
  # Where the user login information is
  $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft ODBC for
  ORACLE};SERVER=TMPROD;UID=ops;PWD=ops;;
  break;
case OtherDB:
  # Sample connect string to Access MDB file
  $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
  (*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
  break;
  }
 
  $db-Connect($myDSN);
  #$db-debug=true;
 
  if ($sqlquery  ) {
$rs = $db-Execute($sqlquery);
if ($rs === false) {
  print h2Error: ( . $db-ErrorNo() . )  . $db-ErrorMsg() .
  /h2br\n;
} else {
  $arr = $rs-GetArray();
  print Status: ( . $db-ErrorNo() . )  . 
 $db-ErrorMsg() . br\n;
}
  } else {
$rs = $db-Execute($sql);
if ($rs === false) {
  print h2Error: ( . $db-ErrorNo() . )  .
  $db-ErrorMsg().br$sqlbr\n;
}
  }
 
  $sqlquery = ;
  $sql = ;
 
 

RE: [PHP-DB] question on select

2004-05-12 Thread hengameh
Thanks so much but I am so new to all this so need more explanation please.
I think at this point I don't mind the round trip to the server side till I
find a better way. But for now I think I have what you are suggesting but
then why my echo is not retuning anything :
form name=fcountry method=post action=$PHP_SELF
?php  require(country_build.php);?
input type=text name=newcountry value=
?php echo $_POST['newcountry'];?
/form
(country_build.php creates the select and its options)


-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 11:45 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] question on select

You'd have to take the value of the first select box in your form and pass
it to another script. You can do that by setting the form's ACTION property
to either GET or POST. Personally, I prefer POST.

In the script to which you submit your form, you can access the value of the
select object thusly: $_POST[varname] and insert it into your query
however you want (using the appropriate input sanitization methods).

The important concept to understand here is that you cannot use PHP to drive
the contents of your second select object without a round-trip to the
server. Since PHP is a server-side technology, it HAS to work that way.

To make a client-side solution possible, you'd have to send ALL POSSIBLE
data to the page all at the same time then manipulate it with JavaScript.

You can make it LOOK like a dynamic solution by repeatedly resubmitting the
page to itself and using a combo platter of JS and PHP functions on the page
to handle data as it is progressively requested/sent, but you're still doing
a round-trip each time. It only looks like a client-side solution because
you submit to the same page all the time until certain conditions are
satisfied or your user clicks on a specific link or button.

If you're truly in search of a completely client-side solution using
JavaScript, I suggest checking the Javascript Boutique or Javascript Source
or any one of the hundreds of JS repositories you'll find in a google
search. There are many great examples of this problem such as selecting a
State in one select box then having the major cities in that State show up
in a second select object.

Hope this helped.

Rich



 -Original Message-
 From: hengameh [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 12, 2004 11:34 AM
 To: 'Tony S. Wu'
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] question on select
 
 
 Well I am suing Java script to capture the selected item and 
 make it the
 value of my input box. But my problem is how to access this 
 information from
 this point on. Can someone please tell me how I can use the 
 selected item in
 my next SQL query?
 
 -Original Message-
 From: Tony S. Wu [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 12, 2004 11:07 AM
 To: hengameh
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] question on select
 
 sounds like a job for JavaScript.
 
 Tony S. Wu
 [EMAIL PROTECTED]
 
 Look into the right places, you can find some good offerings.
 http://homepage.mac.com/tonyswu/stw- The perfect business.
 http://homepage.mac.com/tonyswu/tonyswu- My web page.
 --
 -- 
 ---
 
 
 
 On May 12, 2004, at 7:02 AM, hengameh wrote:
 
 
 
  Hello,
 
  I am very new to php and mysql so please be patient with 
 me. I don't  
  even
  know if I am using the right listing, but I hope someone 
 can help me!
 
 
 
  I need to create a select and the possible options are 
 from my mysql
  database ( so far so good, I was able to find code to do that).
 
  Now I need to use the user selected option to drive the 
 options of me  
  next
  select.  I need to know how to capture what user selected 
 and how to  
  pass
  that around? I have used onchange attribute of the select to  
  capture the
  selected line but now how can I pass that to other php 
 scripts?  ( I  
  need to
  get the name of the country so that I can show a list of possible
  state/province. I setting the value of the newcountry input to the
  selected country but when I do echo $newcountry in 
 quicksearch.php,  
  its
  blank!!)
 
  Please help!!
 
 
 
  Thanks so much
 
 
 
  Here is what I have so far:
 
 
 
  Quicksearch.php file has the following code
 
  br
 
  table class='form'
 
tr
 
  thSteps 1-4/th
 
/tr
 
 
 
trtd
 
  form name=fcountry method=post
 
?php  require(country_build.php);?
 
input type=text name=newcountry value=
 
 
 
/form
 
 
 
  /td/tr
 
  /table
 
  !-- quicksearch.php   end --
 
 
 
  script language=JavaScript
 
  !--
 
  function changeMenu()
 
{
 
document.fcountry.newcountry.value =
  
 document.fcountry.country.options[document.fcountry.country.se
 lectedInd 
  ex].v

RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell
Thanks again Trevor and Bob!

The reason I was mentioning ASP is because Chilli Soft! ASP thingy (?) is
installed on the live (Linux/Apache) server.  IIS doesn't come in to play
(other than on my localhost I was (stupidly) testing on!).

I have just got off the phone having managed to get the server admin to
concede to allowing MySQL to be installed.  Hopefully he will actually do
this!

If so, this will solve ALL my problems!  Hurrah for Linux/Apache/PHP/MySQL!
Hurrah!


Alex
|:| Reply-to: [EMAIL PROTECTED] |:|
 
Or call me for free using Skype: 


|-Original Message-
|From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
|Sent: 12 May 2004 17:00
|To: PHP List
|Cc: Robert Twitty; Alex Gemmell
|Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|Good point Bob.  If you're running IIS and can get PHP installed then
|you can use the ADOdb or probably various other methods for accessing
|the MDB files. No need to learn ASP then!  That should speed up
|development time a little at least.
|
|So looks like the options are:
|
|1. Get various database tools installed on the linux box that probably
|aren't going to really help you out too much
|2. Get PHP installed on the Windows box and use ADOdb or something
|similar to connect to the MDB files
|3. Learn enough ASP to pull the data.  You could always just create an
|ASP file that all it does is pull the data from the MDB and use PHP for
|all the rest of your processing.
|
|-TG
|
| -Original Message-
| From: Robert Twitty [mailto:[EMAIL PROTECTED]
| Sent: Wednesday, May 12, 2004 11:46 AM
| To: Alex Gemmell
| Cc: 'PHP List'; Gryffyn, Trevor
| Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|
| Hi Alex
|
| ADODb will not work either.  ADODb is basically a PHP
| abstraction class library that relies on lower level database
|extensions to
| connect to the various databases.  The problem for you is that other
|than the odbc
| extension combined with MDBTools, and the odbtp extension, there is no
| other way to connect to an MS Access database from Linux under PHP.
|
| BTW, you mention that your other alternaive is to learn ASP.
| This implies that you will be using IIS on another machine.  Can PHP
|be
| installed on that machine?
|
| -- bob
|
| On Wed, 12 May 2004, Alex Gemmell wrote:
|
|  Thank you Trevor!
| 
|  Funny you should mention ADOdb.  I just d/l it and uploaded
| it to my web
|  site!  I am working through the docs now.  I was losing
| hope because I
|  couldn't find what I was looking for but if you don't mind
| I will help
|  myself to your connection string:
| 
|  case OtherDB:
|  # Sample connect string to Access MDB file
|  $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
|  (*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;;
| 
|  I have been using the realpath function of PHP in other
| connection strings
|  to map the path from the server root to the database
| location.  I assume
|  will work fine here:
| 
|$myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver
| (*.mdb)}; Dbq=.
|  realpath(prices/mydb.mdb) .;UID=;PWD=;;
| 
|  I'm still not sure this will work.  I'm getting a lot of
| information from
|  people saying a .mdb file (the MS Access database) just
| can't be accessed
|  this way and I should use an intermediate database format,
| like .dbf which
|  can be made by exporting the database out of MS Access into
|  dbase 5.
| 
|  Does anyone know what the connection string for a .dbf
| (dbase 5) format
|  database is?
| 
|  Alex
|  |:| Reply-to:  mailto:[EMAIL PROTECTED]
| [EMAIL PROTECTED] |:|
|_
| 
|  From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
|  Sent: 12 May 2004 15:09
|  To: PHP List
|  Cc: Alex Gemmell
|  Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
| 
|  First, I don't think you are likely to use COM calls on a
| linux box since
|  COM and DCOM are MS things aren't they?   Even if not, it
| might require some
|  configuration on the server end which you can't do.
| 
|  I use the ADOdb database library for PHP in all the things I do:
|  http://php.weblogs.com/adodb
| 
|  I have a dbconnect.inc file that has all my connect strings
| in a switch/case
|  statement that dynamically changes the connect string.
| 
|  I think you can connect DSNLess to an Access database this way.
| 
|  I'll paste a stripped down version of the dbconnect.inc to
| my message since
|  I don't know if this list accepts attachments.   Let me
| know if you have any
|  questions.. good luck!
| 
|  -TG
| 
|  ?php
|  include(adodb/adodb.inc.php);
| 
|  ADOLoadCode(ado_mssql);
|  $db = ADONewConnection(ado_mssql);
| 
|  switch ($database) {
|
|# Cargo System databases
|
| 
|case PhotoGallery:
|  # Where the photos are stored
|  $myDSN=PROVIDER=MSDASQL;DRIVER={SQL
| 
| Server};SERVER=PhotoServe;DATABASE=Photos;UID=username;PWD=password;;
|  

RE: [PHP-DB] question on select

2004-05-12 Thread dpgirago
 Thanks so much but I am so new to all this so need more explanation 
please.
 I think at this point I don't mind the round trip to the server side 
till I
 find a better way. But for now I think I have what you are suggesting 
but
 then why my echo is not retuning anything :
 form name=fcountry method=post action=$PHP_SELF
?php 
require(country_build.php);?
input type=text 
name=newcountry value=
?php echo 
$_POST['newcountry'];?
/form


Well, there is no value assgined to $_POST['newcountry'] in your example. 
How are you getting a value to that form field?

dave

RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell
Apologies if my situation isn't clear.  My brain is noodle-soup after all
this!

I am given an updated copy of the MS Access database periodically. That
needs uploading to the website and a few pages use it to populate themselves
with relevant data.

Basically - username/password check to login.  If successful then show them
most of the fields in their record.  Simple!

Simple, yeah, nothing to it...  ;)

Now my server admin are playing ball I have hope.  If I can convert the MS
Access db to MySQL without too many problems then I should be home and
dry...


Alex
|:| Reply-to: [EMAIL PROTECTED] |:|

|-Original Message-
|From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
|Sent: 12 May 2004 17:13
|To: PHP List
|Cc: Alex Gemmell
|Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|I think you'd have the same issue with Chilisoft ASP as you would with
|PHP because the issue isn't with the scripting language but with the
|OS's support for ODBC or DSNless connections to an Access database.I
|did a little reading on Chilisoft ASP a while ago and (1) it's not free
|from what I understand and (2) I heard it doesn't function exactly how
|ASP is supposed to so you could have some stability issues.   The MySQL
|thing along with MDBTools or something sounds like it could be the best
|way to go.
|
|Or if you keep your master data set in MySQL and just use Access to pull
|a copy from it when necessary for distribution (you said you distributed
|the data via MDB files right?  Or do people change the MDBs and that
|becomes the master?)
|
|At any rate, good luck!  And keep us updated!
|
|-TG
|
|
| -Original Message-
| From: Alex Gemmell [mailto:[EMAIL PROTECTED]
| Sent: Wednesday, May 12, 2004 12:09 PM
| To: Gryffyn, Trevor; 'PHP List'
| Cc: 'Robert Twitty'
| Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|
| Thanks again Trevor and Bob!
|
| The reason I was mentioning ASP is because Chilli Soft! ASP
| thingy (?) is
| installed on the live (Linux/Apache) server.  IIS doesn't
| come in to play
| (other than on my localhost I was (stupidly) testing on!).
|
| I have just got off the phone having managed to get the
| server admin to
| concede to allowing MySQL to be installed.  Hopefully he will
| actually do
| this!
|
| If so, this will solve ALL my problems!  Hurrah for
| Linux/Apache/PHP/MySQL!
| Hurrah!
|
|
| Alex
| |:| Reply-to: [EMAIL PROTECTED] |:|
|
| Or call me for free using Skype:

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



RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Gryffyn, Trevor
In that case, you could write a PHP script on your PC (Windows right?)
that reads the data from the MDB file then posts the data to the MySQL
database.  Sounds easy enough. Hah  (that phrase has bitten me on the
backside more times than I can remember.. Challenges are fun though heh)

-Tg

 -Original Message-
 From: Alex Gemmell [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 12, 2004 12:19 PM
 To: Gryffyn, Trevor; 'PHP List'
 Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 
 
 Apologies if my situation isn't clear.  My brain is 
 noodle-soup after all
 this!
 
 I am given an updated copy of the MS Access database 
 periodically. That
 needs uploading to the website and a few pages use it to 
 populate themselves
 with relevant data.
 
 Basically - username/password check to login.  If successful 
 then show them
 most of the fields in their record.  Simple!
 
 Simple, yeah, nothing to it...  ;)
 
 Now my server admin are playing ball I have hope.  If I can 
 convert the MS
 Access db to MySQL without too many problems then I should be home and
 dry...
 
 
 Alex
 |:| Reply-to: [EMAIL PROTECTED] |:|
 
 |-Original Message-
 |From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
 |Sent: 12 May 2004 17:13
 |To: PHP List
 |Cc: Alex Gemmell
 |Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 |
 |I think you'd have the same issue with Chilisoft ASP as you 
 would with
 |PHP because the issue isn't with the scripting language but with the
 |OS's support for ODBC or DSNless connections to an Access 
 database.I
 |did a little reading on Chilisoft ASP a while ago and (1) 
 it's not free
 |from what I understand and (2) I heard it doesn't function 
 exactly how
 |ASP is supposed to so you could have some stability issues.  
  The MySQL
 |thing along with MDBTools or something sounds like it could 
 be the best
 |way to go.
 |
 |Or if you keep your master data set in MySQL and just use 
 Access to pull
 |a copy from it when necessary for distribution (you said you 
 distributed
 |the data via MDB files right?  Or do people change the MDBs and that
 |becomes the master?)
 |
 |At any rate, good luck!  And keep us updated!
 |
 |-TG
 |
 |
 | -Original Message-
 | From: Alex Gemmell [mailto:[EMAIL PROTECTED]
 | Sent: Wednesday, May 12, 2004 12:09 PM
 | To: Gryffyn, Trevor; 'PHP List'
 | Cc: 'Robert Twitty'
 | Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
 |
 |
 | Thanks again Trevor and Bob!
 |
 | The reason I was mentioning ASP is because Chilli Soft! ASP
 | thingy (?) is
 | installed on the live (Linux/Apache) server.  IIS doesn't
 | come in to play
 | (other than on my localhost I was (stupidly) testing on!).
 |
 | I have just got off the phone having managed to get the
 | server admin to
 | concede to allowing MySQL to be installed.  Hopefully he will
 | actually do
 | this!
 |
 | If so, this will solve ALL my problems!  Hurrah for
 | Linux/Apache/PHP/MySQL!
 | Hurrah!
 |
 |
 | Alex
 | |:| Reply-to: [EMAIL PROTECTED] |:|
 |
 | Or call me for free using Skype:
 
 

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



Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread David T-G
Alex, et al --

Sorry I'm late, and I hope that your upcoming mysql install works out
well for you.

Since you have the ability to convert this DB to something else (I was
going to ask but got busy and then this whole thread happenned :-) could
you also just dump it to a CSV file?  That would be easy to read in with
PHP, and since you have so few records the performance impact should be
negligible.  That way you also don't have to learn how to do something
new (talk to a dbase5 file in mysql) while you are under such pressure
(but go back and learn mysql anyway :-)


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Alex Gemmell
Yep - I could do that...

Or I could use this: http://www.cynergi.net/exportsql/

I haven't tried exportsql yet, it probably will fall over or be a
nightmare to get going knowing my current run of luck!

Let's all put our hands together and pray that it works (and for world peace
or something).

Alex
|:| Reply-to: [EMAIL PROTECTED] |:|

|-Original Message-
|From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
|Sent: 12 May 2004 17:22
|To: PHP List
|Cc: Alex Gemmell
|Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|In that case, you could write a PHP script on your PC (Windows right?)
|that reads the data from the MDB file then posts the data to the MySQL
|database.  Sounds easy enough. Hah  (that phrase has bitten me on the
|backside more times than I can remember.. Challenges are fun though heh)
|
|-Tg
|
| -Original Message-
| From: Alex Gemmell [mailto:[EMAIL PROTECTED]
| Sent: Wednesday, May 12, 2004 12:19 PM
| To: Gryffyn, Trevor; 'PHP List'
| Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|
| Apologies if my situation isn't clear.  My brain is
| noodle-soup after all
| this!
|
| I am given an updated copy of the MS Access database
| periodically. That
| needs uploading to the website and a few pages use it to
| populate themselves
| with relevant data.
|
| Basically - username/password check to login.  If successful
| then show them
| most of the fields in their record.  Simple!
|
| Simple, yeah, nothing to it...  ;)
|
| Now my server admin are playing ball I have hope.  If I can
| convert the MS
| Access db to MySQL without too many problems then I should be home and
| dry...
|
|
| Alex
| |:| Reply-to: [EMAIL PROTECTED] |:|
|
| |-Original Message-
| |From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED]
| |Sent: 12 May 2004 17:13
| |To: PHP List
| |Cc: Alex Gemmell
| |Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
| |
| |I think you'd have the same issue with Chilisoft ASP as you
| would with
| |PHP because the issue isn't with the scripting language but with the
| |OS's support for ODBC or DSNless connections to an Access
| database.I
| |did a little reading on Chilisoft ASP a while ago and (1)
| it's not free
| |from what I understand and (2) I heard it doesn't function
| exactly how
| |ASP is supposed to so you could have some stability issues.
|  The MySQL
| |thing along with MDBTools or something sounds like it could
| be the best
| |way to go.
| |
| |Or if you keep your master data set in MySQL and just use
| Access to pull
| |a copy from it when necessary for distribution (you said you
| distributed
| |the data via MDB files right?  Or do people change the MDBs and that
| |becomes the master?)
| |
| |At any rate, good luck!  And keep us updated!
| |
| |-TG
| |
| |
| | -Original Message-
| | From: Alex Gemmell [mailto:[EMAIL PROTECTED]
| | Sent: Wednesday, May 12, 2004 12:09 PM
| | To: Gryffyn, Trevor; 'PHP List'
| | Cc: 'Robert Twitty'
| | Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
| |
| |
| | Thanks again Trevor and Bob!
| |
| | The reason I was mentioning ASP is because Chilli Soft! ASP
| | thingy (?) is
| | installed on the live (Linux/Apache) server.  IIS doesn't
| | come in to play
| | (other than on my localhost I was (stupidly) testing on!).
| |
| | I have just got off the phone having managed to get the
| | server admin to
| | concede to allowing MySQL to be installed.  Hopefully he will
| | actually do
| | this!
| |
| | If so, this will solve ALL my problems!  Hurrah for
| | Linux/Apache/PHP/MySQL!
| | Hurrah!
| |
| |
| | Alex
| | |:| Reply-to: [EMAIL PROTECTED] |:|
| |
| | Or call me for free using Skype:
|
|
|
|--
|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] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Bruno Ferreira
Alex Gemmell wrote:

Yep - I could do that...

Or I could use this: http://www.cynergi.net/exportsql/

I haven't tried exportsql yet, it probably will fall over or be a
nightmare to get going knowing my current run of luck!
Let's all put our hands together and pray that it works (and for world peace
or something).
Alex
|:| Reply-to: [EMAIL PROTECTED] |:|
 

   May I suggest you look at the Firebird DBMS as well? Doesn't require 
drivers and is self-contained.

   Check it out at http://firebird.sourceforge.net/

   The latest versions of PHP have a built-in extension for it, so it 
should be relatively smooth sailing, as long as you don't have much 
trouble converting the DB. For the task of converting the database, I 
suggest you write a script that you will run on your local machine, 
which reads all the records in the Access db and then inserts them in 
the Firebird db (SELECT from one side, INSERT into the other). Should be 
pretty painless to do this every once in a while.

   Bruno Ferreira
---
[This E-mail scanned for viruses by Declude Virus]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] question on select

2004-05-12 Thread hengameh
Sorry that. I was trying to be modular! I also understand that everyone is
busy and I highly appreciate any help.
Anyway I cleaned it up a bit I hope its clear now ( all I am trying to do is
to show a list of countries from my database and then according to the
selected country make another select for the state/province and then pass
all that for further search):


script language=JavaScript
!--
function changeMenu(pulldown,input)
  {
input.value = pulldown.options[pulldown.selectedIndex].value;
 } 
-- 
/script

?php require_once(util.php);?

br
table class='form'
trthSteps 1-4/th/tr
trtd
form name=fcountry method=post action=$PHP_SELF
?php  getcountry();?
input type=text name=newcountry value=
?php echo $_POST['newcountry'];?
  /form
  /td/tr
/table
!-- quicksearch.php   end --

?php
function getcountry()
{
$sretval = SELECT name=\country\ class=\input\
onchange=\changeMenu(document.fcountry.country,document.fcountry.newcountry
)\;
//
// initialize or capture the country variable
$country = !isset($_REQUEST['country'])? Select a country:
$_REQUEST['country'];
$countrySQL = !isset($_REQUEST['country'])? *: $_REQUEST['country'];
$sretval .= option value='$countrySQL' SELECTED$country/option;
$query = SELECT * FROM . TABLECOUNTRY .  ORDER BY country ASC;
// pconnect, select and query
if ($link_identifier = mysql_pconnect(DBSERVERHOST, DBUSERNAME, DBPASSWORD))
{
if ( mysql_select_db(DBNAME, $link_identifier)) {
// run the query
   $queryResultHandle = mysql_query($query, $link_identifier) or
die( mysql_error() );
   $ctrRows = mysql_num_rows($queryResultHandle); // row counter
// if data exists then $rows will be 1 or greater
if( $ctrRows == 0 ) {
$sretval .=option value='*'No data
found/option/select;
}else{
// build the select list
while($row = mysql_fetch_object($queryResultHandle))
{ // grab a row
$sretval .=option
value=\$row-country\$row-country/option;
}
$sretval .= /SELECTbrbr;
echo $sretval;  
}
}else{ // select
echo mysql_error();
}
}else{ //pconnect
echo mysql_error();
}
}
?


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 12:41 PM
To: hengameh; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] question on select

 Here is the complete code. In the one line Java script that I have I am
 setting the value. So what am I missing?

For the sake of the listers trying to help you, and for your own clarity 
of concept, I'd suggest starting out by putting all your code into one 
file. It's quite hard to follow as you've presented it. 

Also, it may make it easier if you try concatenating all your output to 
one $variable, then print/echoing it out.

Don't mean to be difficult, but we all have our own projects to work on. 

dave 

-- 
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] no temp var for mysql_fetch_array results

2004-05-12 Thread Justin Patrin
You'd have to ask someone with more internals knowledge for that one... 
I'm sure it does get GC'd, but I don't know if it happens in-script or 
at the end. Also, I would assume it is freed when GC'd, but who knows, I 
might be wrong. It's much safer to free it yourself.

paperCrane Justin Patrin

David T-G wrote:
Justin, et al --

...and then Justin Patrin said...
% 
% David T-G wrote:
% 
% ...and then Justin Patrin said...
% % 
...
% % Of course, this leaves the result handle open. It's best to store the 
% % result handle and free it with mysql_free_result().
% 
% Makes sense.  I actually hadn't thought of that; do I need to do that
% after a typical while(mysql_fetch_array()) or does the exhaustion caused
% by the while loop then close and free for me?
% 
% Nope, it's kept open so that you can use a seek to go back to the 
% beginning i fyou want to (at least, I'm pretty sure that's what it's 
% doing). You should always use mysql_free_result on your statement/result 
% handle.

Ah...  Very interesting.  One learns something every day :-)

% 
% Of course, you don't *really* need to do this if your script is small as 
% PHP will free everything when it's done, but it's good coding style and 
% can keep you from (possibly) running out of memory in larger scripts.

Right.  And surely someone who so fastidiously fclose()s every fopen()ed
file, even if it was opened read-only, would want to tie up any loose db
ends in the same way!
One last question...  If I make a query and run through the results and
then make another query, reusing the same result handle, should I have
freed the first result before assigning the second?  That is, does that
handle get closed automatically or orphaned for garbage collection at the
end of the script?
% 
% -- 
% paperCrane Justin Patrin

Thanks again  HAND

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


Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Jaap van Ganswijk
At 2004-05-12 14:11, Alex Gemmell wrote:
Also, I heard that converting the .mdb file to a .dbf file might help – but how do I 
connect to that with PHP?  The PHP manual says this about dbase functions:
“These functions allow you to access records stored in dBase-format (dbf) databases. 
There is no support for indexes or memo fields.”
That’s no good because I have long text fields in the Access database that are of 
type “memo”!
The Manual also says “we recommend that you do not use dBase files as your production 
database” – eek!  It’s only a small database (one table with about 50 records, each 
with no more than 20 fields) so hopefully it will suffice.

What it basically says is that you shouldn't use
.dbf formats to operate a database with, but only
to transfer (import) data.

I prefer however to use the comma separated value's
(.csv) format that most database programma's can export
and import:

Jaap,van Ganswijk,this is comment, which contains a comma

I prefer it because it's human and inter architecture
readable.

In PHP you can read it quite easily using the getscsv()
function, like:

if ($hf=fopen(..)) {
  while ($E=getscsv($hf)) {
$A[]=$E;
  }
}

For setting up a simple database, why not just read the whole
file each time? You could also look into the adb() funtions,
with gndb() as one of it's prominent members. That way you
will have indexes within your database and can read single
entries.

Another way is to use the serialize() and unserialize()
functions to store complex (PHP-style) datastructures
within a file or within the datafield of an adb() database.

Check out phpinfo() on your hoster's system to see what is
available.

Greetings,
Jaap

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



Re: [PHP-DB] no temp var for mysql_fetch_array results

2004-05-12 Thread David T-G
Jeff, et al --

...and then [EMAIL PROTECTED] said...
% 
[quoting me]
% 
% mysql_fetch_array() returns an array, and I know I want a field from just
% this one row (not looping), could I just
% 
%   $i = mysql_fetch_array($r)[0] ;
% 
% Hi David
%   How about:
%   $i = mysql_result(mysql_query($q,$dbro),0);

Well, I *thought* it was perfect.  Unfortunately, it ain't in practice.

Running

  $r = mysql_query(select ID from customer where EMail = '$email',$dbro) ;
  $row = mysql_fetch_array($r) ;
  $id = $row[0] ;

works, but

$id = mysql_result(mysql_query(select ID from customer where EMail = 
'$email',$dbro),0) ; 

or even

  $r = mysql_query(select ID from customer where EMail = '$email',$dbro) ;
  $id = mysql_result($r,0) ;

fails with

  Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 4...

Now this makes some sense; the manual says that

  mysql_result ( resource result , int row )

will jump to row $row in the output but says nothing about returning me a
given fields.

Any other thoughts?


% HTH
% Jeff


TIA again  HAND
:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP-DB] no temp var for mysql_fetch_array results

2004-05-12 Thread jeffrey_n_Dyke




  Warning: mysql_result(): Unable to jump to row 0 on MySQL result index
4...

 Now this makes some sense; the manual says that

   mysql_result ( resource result , int row )

 will jump to row $row in the output but says nothing about returning me a
 given fields.

 Any other thoughts?
Hey David...

Does this mean you are potentially brining back more then one row, and
mysql_result doesn't know where to get it from?  Does this change if you
add, LIMIT 1 to the query.

Most of the time when i have problems with mysql_result, it has to do with
more data coming back then i expected, or is a bad query, but you seem to
have the same one...

HTH
Jeff

TIA again  HAND
:-D
--
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

(See attached file: atteqfnd.dat)



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

Re: [PHP-DB] no temp var for mysql_fetch_array results

2004-05-12 Thread David T-G
Jeff, et al --

...and then [EMAIL PROTECTED] said...
% 
% Hey David...

Hi again!


% 
% Does this mean you are potentially brining back more then one row, and
% mysql_result doesn't know where to get it from?  Does this change if you
% add, LIMIT 1 to the query.

In this case, we're absolutely sure; the email addresses are unique, so
I'd only get back one.  And since mysql_result() is supposed to jump to a
certain row it shouldn't matter whether I get back one or more...



Still confused,
:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


[PHP-DB] mysql went away

2004-05-12 Thread Bill Green
HI. I've been using mySQL 4.0.13, php4.3.4, and phpMyAdmin2.5.5 on Mac 
OS 10.3.3 as a learning/testing/development environment for a couple of 
months now - no problems, works great.

I've created more than a few mySQL databases and tables, but yesterday 
I created a database, a table, and LOAD DATA from within phpMyAdmin. 
Successfully. I looked at the data and all was fine. Logged out and 
went away for a while. Came back and phpMyAdmin would not show me my 
databases in the left frame, and I could not launch a query window. I 
could see runtime information, system vars, processes, and even 
privileges.

I tried logging in to mySQL through the terminal, and I can run simple 
commands and connect OK, but any commands to show databases or tables 
will hang the terminal. Through the command line client I can run 
simple commands, but no commands to view or affect databases or tables.

I can run php scripts - connect to databases, retrieve and even 
insert/update data, but I cannot view databases or tables.

Does anyone have a clue about what the problems may be or where I 
should start?

---
Bill Green
20 Meadowview Drive
Asheville, NC 28804
--
[EMAIL PROTECTED]
http://www.billgreen.org
828.252.1492
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: diference between == and ===

2004-05-12 Thread Dave Grijalva
=== is a strict equals.

if you have a string $s = '12345' then

if(12345 == $s) is true
but
if(12345 === $s) is not true because 12345 is an int and '12345' is a string
-dave

Bruno Braga wrote:
Hi guys..

 

Wich is the diference between if ($var == '1')  or if ($var === '1')

 

== means equality and what does the === means ?!

 

 

Thanks!

 

Bruno

 


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


RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(

2004-05-12 Thread Kosala Atapattu
Hi Alex,

Assuming that I understood your situation I'll make this suggestion. I'm not sure 
whether this option is supported in you PHP version but I think it'll be definitely 
available after (and with) 5.0.

There are new function series called Sqlite (www.sqlite.org), an embded file based SQL 
driver which supports SQL-92. As I see, this will be the best substitute for Access 
MDB, on Linux platforms. From what I've tried sqlite is much faster and much stable 
than MS Access.

This would've been the ideal solution if your PHP version is supported. If not the 
case still U can stick to Flat File based or CSV based data solutions (U'll have to 
mess up lot with PHP :)).

Regards,

Kosala

-Original Message-
From: Alex Gemmell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 6:12 PM
To: PHP List
Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :(

Hello all,

I am fairly new to Linux/PHP so please bear with me.  I have an awfully awkward 
problem to solve - a stop gap solution for the next 6 months until we have out 
in-house servers set up and running.  I also have a very short timeframe to sort this 
out.  I am using PHP on a remotely hosted Linux web server to build my website, 
however I have been given a MS Access database to use!  Despite my best efforts (and 
two days Google trawling) I haven't found a suitable solution so I am turning to your 
collective knowledge...

First things first - I do not run the server and cannot install any new tools on to it 
(I cannot access the folders above my web root).  There are lots of suggestions on the 
net about installing MDBTools and UnixODBC RPM 
(http://bryanmills.net:8086/archives/99.html) - but that involves the admin who 
won't do it!  I can, of course, put scripts that may help in the actual web folder and 
reference them if anyone has any ideas...

I know I must use a DSN-less connection.  I first tried connecting directly to the mdb 
file using:
$conn = new COM(ADODB.Connection) or die (Cannot create ADODB Connection 
object.); 

//$connstr = PROVIDER=MSDASQL;DBQ=/prices/mydb.mdb;.DRIVER={Microsoft 
Access Driver (*.mdb)}; 
//$connstr = Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=. 
realpath(prices/mydb.mdb) . ;;
// I've never got the above two connection strings to work but I include them 
for completeness and in case any realises they might help me!
$connstr = DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=. 
realpath(prices/mydb.mdb) . ;;

   $conn-open($connstr);

This worked on my localhost running IIS 5 (unsurprisingly) but fell over immediately 
on the Linux box.  I am told this is because COM support in PHP before version 4.3.x 
is buggy (he PHP version installed on the server is 4.1.2).  Is this true?  Will 
upgrading to version 4.3.x solve all my problems?

Also, I heard that converting the .mdb file to a .dbf file might help - but how do I 
connect to that with PHP?  The PHP manual says this about dbase functions:
These functions allow you to access records stored in dBase-format (dbf) databases. 
There is no support for indexes or memo fields.
That's no good because I have long text fields in the Access database that are of type 
memo!
The Manual also says we recommend that you do not use dBase files as your production 
database - eek!  It's only a small database (one table with about 50 records, each 
with no more than 20 fields) so hopefully it will suffice.

Am I right in thinking I have very few options?   I don't want to move over to ASP 
(would that even help?) because it means learning VBScript and I don't have a lot of 
time.  Also, I can't use another database (e.g. MySQL) cos the server admin is NOT 
helping me and won't install anything new.

I know 99% of you will want to tell me to just back out of this horrible tangle and 
take a different route, but is there one person out there who can help me get through 
this nightmare?

Thank you!

Alex Gemmell
¦:¦ Reply-to: [EMAIL PROTECTED]:¦
 
Or call me for free using Skype: 



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