Re: [PHP-DB] Re: [PHP] Best practices for using MySQL index

2008-06-17 Thread landavia
i agree. But InnoDB not fast like other, but this using for transaction. 
u should try to examine, if you choose performance.. chose other. If u 
use transaction, INNODB perhaps u can use?

*sry my bad LANG

Gergely Hodicska wrote:

Hi!


While this is not a MySQL mailing list, I try to give you some hints 
and keep it short.
There is maybe one important thing which should considered: clustered 
index. If use InnoDB you can think about to not using a surrogate key 
but a natural one which best support the query which you will use in 
most cases.


An InnoDB table's primary key is a clustered index and querying 
against it is very fast.



Best Regards,
Felhő




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



[PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread bateivan

Hello,

First of all, please, have in mind that I am new in this business.

I have a problem connecting with data base in one particular module. That's
right. The rest of the modules can connect to db, update tables with new
info but this one is refusing giving me message like this:

Warning: mysql_query() [function.mysql-query]: Access denied for user
'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\login.php on line 17

Warning: mysql_query() [function.mysql-query]: A link to the server could
not be established in
D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
line 17


It is a authentication module and this is the fragment of the code which is
giving me a hard time:

***
?php
include $_SERVER['DOCUMENT_ROOT'].
'/layout.php';

switch($_REQUEST['req']){ 
   
case validate:

   $validate = mysql_query(SELECT * FROM members
   WHERE username = '{$_POST['username']}'
   AND password = md5('{$_POST['password']}')
   );

etc

***

My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see
my program files are on D:\. All this may not be important but I listed
anyway.
It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.

I am using persisten connection which should be on until you restart the
server. I have a file included in every page for connection with MySQL and
data base.
PHP manual says that mysql_query reuses the existing connection or try to
create one if not present (I think, according to the warning is trying to
create one).
I had been checking after each step using phpinfo() if the connection is
there and it's there but for some reason the above fragment does not work.
As I mentioned above the rest of my modules are working fine with mysql.

I checked the php.ini file. I compared it to php.ini.recomended from the
.zip distribusion package and they are almost identical exept couple of
things for error reporting.
I, also checked FAQ, mail listings and other forums but it does not seem
anybody had a similar problem.

In one of my tests I included a line for connection just before the problem
lines, as described below, and it worked but my intention is to keep such
lines in a separate files and include them in every page instead.

***
...

$link = mysql_pconnect('localhost', 'root', 'testing');


   $validate = mysql_query(SELECT * FROM members
   WHERE username = '{$_POST['username']}'
   AND password = md5('{$_POST['password']}')
   );
etc.
***

As I metioned, this is an authentication module and, may be, that's why is
behaving diferently from the rest or I need to do some setup changes in
php.ini which I am not familiar with.

If anyone has had simmilar problem I would appreciate his/her input. Please,
help me resolve this mistery.

-- 
View this message in context: 
http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
Sent from the Php - Database mailing list archive at Nabble.com.


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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Isaak Malik
If you get an error of this kind:

Warning: mysql_query() [function.mysql-query]: Access denied for user
'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\login.php on line 17

Warning: mysql_query() [function.mysql-query]: A link to the server could
not be established in
D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
line 17

It means that either your mysql conenction details are not correctly set or
the connection resource isn't accessible for your mysql functions. I suggest
you first try by replacing:

$link = mysql_pconnect('localhost', 'root', 'testing');

into:

mysql_pconnect('localhost', 'root', 'testing');

On 6/17/08, bateivan [EMAIL PROTECTED] wrote:


 Hello,

 First of all, please, have in mind that I am new in this business.

 I have a problem connecting with data base in one particular module. That's
 right. The rest of the modules can connect to db, update tables with new
 info but this one is refusing giving me message like this:

 Warning: mysql_query() [function.mysql-query]: Access denied for user
 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache
 Software
 Foundation\Apache2.2\htdocs\login.php on line 17

 Warning: mysql_query() [function.mysql-query]: A link to the server could
 not be established in
 D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
 line 17


 It is a authentication module and this is the fragment of the code which is
 giving me a hard time:


 ***
 ?php
 include $_SERVER['DOCUMENT_ROOT'].
 '/layout.php';

 switch($_REQUEST['req']){

 case validate:

$validate = mysql_query(SELECT * FROM members
WHERE username = '{$_POST['username']}'
AND password = md5('{$_POST['password']}')
);

 etc


 ***

 My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see
 my program files are on D:\. All this may not be important but I listed
 anyway.
 It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
 replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.

 I am using persisten connection which should be on until you restart the
 server. I have a file included in every page for connection with MySQL and
 data base.
 PHP manual says that mysql_query reuses the existing connection or try to
 create one if not present (I think, according to the warning is trying to
 create one).
 I had been checking after each step using phpinfo() if the connection is
 there and it's there but for some reason the above fragment does not work.
 As I mentioned above the rest of my modules are working fine with mysql.

 I checked the php.ini file. I compared it to php.ini.recomended from
 the
 .zip distribusion package and they are almost identical exept couple of
 things for error reporting.
 I, also checked FAQ, mail listings and other forums but it does not seem
 anybody had a similar problem.

 In one of my tests I included a line for connection just before the problem
 lines, as described below, and it worked but my intention is to keep such
 lines in a separate files and include them in every page instead.


 ***
 ...

 $link = mysql_pconnect('localhost', 'root', 'testing');


$validate = mysql_query(SELECT * FROM members
WHERE username = '{$_POST['username']}'
AND password = md5('{$_POST['password']}')
);
 etc.

 ***

 As I metioned, this is an authentication module and, may be, that's why is
 behaving diferently from the rest or I need to do some setup changes in
 php.ini which I am not familiar with.

 If anyone has had simmilar problem I would appreciate his/her input.
 Please,
 help me resolve this mistery.

 --
 View this message in context:
 http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
 Sent from the Php - Database mailing list archive at Nabble.com.



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



-- 
Isaak Malik
Web Developer


Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Eric


http://myprojects.srhost.info
eric{at}myprojects{dot}srhost{dot}info
- Original Message - 
From: bateivan [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Tuesday, June 17, 2008 11:19 PM
Subject: [PHP-DB] PHP-MySQL connection for particular module


: 
: Hello,
: 
: First of all, please, have in mind that I am new in this business.
: 
: I have a problem connecting with data base in one particular module. That's
: right. The rest of the modules can connect to db, update tables with new
: info but this one is refusing giving me message like this:
: 
: Warning: mysql_query() [function.mysql-query]: Access denied for user
: 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
: Foundation\Apache2.2\htdocs\login.php on line 17
: 

This error message state that you have provided a wrong username and / or 
password
use the die also to ensure the connection was created.

: Warning: mysql_query() [function.mysql-query]: A link to the server could
: not be established in
: D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
: line 17
: 
: 
: It is a authentication module and this is the fragment of the code which is
: giving me a hard time:
: 
: 
***
: ?php
: include $_SERVER['DOCUMENT_ROOT'].
: '/layout.php';
: 

Let's your included page on the same directory. Say f:\webroot\docroot
As
f:\webroot\docroot\layout.php
f:\webroot\docroot\login.php

then try change the line from

 include $_SERVER['DOCUMENT_ROOT'].
 '/layout.php';

to

$app_root = './';
 include ($app_root . 'layout.php');


: switch($_REQUEST['req']){ 
:
: case validate:
: 
:$validate = mysql_query(SELECT * FROM members
:WHERE username = '{$_POST['username']}'
:AND password = md5('{$_POST['password']}')
:);
: 
: etc
: 
: 
***
: 
: My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see
: my program files are on D:\. All this may not be important but I listed
: anyway.
: It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
: replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.
: 
: I am using persisten connection which should be on until you restart the
: server. I have a file included in every page for connection with MySQL and
: data base.
: PHP manual says that mysql_query reuses the existing connection or try to
: create one if not present (I think, according to the warning is trying to
: create one).
: I had been checking after each step using phpinfo() if the connection is
: there and it's there but for some reason the above fragment does not work.
: As I mentioned above the rest of my modules are working fine with mysql.
: 
: I checked the php.ini file. I compared it to php.ini.recomended from the
: .zip distribusion package and they are almost identical exept couple of
: things for error reporting.
: I, also checked FAQ, mail listings and other forums but it does not seem
: anybody had a similar problem.
: 
: In one of my tests I included a line for connection just before the problem
: lines, as described below, and it worked but my intention is to keep such
: lines in a separate files and include them in every page instead.
: 
: 
***
: ...
: 
: $link = mysql_pconnect('localhost', 'root', 'testing');
: 
: 
:$validate = mysql_query(SELECT * FROM members
:WHERE username = '{$_POST['username']}'
:AND password = md5('{$_POST['password']}')
:);
: etc.
: 
***
: 
: As I metioned, this is an authentication module and, may be, that's why is
: behaving diferently from the rest or I need to do some setup changes in
: php.ini which I am not familiar with.
: 
: If anyone has had simmilar problem I would appreciate his/her input. Please,
: help me resolve this mistery.
: 
: -- 
: View this message in context: 
http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
: Sent from the Php - Database mailing list archive at Nabble.com.
: 
: 
: -- 
: 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] PHP-MySQL connection for particular module

2008-06-17 Thread Chris

 It means that either your mysql conenction details are not correctly set or
 the connection resource isn't accessible for your mysql functions. I suggest
 you first try by replacing:
 
 $link = mysql_pconnect('localhost', 'root', 'testing');
 
 into:
 
 mysql_pconnect('localhost', 'root', 'testing');

Why? How is that going to help fix the problem?

Personally I'd say to *not* use persistent connections as it will cause
you problems later.

Use a normal connection:

$link = mysql_connect($server, $user, $pass);

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Roberto Carlos García Luís

excuseme but, you can access by terminal? [shell]

ODBC is the user? or is a ODBC database?

Please answer me and i can help you.

**Excuse me my english is bad. :(

El 17/06/2008, a las 06:51 p.m., Chris escribió:



It means that either your mysql conenction details are not  
correctly set or
the connection resource isn't accessible for your mysql functions.  
I suggest

you first try by replacing:

$link = mysql_pconnect('localhost', 'root', 'testing');

into:

mysql_pconnect('localhost', 'root', 'testing');


Why? How is that going to help fix the problem?

Personally I'd say to *not* use persistent connections as it will  
cause

you problems later.

Use a normal connection:

$link = mysql_connect($server, $user, $pass);

--
Postgresql  php tutorials
http://www.designmagick.com/

--
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