Re: [PHP-DB] mysql went away

2004-05-13 Thread Jeffrey Moss
I would start by seeing if the files are there after you create/load the
table. It should by default create a file for each table you create. Sounds
to me like a problem reading the disk.

If you don't find any answers on your own, post your system specs to the
MySQL lists. You could also try verbose debugging options, I've never used
any debugging, but here's how to do it in mysqladmin.

--debug[=debug_options], -# [debug_options]
Write a debugging log. The debug_options string often is 'd:t:o,file_name'.
The default is 'd:t:o,/tmp/mysqladmin.trace'.

-Jeff

- Original Message - 
From: Bill Green [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 4:05 PM
Subject: [PHP-DB] mysql went away


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



[PHP-DB] php-mysql problem

2004-05-13 Thread Jianping Zhu
 have redhat 9.0 and Server version: Apache/2.0.40.
  i have installed rpms php-4.2.2-17.2.i386.rpm
   php-mysql-4.2.2-17.2.i386.rpm


   After i create a database called mydb and serveral tables in mysql,
   I tried to run following testdb.php script


   --
   html
   body
   ?php
   $db = mysql_connect(localhost, root,xx);
   mysql_select_db(mydb,$db);
   $result = mysql_query(SELECT * FROM employees,$db);
   printf(First Name: %sbr\n, mysql_result($result,0,first));
   printf(Last Name: %sbr\n, mysql_result($result,0,last));
   printf(Address: %sbr\n, mysql_result($result,0,address));
   printf(Position: %sbr\n, mysql_result($result,0,position));
   ?
   /body
   /html
   ---

   but i got error message with:
   http://coopunit.forestry.uga.edu:8080/testdb.php
   the error is:
   Fatal error: Call to undefined function:
   mysql_connect() in /var/www/html/testdb.php on line 13

   How can Fix this problem? Thanks

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



[PHP-DB] Re: question on select

2004-05-13 Thread Neil Smith [MVP, Digital media]
** Or send XML files up and down dynamically using xmlhttp in IE and 
Mozilla ;-)

Cheers - Neil

At 04:06 13/05/2004 +, you wrote:
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.
--
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-13 Thread Alex Gemmell
Well, I have reached a solution that works brilliantly - unfortunately it
doesn't involve connecting to the MS Access db file.  Instead I have beaten
the server administrator with a stick (harassing by phone works!) until he
installed MySQL for me.  Now I can work with PHPMySQL in harmony!

Thanks to all who offered help.  Especially the last few ideas about using
PHP to parse .csv files.  That would have definitely been the only solution
given my situation.

Until the next impossible situation...

Alex
¦:¦ Reply-to: [EMAIL PROTECTED] ¦:¦
 
|-Original Message-
|From: Kosala Atapattu [mailto:[EMAIL PROTECTED]
|Sent: 13 May 2004 05:09
|To: Alex Gemmell; PHP List
|Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|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



RE: RE: [PHP-DB] question on select

2004-05-13 Thread hengameh
Thanks everyone for all your help. 
I found some code that is using Java script and although it's not fully
functional yet I am working on it. If anyone is interested here it is:

?php require_once(util.php); /*file holding DB info*/
global $db; 
$db = mysql_connect(DBSERVERHOST, DBUSERNAME, DBPASSWORD); 
if (!$db)
{
echo Unable to connect to DB.mysql_error();
exit;
}

$selecteddb = mysql_select_db(DBNAME, $db); 
if (!$selecteddb)
{
echo Unable to select DBNAME: .mysql_error();
exit;
}

? 
html 
head 
title.: Combobox :./title 
style type=text/css 
!-- 
select { 
font-family: Verdana, Arial, Helvetica, sans-serif; 
font-size: 7pt; 
font-style: normal; 
font-weight: bold; 
color: #00; 
background-color: #FF; 
height: 16px; 
width: 300px; 
border: 1px solid #00; 
} 
#left { 
font-family: Verdana, Arial, Helvetica, sans-serif; 
font-size: 7pt; 
font-style: normal; 
font-weight: bold; 
color: #00; 
background-color: #FF; 
text-align: right; 
vertical-align: middle; 
height: 16px; 
width: 150px; 
} 
#right { 
font-family: Verdana, Arial, Helvetica, sans-serif; 
font-size: 7pt; 
font-style: normal; 
font-weight: bold; 
color: #00; 
background-color: #FF; 
text-align: right; 
vertical-align: middle; 
height: 16px; 
width: 300px; 
} 
-- 
/style 
Script Language=JavaScript 
function getStates(what) { 
if (what.selectedIndex != '') { 
var country = what.value; 
document.location=('combobox.php?cSel=' + country); 
} 
}
function getDistrict(what) { 
if (what.selectedIndex != '') { 
var country = document.myForm.cSelect.selectedIndex; 
var state = what.value; 
document.location=('combobox.php?cSel=' + country + 'sSel=' +
state); 
} 
} 
function getCity(what) { 
if (what.selectedIndex != '') { 
var state = document.myForm.sSelect.selectedIndex; 
var district = what.value; 
document.location=('combobox.php?cSel=' + country + 'sSel=' + state
+ 'dSel=' + district); 
} 
} 
/script 
/head 

body 
form name=myForm method=post action= 
table width=450 align=center cellpadding=1 cellspacing=1 
  tr 
td id=leftSelect your Country:/td 
td id=right 
select name=cSelect onChange=getStates(this); 
option value=please, select your country/option 
?php
global $db; 
// Country Select Box Populated with Values from 'country' table. 
$country_qu = mysql_query(SELECT * FROM country ORDER BY country, $db); 
while ($country_array = mysql_fetch_array($country_qu)) { 
$cNa = $country_array[country];  
$cAb = $country_array[cabbrev]; 

 // This keeps the COuntry elected after JScript has Refreshed the page.

if ($cSel == $cNa) { 
echo option value=$cNa Selected$cNa/option; 
} else { 
echo option value=$cNa$cNa/option; 
} 

} 
? 
/select 
/td 
/tr 
tr 
td id=leftSelect your State or Province:/td 
td id=right 
select name=sSelect onChange=getDistrict(this); 
option value=please, select your state or province/option 
?php 
global $db;
// State Select Box Populated with Values from 'stateprovince' table. 
if ($cSel) { 
$state_qu = mysql_query(SELECT * FROM stateprovince WHERE
country='$cSel' ORDER BY stateprovince,$db); 
if (!$state_qu)
{
echo Could not successfully run the query .mysql_error();
exit;
}
$sNum = mysql_num_rows($state_qu); 
 // I put this IF STATEMENT here incase you ever have citys that are not
in states. Just Countrys. 
if ($sNum == 0) { 
$ctNoState = none; 
} else { 
while ($state_array = mysql_fetch_array($state_qu)) { 
$sNa = $state_array[stateprovince]; 
$sId = $state_array[pid]; 
$sCu = $state_array[country]; 

 // This keeps the state selected after JScript has Refreshed
the page. 
if ($sSel == $sId) { 
echo option value=$sId Selected$sNa, $sCu/option; 
} else { 
echo option value=$sId$sNa, $sCu/option; 
} 

} 
} 
} 
? 
/td 
/tr 

tr 
td id=leftSelect your District: 
/td 

td id=right 
select name=dSelect onChange=getCity(this); 
option value=please, select your district/option 
 
?php 
// District Select Box Populated with Values from 'district' table. 

if ($sSel) { 
 // This is the SQL you should keep if you're gonna delete the IF, ELSE
IF. 
$district_sql = SELECT did,pid,district FROM district WHERE pid='$sSel'
ORDER BY district; 
} 

if ($district_sql != ) { 
$district_qu = mysql_query($district_sql,$db); 
while ($district_array = mysql_fetch_array($district_qu)) { 
$dNa = $district_array[district]; 
$dId = $district_array[did]; 
$dPid = $district_array[pid]; 
echo option value=$dId$dNa/option; 

[PHP-DB] Re:RE: [PHP-DB] question on select

2004-05-13 Thread Neil Smith [MVP, Digital media]
That *should* read :

document.fcountry.newcountry.value = 
document.fcountry.country[document.fcountry.country.selectedIndex].value;

Skip the 'options' object - I'm surprised you're not getting a javascript 
error, maybe you have error reporting turned off in your browser ? In any 
case, always 'alert' that value when you create it, so you know what you're 
actually submitting during testing.

At 04:06 13/05/2004 +, you wrote:
From: hengameh [EMAIL PROTECTED]
To: [EMAIL PROTECTED],
[EMAIL PROTECTED]
Date: Wed, 12 May 2004 12:22:20 -0400
MIME-Version: 1.0
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] question on select
!--
function changeMenu()
  {
  document.fcountry.newcountry.value =
document.fcountry.country.options[document.fcountry.country.selectedIndex].v
alue;
 }
--
/script



CaptionKit http://www.captionkit.com : Production tools
for accessible subtitled internet media, transcripts
and searchable video. Supports Real Player, Quicktime
and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every
day at http://www.fresh-toast.net : NetMeeting solutions
for a connected world.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] php-mysql problem

2004-05-13 Thread Stefan Dengscherz
hello,

did you load the mysql module in your php.ini configuration file?
i.e. is the following line there:
extension=mysql.so

regards

On Thu, 13 May 2004 11:47:41 -0400
Jianping Zhu [EMAIL PROTECTED] wrote:

  have redhat 9.0 and Server version: Apache/2.0.40.
   i have installed rpms php-4.2.2-17.2.i386.rpm
php-mysql-4.2.2-17.2.i386.rpm
 
 
After i create a database called mydb and serveral tables in mysql,
I tried to run following testdb.php script
 
 
--
html
body
?php
$db = mysql_connect(localhost, root,xx);
mysql_select_db(mydb,$db);
$result = mysql_query(SELECT * FROM employees,$db);
printf(First Name: %sbr\n, mysql_result($result,0,first));
printf(Last Name: %sbr\n, mysql_result($result,0,last));
printf(Address: %sbr\n, mysql_result($result,0,address));
printf(Position: %sbr\n, mysql_result($result,0,position));
?
/body
/html
---
 
but i got error message with:
http://coopunit.forestry.uga.edu:8080/testdb.php
the error is:
Fatal error: Call to undefined function:
mysql_connect() in /var/www/html/testdb.php on line 13
 
How can Fix this problem? Thanks
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



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

2004-05-13 Thread Michael Forbes
I'm glad you found a solution to your problem-- how big a stick did it 
require?

I actually learned a LOT just reading that thread (although I'm an 
Access guru who came to PHP/MySQL by way of conversion to zealotry, I've 
never used PHP against an Access back-end).  Many thanks to those who 
contributed!

In the meantime, a warning against CSV files:  I've found it best, when 
transferring files this way, to use a delimiter other than the comma. 
I'll usually use a character that's not even on the keyboard, if 
possible.  The other option is to make absolutely sure that all quotes 
in text fields (if any) are escaped/encoded.  Either way works, you just 
have to be careful...

-Mike Forbes

Alex Gemmell wrote:
Well, I have reached a solution that works brilliantly - unfortunately it
doesn't involve connecting to the MS Access db file.  Instead I have beaten
the server administrator with a stick (harassing by phone works!) until he
installed MySQL for me.  Now I can work with PHPMySQL in harmony!
Thanks to all who offered help.  Especially the last few ideas about using
PHP to parse .csv files.  That would have definitely been the only solution
given my situation.
Until the next impossible situation...

Alex
¦:¦ Reply-to: [EMAIL PROTECTED] ¦:¦
 
|-Original Message-
|From: Kosala Atapattu [mailto:[EMAIL PROTECTED]
|Sent: 13 May 2004 05:09
|To: Alex Gemmell; PHP List
|Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|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 

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

2004-05-13 Thread Michael Forbes
I'm glad you found a solution to your problem-- how big a stick did it 
require?

I actually learned a LOT just reading that thread (although I'm an 
Access guru who came to PHP/MySQL by way of conversion to zealotry, I've 
never used PHP against an Access back-end).  Many thanks to those who 
contributed!

In the meantime, a warning against CSV files:  I've found it best, when 
transferring files this way, to use a delimiter other than the comma. 
I'll usually use a character that's not even on the keyboard, if 
possible.  The other option is to make absolutely sure that all quotes 
in text fields (if any) are escaped/encoded.  Either way works, you just 
have to be careful...

-Mike Forbes

Alex Gemmell wrote:
Well, I have reached a solution that works brilliantly - unfortunately it
doesn't involve connecting to the MS Access db file.  Instead I have beaten
the server administrator with a stick (harassing by phone works!) until he
installed MySQL for me.  Now I can work with PHPMySQL in harmony!
Thanks to all who offered help.  Especially the last few ideas about using
PHP to parse .csv files.  That would have definitely been the only solution
given my situation.
Until the next impossible situation...

Alex
¦:¦ Reply-to: [EMAIL PROTECTED] ¦:¦
 
|-Original Message-
|From: Kosala Atapattu [mailto:[EMAIL PROTECTED]
|Sent: 13 May 2004 05:09
|To: Alex Gemmell; PHP List
|Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
|
|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 

Re: [PHP-DB] question on select

2004-05-13 Thread Michael Forbes
Interesting idea.  Since I'm convinced that javascript is the bastard 
offspring of Bill Gates, Larry Ellison, and Baalzebub, can I sue too? :)

Hengameh wrote:

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


[PHP-DB] Secure MySQL Access md5()

2004-05-13 Thread Theisen, Gary
 
Hi all,
 
I've got:
 
WinNT
php 4.3.1
phpmyadmin 2.5.6
MySQL 4.0.18-nt
 
I can connect to my db via my php script using:
 
[php]
$connection = mysql_connect (localhost, root, )
[/php]
 
That works no problem.
 
This will not work however:
 
[php]
$somePass = md5(somePass);
$connection = mysql_connect (localhost, someID, $somePass)
[/php]
 
gives me this error:
 
[quote]
Access denied for user: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]'
(Using password: YES)
[/quote]
 
I set someID up in the db using phpmyadmin, with it's password using the
md5() function.  I can see via phpmyadmin that someID does indeed have a 32
byte encrypted password stored.
 
I can then compare the stored md5 password to the md5 password I'm passing
to try to connect...via $somePass.  The encrypted passwords match exactly.
 
Why wouldn't the match be confirmed...allowing me to connect?
 
Thanks!


[PHP-DB] Re: Secure MySQL Access md5()

2004-05-13 Thread Uzi Klein

Gary Theisen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 Hi all,

 I've got:

 WinNT
 php 4.3.1
 phpmyadmin 2.5.6
 MySQL 4.0.18-nt

 I can connect to my db via my php script using:

 [php]
 $connection = mysql_connect (localhost, root, )
 [/php]

 That works no problem.

 This will not work however:

 [php]
 $somePass = md5(somePass);

and why would you do that??
just type the username and password...

 $connection = mysql_connect (localhost, someID, $somePass)
 [/php]

 gives me this error:

 [quote]
 Access denied for user: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]'
 (Using password: YES)
 [/quote]

 I set someID up in the db using phpmyadmin, with it's password using the
 md5() function.  I can see via phpmyadmin that someID does indeed have a
32
 byte encrypted password stored.

 I can then compare the stored md5 password to the md5 password I'm passing
 to try to connect...via $somePass.  The encrypted passwords match exactly.

 Why wouldn't the match be confirmed...allowing me to connect?

 Thanks!


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



[PHP-DB] Re: Secure MySQL Access md5()

2004-05-13 Thread Hans Lellelid
Hi,

Passwords in the mysql.users table must be encrypted using MySQL's 
native PASSWORD() function, not MD5().  With newer versions of MySQL, I 
think there is some change in this, but AFAIK for 4.0.18 this is still true.

When connecting to the database you always use the plaintext password, 
and MySQL will do the encrypting (using PASSWORD()) and check it against 
what is in the row of the users table.

HTH,
Hans
Gary Theisen wrote:

 
Hi all,
 
I've got:
 
WinNT
php 4.3.1
phpmyadmin 2.5.6
MySQL 4.0.18-nt
 
I can connect to my db via my php script using:
 
[php]
$connection = mysql_connect (localhost, root, )
[/php]
 
That works no problem.
 
This will not work however:
 
[php]
$somePass = md5(somePass);
$connection = mysql_connect (localhost, someID, $somePass)
[/php]
 
gives me this error:
 
[quote]
Access denied for user: '[EMAIL PROTECTED]' mailto:'[EMAIL PROTECTED]'
(Using password: YES)
[/quote]
 
I set someID up in the db using phpmyadmin, with it's password using the
md5() function.  I can see via phpmyadmin that someID does indeed have a 32
byte encrypted password stored.
 
I can then compare the stored md5 password to the md5 password I'm passing
to try to connect...via $somePass.  The encrypted passwords match exactly.
 
Why wouldn't the match be confirmed...allowing me to connect?
 
Thanks!

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