RE: php and mysql
You need a login id and password unless this is test DB added under ID root You have to use the same login id as the one you created the db/table with. mysql_connect('localhost', 'Login id', 'pw') or die(mysql_error()) mysql_connect('localhost', 'root') or die(mysql_error()) -Original Message- From: Mary Adel [mailto:[EMAIL PROTECTED] Sent: Thursday, March 09, 2006 3:06 PM To: mysql@lists.mysql.com Subject: php and mysql I have a severe problem that php5 cannot connect to mysql and i don't know why also i am using linux here is my peice of code :?php print hi; mysql_connect('localhost', '', '') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if their is any configuration please tell me thanks, mary -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: php and mysql
Mary Adel wrote: I have a severe problem that php5 cannot connect to mysql and i don't know why also i am using linux here is my peice of code :?php print hi; mysql_connect('localhost', '', '') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if their is any configuration please tell me PHP wants a username and password. For web pages, it's good practice to create a mysql user just for the db access required by your pages. PB - thanks, mary -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.2.0/275 - Release Date: 3/6/2006 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: php and mysql
Thanks for al your help and i di that and now i have another error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) my code is as follows: ?php print hi; mysql_connect('localhost', 'root','') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if u can help in this i ll appreciate that a lot On Thu, 2006-03-09 at 13:37 -0500, fbsd_user wrote: You need a login id and password unless this is test DB added under ID root You have to use the same login id as the one you created the db/table with. mysql_connect('localhost', 'Login id', 'pw') or die(mysql_error()) mysql_connect('localhost', 'root') or die(mysql_error()) -Original Message- From: Mary Adel [mailto:[EMAIL PROTECTED] Sent: Thursday, March 09, 2006 3:06 PM To: mysql@lists.mysql.com Subject: php and mysql I have a severe problem that php5 cannot connect to mysql and i don't know why also i am using linux here is my peice of code :?php print hi; mysql_connect('localhost', '', '') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if their is any configuration please tell me thanks, mary -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: php and mysql
On Thu, 9 Mar 2006, Mary Adel wrote: Thanks for al your help and i di that and now i have another error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) my code is as follows: ?php print hi; mysql_connect('localhost', 'root','') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if u can help in this i ll appreciate that a lot On Thu, 2006-03-09 at 13:37 -0500, fbsd_user wrote: You need a login id and password unless this is test DB added under ID root You have to use the same login id as the one you created the db/table with. mysql_connect('localhost', 'Login id', 'pw') or die(mysql_error()) mysql_connect('localhost', 'root') or die(mysql_error()) -Original Message- From: Mary Adel [mailto:[EMAIL PROTECTED] Sent: Thursday, March 09, 2006 3:06 PM To: mysql@lists.mysql.com Subject: php and mysql I have a severe problem that php5 cannot connect to mysql and i don't know why also i am using linux here is my peice of code :?php print hi; mysql_connect('localhost', '', '') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if their is any configuration please tell me thanks, mary -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- hi mary, take a look at http://www.stanton-finley.net/fedora_core_5_installation_notes.html#MySQL. basically, you need to make sure that your mysql server accepts local connection. if you login to your mysql server: mysql -u root (if no password for root) or mysql -u root -p (if there is pw for root) and then: select user,host,password from mysql.user; if you don't see an entry for root localhost, then you need to add it in. hope that help. JC -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: php and mysql
If you still have issues after that, then read http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html Regards --- ** _/ ** David Logan *** _/ *** ITO Delivery Specialist - Database *_/* Hewlett-Packard Australia Ltd _/_/_/ _/_/_/ E-Mail: [EMAIL PROTECTED] _/ _/ _/ _/ Desk: +618 8408 4273 _/ _/ _/_/_/ Mobile: 0417 268 665 *_/ ** ** _/ Postal: 148 Frome Street, _/ ** Adelaide SA 5001 Australia invent --- -Original Message- From: JC [mailto:[EMAIL PROTECTED] Sent: Friday, 10 March 2006 6:42 AM To: Mary Adel Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: RE: php and mysql On Thu, 9 Mar 2006, Mary Adel wrote: Thanks for al your help and i di that and now i have another error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) my code is as follows: ?php print hi; mysql_connect('localhost', 'root','') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if u can help in this i ll appreciate that a lot On Thu, 2006-03-09 at 13:37 -0500, fbsd_user wrote: You need a login id and password unless this is test DB added under ID root You have to use the same login id as the one you created the db/table with. mysql_connect('localhost', 'Login id', 'pw') or die(mysql_error()) mysql_connect('localhost', 'root') or die(mysql_error()) -Original Message- From: Mary Adel [mailto:[EMAIL PROTECTED] Sent: Thursday, March 09, 2006 3:06 PM To: mysql@lists.mysql.com Subject: php and mysql I have a severe problem that php5 cannot connect to mysql and i don't know why also i am using linux here is my peice of code :?php print hi; mysql_connect('localhost', '', '') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if their is any configuration please tell me thanks, mary -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- hi mary, take a look at http://www.stanton-finley.net/fedora_core_5_installation_notes.html#MySQ L. basically, you need to make sure that your mysql server accepts local connection. if you login to your mysql server: mysql -u root (if no password for root) or mysql -u root -p (if there is pw for root) and then: select user,host,password from mysql.user; if you don't see an entry for root localhost, then you need to add it in. hope that help. JC -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: php and mysql
Mary, you need to know 100% that mysql is actually running and what port or socket it is listening on for connections, before you even try and connect to it. If you call mysqld directly with a script something like: #! /bin/sh # start-mysql-5.0.18 # # start the MySQL database server /usr/local/mysql-5.0.18/bin/mysqld \ --defaults-file=/usr/local/mysql-5.0.18/my.cnf \ --port=7000 \ --socket=/var/lib/mysql/mysql.sock \ --pid=/var/lib/mysql/laptop.pid \ --user=mysql \ --datadir=/var/lib/mysql Then use a processes monitoring tool such as: http://www.student.nada.kth.se/~f91-men/qps/ This will then show you if mysqld is running OK. It will also show you the parameters in the above script that you passed to mysqld to get it started. You then need to try and connect to mysqld with the mysql monitor program as already mentioned. If you just set the client options in /etc/my.cnf config file, these will be applied globally to all mysql client programs. EG. # /etc/my.cnf # MySQL client program configuration file # last updated 2006-03-05 # mysqld server configuration file lives in # /usr/local/mysql-version/my.cnf #--- # mysql client program configuration options #--- [mysql] auto-rehash # needed for security - to stops multiple deletes/updates # without a where clause safe-updates #--- # The following options will be passed to all MySQL clients [client] socket = /var/lib/mysql/mysql.sock port = 7000 #snip #--- # end of mysql client program configurations # /etc/my.cnf More options for your mysqld server can be set in the --defaults-file=/usr/local/mysql-5.0.18/my.cnf These options are additional to the options you pass in the above script. EG #--- # mysqld server configuration options #--- [mysqld] basedir=/usr/local/mysql-5.0.18 ## use for testing multiple instances of mysqld ## these parameters are normally passed to mysqld ## from the start-mysql-5.0.18 script ## ##basedir=/usr/local/mysql-5.0.18 ##port=7005 ##socket=/usr/local/mysql-5.0.18/data/mysql.sock ##pid-file=/usr/local/mysql-5.0.18/data/laptop.pid ##datadir=/usr/local/mysql-5.0.18/data ##user=mysql server-id=1 #skip-networking skip-name-resolve skip-locking set-variable = key_buffer=16M set-variable = max_allowed_packet=1M set-variable = table_cache=64 set-variable = sort_buffer=512K set-variable = net_buffer_length=8K set-variable = myisam_sort_buffer_size=8M # logging options log=5-0-18.log log-bin=laptop-bin log-error=5-0-18.error-log log-queries-not-using-indexes log-slow-admin-statements log-slow-queries=5-0-18.slow-log log-warnings #--- # end of mysqld server configuration file # /usr/local/mysql-version/my.cnf Next you will need to check php is using the same socket to connect to mysqld server. Use the phpinfo() function in a php script, to verify this. Obviously, you will need the mysql or mysqli extension loaded for this. HTH Keith Roberts In theory, theory and practice are the same; In practice they are not. On Fri, 10 Mar 2006, Logan, David (SST - Adelaide) wrote: To: Mary Adel [EMAIL PROTECTED] From: Logan, David (SST - Adelaide) [EMAIL PROTECTED] Subject: RE: php and mysql If you still have issues after that, then read http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html Regards --- ** _/ ** David Logan *** _/ *** ITO Delivery Specialist - Database *_/* Hewlett-Packard Australia Ltd _/_/_/ _/_/_/ E-Mail: [EMAIL PROTECTED] _/ _/ _/ _/ Desk: +618 8408 4273 _/ _/ _/_/_/ Mobile: 0417 268 665 *_/ ** ** _/ Postal: 148 Frome Street, _/ ** Adelaide SA 5001 Australia invent --- -Original Message- From: JC [mailto:[EMAIL PROTECTED] Sent: Friday, 10 March 2006 6:42 AM To: Mary Adel Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: RE: php and mysql On Thu, 9 Mar 2006, Mary Adel wrote: Thanks for al your help and i di that and now i have another error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) my code is as follows: ?php print hi; mysql_connect('localhost', 'root
RE: php and mysql
Also be careful with this: http://dev.mysql.com/doc/refman/5.0/en/old-client.html (after to establish a connection) Edwin. -Mensaje original- De: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 09 de Marzo de 2006 02:17 p.m. Para: Mary Adel CC: [EMAIL PROTECTED]; mysql@lists.mysql.com Asunto: RE: php and mysql If you still have issues after that, then read http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html Regards --- ** _/ ** David Logan *** _/ *** ITO Delivery Specialist - Database *_/* Hewlett-Packard Australia Ltd _/_/_/ _/_/_/ E-Mail: [EMAIL PROTECTED] _/ _/ _/ _/ Desk: +618 8408 4273 _/ _/ _/_/_/ Mobile: 0417 268 665 *_/ ** ** _/ Postal: 148 Frome Street, _/ ** Adelaide SA 5001 Australia invent --- -Original Message- From: JC [mailto:[EMAIL PROTECTED] Sent: Friday, 10 March 2006 6:42 AM To: Mary Adel Cc: [EMAIL PROTECTED]; mysql@lists.mysql.com Subject: RE: php and mysql On Thu, 9 Mar 2006, Mary Adel wrote: Thanks for al your help and i di that and now i have another error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) my code is as follows: ?php print hi; mysql_connect('localhost', 'root','') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if u can help in this i ll appreciate that a lot On Thu, 2006-03-09 at 13:37 -0500, fbsd_user wrote: You need a login id and password unless this is test DB added under ID root You have to use the same login id as the one you created the db/table with. mysql_connect('localhost', 'Login id', 'pw') or die(mysql_error()) mysql_connect('localhost', 'root') or die(mysql_error()) -Original Message- From: Mary Adel [mailto:[EMAIL PROTECTED] Sent: Thursday, March 09, 2006 3:06 PM To: mysql@lists.mysql.com Subject: php and mysql I have a severe problem that php5 cannot connect to mysql and i don't know why also i am using linux here is my peice of code :?php print hi; mysql_connect('localhost', '', '') or die(mysql_error()); echo Connected to MySQLbr /; print connected; ? if their is any configuration please tell me thanks, mary -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- hi mary, take a look at http://www.stanton-finley.net/fedora_core_5_installation_notes.html#MySQ L. basically, you need to make sure that your mysql server accepts local connection. if you login to your mysql server: mysql -u root (if no password for root) or mysql -u root -p (if there is pw for root) and then: select user,host,password from mysql.user; if you don't see an entry for root localhost, then you need to add it in. hope that help. JC -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: PHP and mysql
Thanks for your reply I think this is the issue I don't think root is allowed to login from local host I created another user called web user and changed the script, that works fine, next question is how do I set the permissions for root in mysql to allow root to login, if I use #mysql -u root password I go straight in If I use #mysql -u root -p password I get access denied for [EMAIL PROTECTED] -Original Message- Visit our websites: http://www.dailysnack.com “bite size news and gossip” http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. ##EXN2000## From: sheeri kritzer [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 18:06 To: Alastair Roy Cc: mysql@lists.mysql.com Subject: Re: PHP and mysql Yes. Whenever you have a problem, go back to basics. Can you login as root on the commandline? What password do you use there? Once you're there, check root's permissions, but I'd be willing to bet your password is incorrect, or root is only allowed to logon from localhost and not the machine the webserver is on. -Sheeri On 10/25/05, Alastair Roy [EMAIL PROTECTED] wrote: Greetings everyone, I am having a problem with PHP and mysql I have copied a script exactly off a website to open the database and insert a new user I try to access the mysql database using the root user, and enter information into the user table, this is the PHP I am using ? include 'library/config.php'; include 'library/opendb.php'; $query = INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) . VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y'); mysql_query($query) or die('Error, insert query failed'); $query = FLUSH PRIVILEGES; mysql_query($query) or die('Error, insert query failed'); include 'library/closedb.php'; ? When I try this I get the access for user [EMAIL PROTECTED] host denied, it is driving me nuts no matter what I try I get the same thing other scripts I have tried do the same thing, have tried messing around with the config.php and opendb.php included scripts but nothing works if I run php -f opendb.php I get no errors which I think means it is working, then again I don't know. Anyone have any ideas ?? Thanks in advance Visit our websites: http://www.dailysnack.com “bite size news and gossip” http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. ##EXN2000## -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL
RE: PHP and mysql
Hi Alastair, You don't have a password for root set. The syntax for mysql (the client) would put your #mysql -u root password as setting the database to password. If you use the -p option, even if you don't supply a password, it will be rejected if no password is set. You may like to check out http://dev.mysql.com/doc/refman/5.0/en/privilege-system.html Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Alastair Roy [mailto:[EMAIL PROTECTED] Sent: Thursday, 27 October 2005 6:23 PM To: 'sheeri kritzer' Cc: mysql@lists.mysql.com Subject: RE: PHP and mysql Thanks for your reply I think this is the issue I don't think root is allowed to login from local host I created another user called web user and changed the script, that works fine, next question is how do I set the permissions for root in mysql to allow root to login, if I use #mysql -u root password I go straight in If I use #mysql -u root -p password I get access denied for [EMAIL PROTECTED] -Original Message- Visit our websites: http://www.dailysnack.com bite size news and gossip http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. ##EXN2000## From: sheeri kritzer [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 18:06 To: Alastair Roy Cc: mysql@lists.mysql.com Subject: Re: PHP and mysql Yes. Whenever you have a problem, go back to basics. Can you login as root on the commandline? What password do you use there? Once you're there, check root's permissions, but I'd be willing to bet your password is incorrect, or root is only allowed to logon from localhost and not the machine the webserver is on. -Sheeri On 10/25/05, Alastair Roy [EMAIL PROTECTED] wrote: Greetings everyone, I am having a problem with PHP and mysql I have copied a script exactly off a website to open the database and insert a new user I try to access the mysql database using the root user, and enter information into the user table, this is the PHP I am using ? include 'library/config.php'; include 'library/opendb.php'; $query = INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) . VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y'); mysql_query($query) or die('Error, insert query failed'); $query = FLUSH PRIVILEGES; mysql_query($query) or die('Error, insert query failed'); include 'library/closedb.php'; ? When I try this I get the access for user [EMAIL PROTECTED] host denied, it is driving me nuts no matter what I try I get the same thing other scripts I have tried do the same thing, have tried messing around with the config.php and opendb.php included scripts but nothing works if I run php -f opendb.php I get no errors which I think means it is working, then again I don't know. Anyone have any ideas ?? Thanks in advance Visit our websites: http://www.dailysnack.com bite size news and gossip http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers The information transmitted is intended only
Re: PHP and mysql
Hi Alaister, Your root password is not actually set. If you do mysql -u root -ppassword and it fails, it means that the password is not password if you do mysql -u root password the mysql client will parse password as the database you're trying to use -- that's just the syntax of the mysql client. Which means that your password is not very secure, because it's the same as your database name. You should get an error like this: ERROR 1049 (42000): Unknown database 'password' What you should do is this: # mysql -u root set password=password(newpassword); where newpassword is your new password. hope this helps. -Sheeri On 10/27/05, Alastair Roy [EMAIL PROTECTED] wrote: Thanks for your reply I think this is the issue I don't think root is allowed to login from local host I created another user called web user and changed the script, that works fine, next question is how do I set the permissions for root in mysql to allow root to login, if I use #mysql -u root password I go straight in If I use #mysql -u root -p password I get access denied for [EMAIL PROTECTED] -Original Message- Visit our websites: http://www.dailysnack.com +IBw-bite size news and gossip+IB0 http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. ##EXN2000## From: sheeri kritzer [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 18:06 To: Alastair Roy Cc: mysql@lists.mysql.com Subject: Re: PHP and mysql Yes. Whenever you have a problem, go back to basics. Can you login as root on the commandline? What password do you use there? Once you're there, check root's permissions, but I'd be willing to bet your password is incorrect, or root is only allowed to logon from localhost and not the machine the webserver is on. -Sheeri On 10/25/05, Alastair Roy [EMAIL PROTECTED] wrote: Greetings everyone, I am having a problem with PHP and mysql I have copied a script exactly off a website to open the database and insert a new user I try to access the mysql database using the root user, and enter information into the user table, this is the PHP I am using ? include 'library/config.php'; include 'library/opendb.php'; $query = INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) . VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y'); mysql_query($query) or die('Error, insert query failed'); $query = FLUSH PRIVILEGES; mysql_query($query) or die('Error, insert query failed'); include 'library/closedb.php'; ? When I try this I get the access for user [EMAIL PROTECTED] host denied, it is driving me nuts no matter what I try I get the same thing other scripts I have tried do the same thing, have tried messing around with the config.php and opendb.php included scripts but nothing works if I run php -f opendb.php I get no errors which I think means it is working, then again I don't know. Anyone have any ideas ?? Thanks in advance Visit our websites: http://www.dailysnack.com +IBw-bite size news and gossip+IB0 http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers
Re: PHP and mysql
mysqladmin -u root password new password Curtis sheeri kritzer wrote: Hi Alaister, Your root password is not actually set. If you do mysql -u root -ppassword and it fails, it means that the password is not password if you do mysql -u root password the mysql client will parse password as the database you're trying to use -- that's just the syntax of the mysql client. Which means that your password is not very secure, because it's the same as your database name. You should get an error like this: ERROR 1049 (42000): Unknown database 'password' What you should do is this: # mysql -u root set password=password(newpassword); where newpassword is your new password. hope this helps. -Sheeri On 10/27/05, Alastair Roy [EMAIL PROTECTED] wrote: Thanks for your reply I think this is the issue I don't think root is allowed to login from local host I created another user called web user and changed the script, that works fine, next question is how do I set the permissions for root in mysql to allow root to login, if I use #mysql -u root password I go straight in If I use #mysql -u root -p password I get access denied for [EMAIL PROTECTED] -Original Message- Visit our websites: http://www.dailysnack.com +IBw-bite size news and gossip+IB0 http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. ##EXN2000## From: sheeri kritzer [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 18:06 To: Alastair Roy Cc: mysql@lists.mysql.com Subject: Re: PHP and mysql Yes. Whenever you have a problem, go back to basics. Can you login as root on the commandline? What password do you use there? Once you're there, check root's permissions, but I'd be willing to bet your password is incorrect, or root is only allowed to logon from localhost and not the machine the webserver is on. -Sheeri On 10/25/05, Alastair Roy [EMAIL PROTECTED] wrote: Greetings everyone, I am having a problem with PHP and mysql I have copied a script exactly off a website to open the database and insert a new user I try to access the mysql database using the root user, and enter information into the user table, this is the PHP I am using ? include 'library/config.php'; include 'library/opendb.php'; $query = INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) . VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y'); mysql_query($query) or die('Error, insert query failed'); $query = FLUSH PRIVILEGES; mysql_query($query) or die('Error, insert query failed'); include 'library/closedb.php'; ? When I try this I get the access for user [EMAIL PROTECTED] host denied, it is driving me nuts no matter what I try I get the same thing other scripts I have tried do the same thing, have tried messing around with the config.php and opendb.php included scripts but nothing works if I run php -f opendb.php I get no errors which I think means it is working, then again I don't know. Anyone have any ideas ?? Thanks in advance Visit our websites: http://www.dailysnack.com +IBw-bite size news and gossip+IB0 http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions
Re: PHP and mysql
Hello. May be this could be a bit helpful: http://dev.mysql.com/doc/refman/5.0/en/access-denied.html Alastair Roy wrote: Greetings everyone, I am having a problem with PHP and mysql I have copied a script exactly off a website to open the database and insert a new user I try to access the mysql database using the root user, and enter information into the user table, this is the PHP I am using ? include 'library/config.php'; include 'library/opendb.php'; +ACQ-query = INSERT INTO user (host, user, password, select+AF8-priv, insert+AF8-priv, update+AF8- priv) . VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y'); mysql+AF8-query(+ACQ-query) or die('Error, insert query failed'); +ACQ-query = FLUSH PRIVILEGES; mysql+AF8-query(+ACQ-query) or die('Error, insert query failed'); include 'library/closedb.php'; ? When I try this I get the access for user root+AEA-local host denied, it is driving me nuts no matter what I try I get the same thing other scripts I have tried do the same thing, have tried messing around with the config.php and opendb.php included scripts but nothing works if I run php -f opendb.php I get no errors which I think means it is working, then again I don't know. Anyone have any ideas ?? Thanks in advance Visit our websites: http://www.dailysnack.com +IBw-bite size news and gossip+IB0- http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk +ACMAIwAj-2004+ACMAIwAj- +AF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8- Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers +AF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8- The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. +ACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACo- +ACMAIw-EXN2000+ACMAIw- -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP and mysql
Yes. Whenever you have a problem, go back to basics. Can you login as root on the commandline? What password do you use there? Once you're there, check root's permissions, but I'd be willing to bet your password is incorrect, or root is only allowed to logon from localhost and not the machine the webserver is on. -Sheeri On 10/25/05, Alastair Roy [EMAIL PROTECTED] wrote: Greetings everyone, I am having a problem with PHP and mysql I have copied a script exactly off a website to open the database and insert a new user I try to access the mysql database using the root user, and enter information into the user table, this is the PHP I am using ? include 'library/config.php'; include 'library/opendb.php'; $query = INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) . VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y'); mysql_query($query) or die('Error, insert query failed'); $query = FLUSH PRIVILEGES; mysql_query($query) or die('Error, insert query failed'); include 'library/closedb.php'; ? When I try this I get the access for user [EMAIL PROTECTED] host denied, it is driving me nuts no matter what I try I get the same thing other scripts I have tried do the same thing, have tried messing around with the config.php and opendb.php included scripts but nothing works if I run php -f opendb.php I get no errors which I think means it is working, then again I don't know. Anyone have any ideas ?? Thanks in advance Visit our websites: http://www.dailysnack.com +IBw-bite size news and gossip+IB0 http://www.express.co.uk The Worlds Greatest Newspaper http://www.dailystar.co.uk Simply The Best 7 Days A Week http://www.happymagazine.co.uk The One Stop Shopping Magazine http://www.ok.co.uk First For Celebrity News http://www.northernandshell.co.uk The Mark Of Excellence http://www.expresspictures.com Express Newspapers and OK Magazine online picture archive Also visit: The NMA: Opening Up Newspapers http://www.nmauk.co.uk ###2004### Any views or opinions are solely those of the author and do not necessarily represent those of Express Newspapers The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.If you are not the intended recipient of this message please do not read ,copy, use or disclose this communication and notify the sender immediately. It should be noted that any review, retransmission, dissemination or other use of, or taking action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. E-mail communications may be monitored. ##EXN2000## -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP and mysql
Alastair Roy wrote: Greetings everyone, I am having a problem with PHP and mysql I have copied a script exactly off a website to open the database and insert a new user I try to access the mysql database using the root user, and enter information into the user table, this is the PHP I am using ? include 'library/config.php'; include 'library/opendb.php'; you can't issue a query until you've defined your connection. Is that done in one of the above include files? We need to see your connection code (don't show us the password, of course) if we are to help troubleshoot this. $query = INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) . VALUES ('localhost', 'phpcake', PASSWORD('mypass'), 'Y', 'Y', 'Y'); mysql_query($query) or die('Error, insert query failed'); Error, insert query failed isn't very helpful. You need to print the mysql error if you want to know what went wrong. $query = FLUSH PRIVILEGES; mysql_query($query) or die('Error, insert query failed'); Same here, except this is even worse, as it's the same message as before for a different query. How will you tell which statement didn't work? include 'library/closedb.php'; ? When I try this I get the access for user [EMAIL PROTECTED] host denied, it is Perhaps that's just a typo, but it should be '[EMAIL PROTECTED]', not '[EMAIL PROTECTED] host'. driving me nuts no matter what I try I get the same thing other scripts I have tried do the same thing, have tried messing around with the config.php and opendb.php included scripts but nothing works if I run php -f opendb.php I get no errors which I think means it is working, then again I don't know. Anyone have any ideas ?? First, from what I can see, you don't know what's wrong because you don't print the errors when something goes wrong. Of course, that means we can't tell you either. I recommend following Example 1 in the PHP manual http://www.php.net/manual/en/ref.mysql.php#mysql.examples, but I'd add that you should actually print the query string in addition to the error. That way, you can verify the query is actually what you intended. Something like this: $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password') or die('Could not connect: ' . mysql_error()); echo 'Connected successfully'; $query = 'SELECT * FROM my_table'; $result = mysql_query($query) or die(Query: $query failed: . mysql_error()); Then, if you still need help, copy and paste the exact error message into your next post. Second, you really should use GRANT to add a user and set privileges rather than directly editing the user table. It's safer (for example, your INSERT will fail if [EMAIL PROTECTED] already exists, but the equivalent GRANT statement would still work), and you don't need FLUSH PRIVILEGES. You appear to be trying to grant global SELECT, INSERT, and UPDATE privs to [EMAIL PROTECTED] In that case, your two queries can be replaced by this one: $query = GRANT SELECT, INSERT, UPDATE ON *.* TO [EMAIL PROTECTED] IDENTIFIED BY 'mypass' See the manual for details of using GRANT (and REVOKE) to manage users http://dev.mysql.com/doc/refman/5.0/en/grant.html. Michael -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP/MyphpAdmin/MySql
There is likely an rpm package for the php mysql module. Install that, or compile php with mysql support. P --Original Message-- From: Kamal Ahmed To: mysql Cc: Kamal Ahmed Sent: Mar 9, 2005 3:58 PM Subject: PHP/MyphpAdmin/MySql Dear MySql List experts, I have the following installed on redhat 9: [EMAIL PROTECTED] html]#php -v PHP 4.3.10 (cgi) (built: Mar 8 2005 17:52:13) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies - [EMAIL PROTECTED] html]# rpm -q mysql-server mysql-server-3.23.58-1.9 [EMAIL PROTECTED] html]# - [EMAIL PROTECTED] html]#rpm -q httpd httpd-2.0.40-21.5 --- [EMAIL PROTECTED] html]#rpm -q php php-4.2.2-17 - , but when trying to setup MyPhpAdmin, I get an error: cannot load mysql extension, please check PHP Configuration Documentation How can I resolve this ? Thanks, -Kamal. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] - Sent from my NYPL BlackBerry Handheld. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: php and mysql
Have you tried posting this to the PHP general mailing list? Respectfully, Ligaya Turmelle --- Life is a game... so have fun. --- www.PHPCommunity.org Open Source, Open Community Visit for more information or to join the movement Fernando F. Retagi wrote: Hi All! I have installed mysql 4.0.20 (went fine, I can connect), apache_1.3.31 (went fine, I can launch the web server) now I have installed php-4.3.9 and when I configure it using ./configure --with-mysql=/usr/local/mysql it goes fine , but when I try to use make, I got an error: checking for mysql_close.. Please can you help? Regards Fernando Retagi Cornastone Mozambique Lda Tel. +258 1 311700/06 e-mail: [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP and MySQL
On Fri, 26 Nov 2004 05:44:00 +0100, Danesh Daroui [EMAIL PROTECTED] said: Hi all, I have installed MySQL Server 4.1.7 on a Linux Fedora Core 3 machine. It works great locally and remotely. This machine also supposed to act as a web server by using Apache 2.0.52 and it works fine too. Apache is enhanced with PHP and they works together perfect. The only problem is with using MySQL through PHP. What version of PHP are you running? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: PHP and MySQL
snip When I run this little PHP script I always get fail error message: /[EMAIL PROTECTED](localhost, root, myrootpass); if (!$link_id) { echo Failed !; exit; } */ Should I change something in php.ini ? / snip Try removing the '@' from the mysql_pconnect statement to get a more descriptive error message. Regards, David Bevan GetAnyIdeas Web Design P. 416.452.9410 F. 416.570.4529 E. [EMAIL PROTECTED] W. http://www.getanyideas.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: [PHP-DB] mysql limit
Moved from a PHP list to a MySQL list. :-) On 06/30/2004 09:55 PM John W. Holmes spoke: Bob Lockie wrote: If I select rows with a limit clause I need to know if there are more rows than the limit. Either do a SELECT COUNT(*) prior to your LIMIT query to see how many total rows there are, or use SQL_CALC_FOUND_ROWS and FOUND_ROWS() (more info here: http://dev.mysql.com/doc/mysql/en/Information_functions.html) Is found_rows standard SQL? I want to easily portable code. Maybe I should use a select count first. :-) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: [PHP-DB] mysql limit
If I want 20 rows to display, I ask for 21. If I get 21, I know to ask for another page. Bob Lockie wrote: Moved from a PHP list to a MySQL list. :-) On 06/30/2004 09:55 PM John W. Holmes spoke: Bob Lockie wrote: If I select rows with a limit clause I need to know if there are more rows than the limit. Either do a SELECT COUNT(*) prior to your LIMIT query to see how many total rows there are, or use SQL_CALC_FOUND_ROWS and FOUND_ROWS() (more info here: http://dev.mysql.com/doc/mysql/en/Information_functions.html) Is found_rows standard SQL? I want to easily portable code. Maybe I should use a select count first. :-) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: php to mysql
venkata ramana wrote: Hi, I don't know whether I can ask this question on this mailing list or not, but I want to know how the php communicates with mysql, when it is on the localhost. Does it use unix domain sockets or it uses TCP sockets only? Any help or pointers in this regard will be of great help for me. Thanks, ramana. if you don't specify a hostname it uses unix sockets. $dbh=mysql_connect() or die(mysql_error()); # uses unix sockets you can prove it by changing mysql.default_socket=/tmp/mysql.sock to something wrong in your php.ini and then watching it fail when you connect. -jsd- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP and Mysql
go to www.codewalkers.com under the tutorials/basics section there is a tutorial called Sorting Database Results with PHP. It will show you how to display the data. If you are just looking for a quick cheat - You need to use tables. Place each record on a table row TR and each attribute in a table data TD. Respectfully, Ligaya Turmelle Seena Blace [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Does any one help me in formating the output result in PHP with mysql? The code is here. form action=hostrep.php method=get /form ? $username=root; $password=; $database=databasename; $host=localhost; $today = date(F j, Y, g:i a); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( Unable to select database); #echo Connected successfully; #$softwareid=$_GET['softwareid']; #$softwareid1=$_GET['softwareid1']; $query=SELECT hostid,hostname,cabinetnumber FROM host; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo bcenterHost Details $today/center/bbrbr; $i=0; while ($i $num) { $hostid=mysql_result($result,$i,hostid); $hostname=mysql_result($result,$i,hostname); $cabinetnumber=mysql_result($result,$i,cabinetnumber); echo b$hostid $hostname $cabinetnumber brbr; //echo b$softwareid $manufacturer/bbrname: $namebrVersion: $versionbrhrbr; Thanks - Do you Yahoo!? Yahoo! Search - Find what you're looking for faster. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP AND MYSQL
This is probably something for the php list, however, how is REGISTER_GLOBALS set on your server? On or off? It is off by default on newer version of PHP. (has been for a while.) If it is off you need to grab the vars from post like: $softwareid = $_POST[softwareid]; $manufacturer = $_POST[manufacture]; etc, etc... Plus...are you able to connect to the db server? Use: mysql_connectd($host, $username, $password); -- Jason On Mon, 2004-02-02 at 16:07, Seena Blace wrote: Hi, Does any one develop any web pages with PHP,Apache,Win2k,Mysql ? If so,can please help me. When I 'm inserting data thru html FORM ,getting error Notice: Undefined variable: like this.Can some one please send some tips pl? Html code: form action=insert.php method=post Software id: input type=text name=softwareid Manufacturer: input type=text name=manufacturer Name: input type=text name=name Version: input type=text name=version input type=Submit /form ? PHP code ? $database=testdatabase; mysql_connect(localhost); @mysql_select_db($database) or die( Unable to select database); $query = INSERT INTO software1 VALUES ('','$softwareid','$manufacturer','$name','$version'); mysql_query($query); mysql_close(); ? Let me know what is wrong pl. thx -seena - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP AND MYSQL
Seena, I believe that the proper syntax is --- mysql_connect( host, username,password) Also I generrally when passing variables use $_POST['name'] --- $_POST['version'] Good luck, Nestor :-) Seena Blace wrote: Hi, Does any one develop any web pages with PHP,Apache,Win2k,Mysql ? If so,can please help me. When I 'm inserting data thru html FORM ,getting error Notice: Undefined variable: like this.Can some one please send some tips pl? Html code: form action=insert.php method=post Software id: input type=text name=softwareid Manufacturer: input type=text name=manufacturer Name: input type=text name=name Version: input type=text name=version input type=Submit /form ? PHP code ? $database=testdatabase; mysql_connect(localhost); @mysql_select_db($database) or die( Unable to select database); $query = INSERT INTO software1 VALUES ('','$softwareid','$manufacturer','$name','$version'); mysql_query($query); mysql_close(); ? Let me know what is wrong pl. thx -seena - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: PHP AND MYSQL
PHP has changed their superglobals, no longer can you just put a $ infront of the assigned name attribute. (You can change this in the php.ini file, but it's discouraged) Instead use $_GET['name'] Or $_POST['name'] So for $manufacturer $_POST['manufacturer'] -Original Message- From: Seena Blace [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 4:08 PM To: [EMAIL PROTECTED] Subject: PHP AND MYSQL Hi, Does any one develop any web pages with PHP,Apache,Win2k,Mysql ? If so,can please help me. When I 'm inserting data thru html FORM ,getting error Notice: Undefined variable: like this.Can some one please send some tips pl? Html code: form action=insert.php method=post Software id: input type=text name=softwareid Manufacturer: input type=text name=manufacturer Name: input type=text name=name Version: input type=text name=version input type=Submit /form ? PHP code ? $database=testdatabase; mysql_connect(localhost); @mysql_select_db($database) or die( Unable to select database); $query = INSERT INTO software1 VALUES ('','$softwareid','$manufacturer','$name','$version'); mysql_query($query); mysql_close(); ? Let me know what is wrong pl. thx -seena - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP AND MYSQL
Thank you very much to all. Jason Burfield [EMAIL PROTECTED] wrote:This is probably something for the php list, however, how is REGISTER_GLOBALS set on your server? On or off? It is off by default on newer version of PHP. (has been for a while.) If it is off you need to grab the vars from post like: $softwareid = $_POST[softwareid]; $manufacturer = $_POST[manufacture]; etc, etc... Plus...are you able to connect to the db server? Use: mysql_connectd($host, $username, $password); -- Jason On Mon, 2004-02-02 at 16:07, Seena Blace wrote: Hi, Does any one develop any web pages with PHP,Apache,Win2k,Mysql ? If so,can please help me. When I 'm inserting data thru html FORM ,getting error Notice: Undefined variable: like this.Can some one please send some tips pl? Html code: Software id: [input] Manufacturer: [input] Name: [input] Version: [input] [input] PHP code $database=testdatabase; mysql_connect(localhost); @mysql_select_db($database) or die( Unable to select database); $query = INSERT INTO software1 VALUES ('','$softwareid','$manufacturer','$name','$version'); mysql_query($query); mysql_close(); ? Let me know what is wrong pl. thx -seena - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
Re: php and mysql
Go to http://www.rpmfind.com and search for php-mysql It should give you a list of packages. So, to use PHP with MySQL you need to install a package with a name like php-mysql-**.rpm Hope this helps Thanks Emery - Original Message - From: gamalt tant [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, September 28, 2003 03:48 Subject: php and mysql hi i want to use php with mysql. However, i do not know if i should install another package from mysql that incluse shared library between php and mysql?. i already installed mysql client and server package. if there more package i should install,can you please tell the name and where can i find it? redhat8.0 mysql 4.0.15 thanks __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: php and mysql
You need to install a package. Unless you install PHP from source and include MySQL at Compile time. If you install PHP from a RPM package, you will need to install a package called php-mysql-.rpm Thanks Emery - Original Message - From: Adam Clauss [EMAIL PROTECTED] To: 'gamalt tant' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, September 28, 2003 04:49 Subject: RE: php and mysql There shouldn't be anything else required (besides PHP). PHP has built in functions to access MySQL. See: http://www.php.net/manual/en/ref.mysql.php Adam Clauss [EMAIL PROTECTED] -Original Message- From: gamalt tant [mailto:[EMAIL PROTECTED] Sent: Saturday, September 27, 2003 8:48 PM To: [EMAIL PROTECTED] Subject: php and mysql hi i want to use php with mysql. However, i do not know if i should install another package from mysql that incluse shared library between php and mysql?. i already installed mysql client and server package. if there more package i should install,can you please tell the name and where can i find it? redhat8.0 mysql 4.0.15 thanks __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql? [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: php and mysql
There shouldn't be anything else required (besides PHP). PHP has built in functions to access MySQL. See: http://www.php.net/manual/en/ref.mysql.php Adam Clauss [EMAIL PROTECTED] -Original Message- From: gamalt tant [mailto:[EMAIL PROTECTED] Sent: Saturday, September 27, 2003 8:48 PM To: [EMAIL PROTECTED] Subject: php and mysql hi i want to use php with mysql. However, i do not know if i should install another package from mysql that incluse shared library between php and mysql?. i already installed mysql client and server package. if there more package i should install,can you please tell the name and where can i find it? redhat8.0 mysql 4.0.15 thanks __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql? [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: PHP Search + MySQL Query
Did you ORed or ANDed the LIKE clauses? Please provide the combined statement that didn't return results, the one with more than one LIKE clauses. Lian Sebe, M.Sc. Freelance Analyst-Programmer www.programEz.net -Original Message- From: Brown, Chris [mailto:[EMAIL PROTECTED] Sent: Saturday, August 30, 2003 1:28 PM To: [EMAIL PROTECTED] Subject: PHP Search + MySQL Query Hi all, In learning PHP and expanding my (seriously limited) SQL knowledge, I need to write a query that will look for one or more (can be any number) of the following fields held in the table: +---+-+ | Field | Type| +---+-+ | id| int(6) | | svc | varchar(20) | | sev | tinyint(1) | | dsc | varchar(60) | | inits | varchar(20) | | dst | date| | tst | time| | den | date| | ten | time| | res | tinyint(1) | +---+-+ I was attempting this using a SELECT command, a WHERE clause, and lots of LIKE statements. If search criteria had been entered, the LIKE statement went along the lines of LIKE('%criteria%'), and if it was empty, was left with a LIKE('%'). Yes, it's tragic SQL (one day they may send me on a proper SQL course...) and naturally, it doesn't work. The result given is Empty Set, even if I only put in one part of search criteria, and if I run a manual SELECT id,dsc FROM problems WHERE $field LIKE('%this_criteria_exists%'); it works fine. I went back and made the query up manually field by field, one field at a time, adding each LIKE statement in query after query, and found that after field DSC it failed, with the empty set result. Can anyone point me into the direction of a) Why it fails and b) A proper query that'll make this work?? All help very gratefully received. Many thanks in advance -- Chris Brown e: ckb@:nospam:.maxnet.eu.org, m: removed Never argue with an idiot, he'll just lower you to his level and beat you with experience... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP Search + MySQL Query
Brown, Chris wrote: +---+-+ Field | Type| +---+-+ id| int(6) | svc | varchar(20) | sev | tinyint(1) | dsc | varchar(60) | inits | varchar(20) | dst | date| tst | time| den | date| ten | time| res | tinyint(1) | +---+-+ I went back and made the query up manually field by field, one field at a time, adding each LIKE statement in query after query, and found that after field DSC it failed, with the empty set result. Can anyone point me into the direction of a) Why it fails and b) A proper query that'll make this work?? If you allways want to LIKE a field, declare it NOT NULL DEFAULT '': LIKE '%' on an empty string is TRUE, on a NULL (aka non-existant) it is FALSE. BTW, no need to optimize '%%' to '%' create table test ( id int , text1 char(9) not null default '', text2 char(9) not null default '', text3 char(9) not null default '', ); insert test ( id, text1, text2, text3 ) values ( 1 , 'a', 'b', 'c' ),( 2 , 'aa', 'bb', '' ); insert test ( id, text1, text2 ) values ( 3 , '', ''); select * from test where text1 like '%' AND text2 like '%%' AND text3 like '%'; HansH -- The evil powers of NULL ... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP creating mysql extensions?
We recently installed php and Mandrake 9. Php is no recognizing any of the mysql statements. On a working php installation the two extensions mysql.so and gd.so are in the /usr/lib/php/extensions directory. How does php create this directory for mysql. By unchecking the two extensions in the php.ini file or recompiling php. Any help would be appreciated. Damon Doran -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP before mysql on a mac?
Open a terminal/console Window and type: mysql If You got an error message You have to follow these steps: su mysql_install_db chown -R mysql.mysql /var/mysql chmod 577 /var/mysql then go in the Application/Utility folder and launch the MySqlMonitor Click on Launch at startup. I followed these step with Mac OS X Server (10.2.3). Santino -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: PHP before mysql on a mac?
Here's a couple of links that should help. PHPMac http://www.phpmac.com/ has an article about turning on PHP in Apache. MySQL on Mac OS X http://developer.apple.com/internet/macosx/osdb.html PHP on Mac OS X http://developer.apple.com/internet/macosx/php.html Even though OS X comes with Apache and PHP installed, for some reason Apache is not configured to handle PHP by default (at least in Jaguar). You have to make changes to your httpd.conf file. jeff At 9:23 -0800 3/24/03, katherine bjork wrote: My test.php page recognizes the potential for mysql but something went wrong when I first tried to install mysql so I removed mysql and am about to attempt a re-install. I've a couple of books on hand, neither of which addresses MAC OSX which is unix based. OSX comes with apache and php pre-installed but the books I read state that mysql must be installed before php unless php expects it to be installed in a specific location and it is thus installed in said location. I'm a complete novice on all accounts once I install Mysql, how do I get php to see it? Katherine -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Jeff Shapiro, Colorado Springs, CO, USA At work I *have* to use a Windows machine, at home I *get* to use a Mac. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: [PHP] Re: PHP and MySQL bug
@mysql_select_db(be); // this doesn't fail, because only the second (UPDATE) query fails. The first query (SELECT) is done! - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Nuno Lopes [EMAIL PROTECTED] Cc: MySQL List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 5:06 PM Subject: Re: [PHP] Re: PHP and MySQL bug @mysql_select_db(be); -- this failed do echo mysql_error(); to see what went wrong Nuno Lopes wrote: I done a echo of Mysql_error and it returned: 'Nenhum banco de dados foi selecionado' (I have the mysql server in portuguese, but the translation is something like 'no db was selected') - Original Message - From: David Freeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 10:29 PM Subject: RE: [PHP] Re: PHP and MySQL bug @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id'); if (isset($qid) mysql_affected_rows() == 1) { echo query executed; } else { echo query failed: . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Re: PHP and MySQL bug
Doesn't you have any simpler answer?? Maybe installing the new version of mysql server - I have version 3.23.49 - should do the trick - Original Message - From: Larry Brown [EMAIL PROTECTED] To: Nuno Lopes [EMAIL PROTECTED]; MySQL List [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 4:12 PM Subject: RE: [PHP] Re: PHP and MySQL bug Since nobody is jumping in to say it is some simple configuration/setting personally my next step would be to shut down all services on the box that aren't absolutely necessary and stop everything in the registry under run and stop anything in the start folder of the start menu and run the same tests. If no positive results I would uninstall php completely and clean any reference in the registry of it and then install with everything still shut down. Retest, if no progress do the same with mysql. These are radical and time-consuming methods, but it seems as though it is broken. If you absolutely need this fixed fast you might resort to paying the developers to give you a solution, although it may end up being what I just listed, or it could be some simple fix that we aren't aware of. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 4:31 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP and MySQL bug I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Re: PHP and MySQL bug
I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: [PHP] Re: PHP and MySQL bug
Since nobody is jumping in to say it is some simple configuration/setting personally my next step would be to shut down all services on the box that aren't absolutely necessary and stop everything in the registry under run and stop anything in the start folder of the start menu and run the same tests. If no positive results I would uninstall php completely and clean any reference in the registry of it and then install with everything still shut down. Retest, if no progress do the same with mysql. These are radical and time-consuming methods, but it seems as though it is broken. If you absolutely need this fixed fast you might resort to paying the developers to give you a solution, although it may end up being what I just listed, or it could be some simple fix that we aren't aware of. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 4:31 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP and MySQL bug I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Re: PHP and MySQL bug
@mysql_select_db(be); -- this failed do echo mysql_error(); to see what went wrong Nuno Lopes wrote: I done a echo of Mysql_error and it returned: 'Nenhum banco de dados foi selecionado' (I have the mysql server in portuguese, but the translation is something like 'no db was selected') - Original Message - From: David Freeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 10:29 PM Subject: RE: [PHP] Re: PHP and MySQL bug @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id'); if (isset($qid) mysql_affected_rows() == 1) { echo query executed; } else { echo query failed: . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: [PHP] Re: PHP and MySQL bug
* Try add to /etc/hosts the name and ip of DB is located I'm using Windows 2000. In Windows2000 make the same changes in winnt/system32/drivers/etc/hosts. If it connects the first time and every time thereafter that you recreate the connection it should not be anything to do with resolving the name of the computer with the db. If the db is on a system other than the one with the web server than you should check the network/network cards for errors. The connection may be dropping because of communication. If it is on the same box then some other memory resident program etc may be causing the connection to drop. Refer to my previous post in re. to stopping services etc. * MySQL * Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Re: PHP and MySQL bug
I'm using Windows 2000. - Original Message - From: Cleber [EMAIL PROTECTED] To: Nuno Lopes [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 10:23 AM Subject: Re: [PHP] Re: PHP and MySQL bug Try add to /etc/hosts the name and ip of DB is located - Original Message - From: Nuno Lopes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 7:31 AM Subject: Re: [PHP] Re: PHP and MySQL bug I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: [PHP] Re: PHP and MySQL bug
Then go to c:\winnt\system32\drivers\etc and make the changes in the hosts file that you will find there. -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 1:25 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP and MySQL bug I'm using Windows 2000. - Original Message - From: Cleber [EMAIL PROTECTED] To: Nuno Lopes [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 10:23 AM Subject: Re: [PHP] Re: PHP and MySQL bug Try add to /etc/hosts the name and ip of DB is located - Original Message - From: Nuno Lopes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 7:31 AM Subject: Re: [PHP] Re: PHP and MySQL bug I have the latest version of PHP (4.3.0) as module in apache 2.0.43 and mysql 3.23.49. Everything is working fine, except this. With pconnect the error is the same! - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Monday, January 06, 2003 6:28 PM Subject: RE: [PHP] Re: PHP and MySQL bug This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: [PHP] Re: PHP and MySQL bug
This definitely sounds like a buggy installation or there may be some problem with the communication between the web server and the mysqld. Is the db on a different machine? Try using mysql_pconnect instead of connect just to see what result you get. I have read some unfavorable statements about using pconnect with a large number of hits so if it works you should read the comments about it on php.net. Do a search for mysql_pconnect. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 1:09 PM To: MySQL List; [EMAIL PROTECTED] Subject: [PHP] Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Re: PHP and MySQL bug
I done a echo of Mysql_error and it returned: 'Nenhum banco de dados foi selecionado' (I have the mysql server in portuguese, but the translation is something like 'no db was selected') - Original Message - From: David Freeman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 10:29 PM Subject: RE: [PHP] Re: PHP and MySQL bug @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work Personally, I'd call it bad programming practice to do a database update and not check to see if it worked or not. In this case, how are you determining that the query did not work? Are you manually checking the database? You don't have anything in your code to check the status of this query. Perhaps this might get you somewhere: $qid = @mysql_query(UPDATE d SET h = '$h' WHERE id = '$id'); if (isset($qid) mysql_affected_rows() == 1) { echo query executed; } else { echo query failed: . mysql_error(); } At least this way you might get some indication of where the problem is. CYA, Dave - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL bug
The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL bug
It would be helpful if you posted that error. You can get it by changing the die to $queryr = mysql_query($query) or die(mysql_error()); Without knowing the error, you problem will be harder for everyone to debug. -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 10:09 AM To: MySQL List; [EMAIL PROTECTED] Subject: Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: Larry Brown [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug Try replacing the following line... @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work With... $query = UPDATE d SET h='$h' WERE id='$id'; $queryr = mysql_query($query) or die(The sql statement does not execute); if(mysql_affected_rows() !== 1) { die(The sql statement is successfully run however either h did not change or there is an internal error. Try executing the sql from the command line to make sure it otherwise works.); } and see which is coming back. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL bug
Here is the source code: ? @MYSQL_CONNECT(localhost, nlopes, testing) or die(Erro 1); @mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); if (mysql_num_rows($r)==0) { die (Erro); } else { $re=mysql_fetch_array($r, MYSQL_NUM); $nome=$re[0]; $url=$re[1]; $mirrors=$re[2]; $h=$re[3]; $h++; @MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); // this query doesn't work echo h2Seleccione a localização para o download:/h2pa href=\$url\Localização Principal/a/p; if ($mirrors) { echo pnbsp;/ph2Mirrors/h2p; $m=explode(»,$mirrors); foreach ($m as $v) { $m2=explode(!,$v); echo a href=\$m2[1]\$m2[0]/abr; } echo /ppNota: Deve escolher o mirror mais próximo da sua localização, para acelerar o dowload. No caso de um mirror estar indisponível, utilize outro./p; } } @MYSQL_CLOSE(); ?/body/html - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL bug
I'd like to try and see if I can find the problem as I write with PHP for MySQL quite a bit. However, without the specifics of how the script is running as is, I can't tell where the problem is. Write a quick script in complete detail that does what your post is doing and I'll look for anything. Right now I have to assume certain steps are being made. If they are than I don't have a solution but I'd rather go with what you are actually doing than go by my assumptions. By all means hide the names of the innocent and continue with a,b,c but just don't do ... Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 04, 2003 5:46 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: PHP and MySQL bug Dear Sirs, I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). In one of my files I have the following: MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work! But if I close the connection and open another te query is done:*/ MYSQL_CLOSE(); MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. I hope you solve this, Nuno Lopes - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL bug
Nuno, $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work!*/ It doesn't work because of the /* Some code including ... */ part ;-) First thing, I would check if $h and $id really are what you expect them to be, like: $sql = UPDATE d SET h='$h' WHERE id='$id'; echo $sql; MYSQL_QUERY($sql); If this part is okay, then the problem lies within this myterious /* Some code */. Regards, -- Stefan Hinz [EMAIL PROTECTED] Geschäftsführer / CEO iConnect GmbH http://iConnect.de Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 - Original Message - From: Nuno Lopes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, January 04, 2003 11:46 AM Subject: PHP and MySQL bug Dear Sirs, I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). In one of my files I have the following: MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work! But if I close the connection and open another te query is done:*/ MYSQL_CLOSE(); MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. I hope you solve this, Nuno Lopes - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] PHP + MySQL, how to get total rows matched when using LIMIT 0, 10?
I'm trying to get the total matched rows when I'm using LIMIT 0, 10, but I only get the number 10, when the total should be around 100. So, can I get total matched rows without doing a separate query using count()? Here is an example of my current query: $result = mysql_query(SELECT * FROM products WHERE price'10' ORDER BY price LIMIT 0, 10); $num_rows = mysql_num_rows($result); Use two queries unless you are using MySQL 4.0+ FOUND_ROWS() Returns the number of rows that the last SELECT SQL_CALC_FOUND_ROWS ... command would have returned, if wasn't restricted with LIMIT. mysql SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id 100 LIMIT 10; mysql SELECT FOUND_ROWS(); The second SELECT will return a number indicating how many rows the first SELECT would have returned had it been written without the LIMIT clause. Note that if you are using SELECT SQL_CALC_FOUND_ROWS ... MySQL has to calculate all rows in the result set. However, this is faster than if you would not use LIMIT, as the result set need not be sent to the client. SQL_CALC_FOUND_ROWS is available starting at MySQL version 4.0.0. ---John Holmes... - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Encrypted MySQL passwords
http://www.stunnel.org/examples/mysql.html SK mysql, sql, query On Thursday, September 26, 2002, at 12:40 PM, John Holmes wrote: I am connecting to a mysql server on a remote machine, and opened up port 3306 for this purpose. But, I am concerned about sending a clear text password, via the mysql_pconnect() call. My question is, what is the procedure for connecting to a remote server with an encrypted password? Or, does mysql_pconnect handle this? Nope, it's all in the clear. MySQL 4.0 has support for doing this over SSL, I think. ---John Holmes... - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Encrypted MySQL passwords
Steven Kreuzer wrote: http://www.stunnel.org/examples/mysql.html SK mysql, sql, query On Thursday, September 26, 2002, at 12:40 PM, John Holmes wrote: I am connecting to a mysql server on a remote machine, and opened up port 3306 for this purpose. But, I am concerned about sending a clear text password, via the mysql_pconnect() call. My question is, what is the procedure for connecting to a remote server with an encrypted password? Or, does mysql_pconnect handle this? Nope, it's all in the clear. MySQL 4.0 has support for doing this over SSL, I think. Actually, the password is never sent, in-the-clear or otherwise with MySQL. It's a challenge-response scheme based on a token the server gives the client on connect, and a hash of that token together with the password is sent back to the server. Only if both parties know the password, is the hash correct, and authentication is successful. In no case does the password actually travel over the wire. -Mark -- For technical support contracts, visit https://order.mysql.com/?ref=mmma __ ___ ___ __ / |/ /_ __/ __/ __ \/ / Mark Matthews [EMAIL PROTECTED] / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java /_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA ___/ www.mysql.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: [PHP] Encrypted MySQL passwords
I am connecting to a mysql server on a remote machine, and opened up port 3306 for this purpose. But, I am concerned about sending a clear text password, via the mysql_pconnect() call. My question is, what is the procedure for connecting to a remote server with an encrypted password? Or, does mysql_pconnect handle this? Nope, it's all in the clear. MySQL 4.0 has support for doing this over SSL, I think. ---John Holmes... - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: [PHP] Encrypted MySQL passwords
Maybe you could somehow setup your SSH tunnel before-hand (at server start up or something) and use that instead. Adam Voigt [EMAIL PROTECTED] On Thu, 2002-09-26 at 12:40, John Holmes wrote: I am connecting to a mysql server on a remote machine, and opened up port 3306 for this purpose. But, I am concerned about sending a clear text password, via the mysql_pconnect() call. My question is, what is the procedure for connecting to a remote server with an encrypted password? Or, does mysql_pconnect handle this? Nope, it's all in the clear. MySQL 4.0 has support for doing this over SSL, I think. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Encrypted MySQL passwords
You can try stunnel for forcing the connection through ssl. Works with most tcp applications transparently. On Thursday, September 26, 2002, at 12:40 PM, John Holmes wrote: I am connecting to a mysql server on a remote machine, and opened up port 3306 for this purpose. But, I am concerned about sending a clear text password, via the mysql_pconnect() call. My question is, what is the procedure for connecting to a remote server with an encrypted password? Or, does mysql_pconnect handle this? Nope, it's all in the clear. MySQL 4.0 has support for doing this over SSL, I think. ---John Holmes... - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php Chris Hedemark Professional Computer Consulting Videography Hillsborough, NC http://yonderway.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Encrypted MySQL passwords
There are common one-way encryption, like md5, this is commonly what I do, I encrypt with md5 when I insert the password into my database on the DB server, and then I encrypt with PHP on the Web server side, so therefore, I am only ever sending my md5 encrypted password over the wire. Since it is the same every time it is like doing string compares on the same encrypted value so it authenticates, of course this is also the vulnerability of md5. I suppose that with cracking software and time, someone could get it, but it also might be better then sending it in the clear. -Brad Adam Voigt wrote: Maybe you could somehow setup your SSH tunnel before-hand (at server start up or something) and use that instead. Adam Voigt [EMAIL PROTECTED] On Thu, 2002-09-26 at 12:40, John Holmes wrote: I am connecting to a mysql server on a remote machine, and opened up port 3306 for this purpose. But, I am concerned about sending a clear text password, via the mysql_pconnect() call. My question is, what is the procedure for connecting to a remote server with an encrypted password? Or, does mysql_pconnect handle this? Nope, it's all in the clear. MySQL 4.0 has support for doing this over SSL, I think. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: php +newlines+mysql
adi, Monday, July 08, 2002, 10:05:56 AM, you wrote: a I have a problem in php page: a i want to insert into mysql database value $string with newlines: a $string=-line1\n -line2 \n-line3; a $result2 = db_query(update table1 set column1= '$string' where ID = a '$IDcurent') or db_die(); a When i try to view in a textarea control the new value from column1, the a newlines a disappear! a ps.column 1 have type text or varchar(100) a Is a problem of type? You should escape some chars: http://www.mysql.com/doc/S/t/String_syntax.html Take a look at php functions: mysql_escape_string(), mysql_real_escape_string(), addslashes() -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: php+apache+mysql installation. Help
Do I need to uninstall the old Apache before installing the newer version? How do I uninstall the old Apache in linux? Do I just use the package manager to remove the package? What does make do? I don't know how linux work. Please advise. Thanks. From: Andrew Lietzow [EMAIL PROTECTED] To: Andy Cheng [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: php+apache+mysql installation. Help! Date: Thu, 23 May 2002 21:34:37 -0500 Dear Andy, Here's a thought. Before you go much further, install Apache 2.0.36. It's easy to install and lots of improvements will be gained that you'll appreciate down the road, i.e. mod_ssl is preconfigured into the system. Andrew Lietzow The ACL Group, Inc. On Thursday 23 May 2002 06:33 pm, you wrote: Hi, I am new to linux and trying to install Apache, php and mysql on my Redhat 7.2.Linux box. When I run the configure for PHP 4.2.1, I got this error: checking whether build environment is sane..configure error:newly created file is older than distributed files! I have Apache 1.3.20 (from RH 7.2) and Mysql 3.23.49a installed on my box. Would appreciated if some one could advise how to install PHP. Thanks P.S. I have start Mysql manually. How do I make it auto start and shutdown? _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Andrew Lietzow The ACL Group, Inc. 515-274-0300 v/f 515-710-1955 c _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: php+apache+mysql installation. Help!
Dear Andy, Here's a thought. Before you go much further, install Apache 2.0.36. It's easy to install and lots of improvements will be gained that you'll appreciate down the road, i.e. mod_ssl is preconfigured into the system. Andrew Lietzow The ACL Group, Inc. On Thursday 23 May 2002 06:33 pm, you wrote: Hi, I am new to linux and trying to install Apache, php and mysql on my Redhat 7.2.Linux box. When I run the configure for PHP 4.2.1, I got this error: checking whether build environment is sane..configure error:newly created file is older than distributed files! I have Apache 1.3.20 (from RH 7.2) and Mysql 3.23.49a installed on my box. Would appreciated if some one could advise how to install PHP. Thanks P.S. I have start Mysql manually. How do I make it auto start and shutdown? _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Andrew Lietzow The ACL Group, Inc. 515-274-0300 v/f 515-710-1955 c - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL help please !
Hello, Try this ? function samp_db_connect() { $hostname = localhost; $username = joe; $password = user; $dbName = test; $link = @mysql_pconnect($hostname, $username, $password); if ($link mysql_select_db($dbName)) return $link; return FALSE; } samp_db_connect() or exit(); ? good luck Andrew Rich wrote: Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL help please !
Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL help please !
Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php + I think my PHP does not have mysql included, although I put in the ./configure --with mysql=/usr/local/mysql \ + When I type which mysql it says /usr/bin/msql + So should I put:- ./configure --with-mysql=/usr/local/mysql OR ./configure --with-mysql=/usr/bin/mysql ? I am not sure if the include statement is design to add mysql BINARIES or SOURCE CODE ?? Lost. Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:28 AM To: Andrew Rich; [EMAIL PROTECTED] Subject: RE: PHP and MySQL help please ! Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL help please !
I am not sure if the include statement is design to add mysql BINARIES or SOURCE CODE ?? Neither. It's eventually going to link the final php binary with the mysql shared libraries (probably libmysqlclient). I'm not too familiar with PHP, so I don't know if '--with-mysql=' wants the location of the MySQL root directory (typically /usr/local/mysql for source installations) or the directory that contains the libraries (like above, but /usr/local/mysql/lib). Check to see if /usr/local/mysql exists first. Better yet, try this: find /usr -name libmysqlclient* Hopefully, it will show you the location of one (or more) MySQL client libraries. Start there. Michael On Thu, 25 Apr 2002, Andrew Rich wrote: Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php + I think my PHP does not have mysql included, although I put in the ./configure --with mysql=/usr/local/mysql \ + When I type which mysql it says /usr/bin/msql + So should I put:- ./configure --with-mysql=/usr/local/mysql OR ./configure --with-mysql=/usr/bin/mysql ? I am not sure if the include statement is design to add mysql BINARIES or SOURCE CODE ?? Lost. Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:28 AM To: Andrew Rich; [EMAIL PROTECTED] Subject: RE: PHP and MySQL help please ! Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- /*-- * It might look like I'm doing nothing, but at the cellular level * I'm really quite busy. * ---anonymous * * * -BEGIN GEEK CODE BLOCK- * Version: 3.1 * GCS/P/H/L/O d- s-:-- a26 C++(+++) UL+++$ P++ L+++ !E W+++ N- o? K- * w--(---) !O M+ !V PS+ PE- Y-- PGP- t+ 5-(--) X(-) R* tv b+ DI-- D-- G e+++ * h+ r* y-- * --END GEEK CODE BLOCK-- --*/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http
Re: [PHP-DB] MYSQL query help
It's not the IN, it's the sub-query you cannot use. MySQL doesn't support them and it's just about the main reason I don't like it. Alternatives? You could execute your subquery and return the results to an array. Loop through the array, using the index and the indexed element to drive a series of queries, accumulating your results as you go. If the number of items return by the subquery is not large, you could build an in set, for lack of a better term, so you would end up with ... and IN (first, second, ...nth) . (Check syntax!!) But that's likely to be slower than cold molasses and run like a pig. If you're not too far into the project, and you will have a lot of subqueries, switch to PostgreSQL or a database that supports them. I don't really have an answer. I hope someone comes up with a more elegant solution. Regards - Miles Thompson At 09:34 AM 12/14/2001 -0500, Harpreet wrote: I dont think we can use 'IN' and 'NOT IN' in mysql. Is there an alternative that would work? select * from lib_asset_tbl where material_id '' and asset_id in (select asset_id from lib_copy_tbl) Help is appreciated. Regards, Harpreet Kaur Software Developer Crispin Corporations Inc. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Re: MySQL ORDER BY or PHP Sort? Oops.
René, I want to select about 25 rows from a table, and sort them by two criteria. First, by each row's Series field (Baby, Genesis, Super, Predator, Millennium are the various Series, and the order I'd like the rows in the array). Within each Series, I'd like the rows sorted by their Price field, ascending. For example: Baby $5 Baby $10 Baby $15 Genesis $20 Genesis $35 Genesis $50 ...and so on. Now, I know how to structure my MySQL Select statment such that the rows it pulls from the table will be either sorted by Price OR by Series, but not both, in the way I'd like. Does anyone know if it's possibly to do this in the Select statement itself? (I'd rather do it that way, than resort in PHP.) The problem is, if I sort by the price field, the ordering of the series gets mixed up (since low-end models in higher-end series cost more than some higher-end models in lower-end series (confused?? I am :-) If I just sort by series, I don't get the prices in order within each series (big problem). And if I sort by BOTH series and price, which is the logical thing to do, and which many people have kindly suggested (and which I have tried), well, it doesn't work, because the series must be sorted in a non-alphabetical way. I've looked at PHP's myriad sorting functions, and well--maybe I need more sun (I live in Canada... winter...)--I can't see a 'simple' way to do a non-numerical, non-alphabetical (user-defined?) sort on the Series fields, then subsort each series by price. can you have another field in your table(s) for a weighting and then sort on that? otherwise you'll have to use php You know, in spite of all the good advice I've received, I think that's what I'll have to do. I say have to because inserting another field into the table creates some complications (long story... related to the web admin tool I made for editing the tables). Actually, come to think of it, there is an existing field that I could reuse for this purpose. Yes, that will work! =Did you manage to solve this? There is a way to accomplish what you want, without this resorting to an extra field or PHP (providing the range of values in the Series field is manageable). SELECT SERIES , PRICE , FIELD( SERIES, Baby, Genesis, Super, Predator, Millennium ) as PRIORITY FROM TblNm ORDER BY PRIORITY, PRICE NB not having access to your db I haven't properly tested this code, nor was I quite clear from your example/text about the relative importance of PRIORITY and PRICE in the sequencing, so please experiment/test. Regards, =dn - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] Re: MySQL ORDER BY or PHP Sort? Oops.
You know, in spite of all the good advice I've received, I think that's what I'll have to do. I say have to because inserting another field into the table creates some complications (long story... related to the web admin tool I made for editing the tables). Actually, come to think of it, there is an existing field that I could reuse for this purpose. Yes, that will work! Thanks everyone! ...Rene On Monday, December 3, 2001, at 06:49 PM, Martin Towell wrote: can you have another field in your table(s) for a weighting and then sort on that? otherwise you'll have to use php -Original Message- From: René Fournier [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 12:16 PM To: Benjamin Pflugmann; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Re: MySQL ORDER BY or PHP Sort? Oops. From: René Fournier [EMAIL PROTECTED] Date: Mon Dec 03, 2001 06:11:23 PM US/Mountain To: Benjamin Pflugmann [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] [EMAIL PROTECTED] Subject: Re: MySQL ORDER BY or PHP Sort? Oops. Here is the snippet of code that is presenting a challenge: --- ?php // FETCH MODELS TECH SPECS function models ($lang,$db) { $modelsheader = mysql_fetch_array(mysql_query(SELECT * FROM models WHERE lang='$lang' AND key1='header',$db)); $result = mysql_query(SELECT * FROM models WHERE key1='data' ORDER BY price ASC,$db); mysql_close(); include ('../common/models.inc'); } models($lang,$db); // CREATE A MULTI-DIMENSIONAL MODELS ARRAYS BASED ON THE NUMBER OF MODEL ROWS IN THE TABLE $i = 0; do { $allmodels[$i] = $models; $i++; } while ($models = mysql_fetch_array($result)); // NUMBER OF MODELS $first = 1; $last = sizeof($allmodels)-1; $colspan = ($last * 2)+1; ? --- The problem is, if I sort by the price field, the ordering of the series gets mixed up (since low-end models in higher-end series cost more than some higher-end models in lower-end series (confused?? I am :-) If I just sort by series, I don't get the prices in order within each series (big problem). And if I sort by BOTH series and price, which is the logical thing to do, and which many people have kindly suggested (and which I have tried), well, it doesn't work, because the series must be sorted in a non-alphabetical way. I've looked at PHP's myriad sorting functions, and well--maybe I need more sun (I live in Canada... winter...)--I can't see a 'simple' way to do a non-numerical, non-alphabetical (user-defined?) sort on the Series fields, then subsort each series by price. Many thanks for all the help, fellas. ...Rene On Monday, December 3, 2001, at 05:31 PM, Benjamin Pflugmann wrote: Hi. Because you said, Rene, that you already know how to sort according to one of both criteria, I presume ordering the series column is not the problem (e.g. because it is an enum or something alike). Then the solution would simply be to do something like SELECT * FROM my_table WHERE ... ORDER BY series, price I.e. simply list the order criteria which work seperately in the ORDER BY clause. If this is not appliable, please elaborate. Btw, it is *much* easier to help if you had quoted a (partial) working query (which include table and column names and so on). Also, how the series are stored would have been of interest, because this will influence how the ordering is specified. Also, I do not understand why you put emphasis on the fact that the series is sorted in an unusual way if you later say that you already know how to order by it?! Is this relevant to the problem at all? Bye, Benjamin. On Tue, Dec 04, 2001 at 12:36:34AM +0200, [EMAIL PROTECTED] wrote: Well I think mysql doesnt allow you to do this that simple as mysql doesnt know how you want to sort it exactly. So my suggestion would be to give a value to each series, eg. Baby = 1, Genesis=2,Super=3,Predator=4,Millennium=5 and then order by series. Cheers Siim Einfeldt One more thing, very important: I want to specify the Series sort order, not alphabetically, but by a non-obvious way (BabyGenesisSuperPredatorMillennium)... -- I want to select about 25 rows from a table, and sort them by two criteria. First, by each row's Series field (Baby, Genesis, Super, Predator, Millennium are the various Series, and the order I'd like the rows in the array). Within each Series, I'd like the rows sorted by their Price field, ascending. For example: Baby $5 Baby $10 Baby $15 Genesis $20 Genesis $35 Genesis $50 ...and so on. Now, I know how to structure my MySQL Select statment such that the rows it pulls from the table will be either sorted by Price OR by Series, but not both, in the way I'd like. Does anyone know if it's possibly to do this in the Select statement itself? (I'd rather do it that way, than resort in PHP.) Thanks
Re: PHP and MySQL 4.0.0
Hi! Sebastian == Sebastian Bergmann [EMAIL PROTECTED] writes: Sebastian Michael Widenius wrote: The symbol 'mysql_module_entry' doesn't come from the MySQL library, so this is a PHP problem. Sebastian Okay. Note that you can use MySQL 4.0 with the old MySQL 3.23 library without any problems. Sebastian Yes, it works fine if I use the libmysql that is bundled with PHP. Only Sebastian when I ./configure --with-mysql=/usr/local/mysql and link PHP against Sebastian the MySQL 4.0.0 library this problem occurs. The problem could be that some structs has changed between MySQL 3.23 and 4.0; To get 4.0 to works, you need to recompile all object files that uses the libmysql library to use the 4.0 include headers. Could you try to recompile the mysql-php module with the 4.0 header files and check if this helps ? Regards, Monty - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL 4.0.0
Michael Widenius wrote: The symbol 'mysql_module_entry' doesn't come from the MySQL library, so this is a PHP problem. Okay. Note that you can use MySQL 4.0 with the old MySQL 3.23 library without any problems. Yes, it works fine if I use the libmysql that is bundled with PHP. Only when I ./configure --with-mysql=/usr/local/mysql and link PHP against the MySQL 4.0.0 library this problem occurs. -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and Mysql problem
-Original Message- From: Neil Silvester [mailto:[EMAIL PROTECTED]] Sent: Thursday, 20 September 2001 08:12 To: [EMAIL PROTECTED] Subject: PHP and Mysql problem I am having a little problem with a PHP 4 statement in one of my webpages. I am using a drop down box of selections that is built a table in a MySQL database. This is what I have so far (everything works well, the correct information is displayed for both the Category and ID column values. select name=Product optionPlease select a category.../option ?php // display entries in the selection box and // associate the column ID of each entry while ($row = mysql_fetch_array($result)) { echo(option value= . $row[ID] . . $row[Category] . echo(option value=\ . $row[ID] . \ . $row[Category] . or echo(option value=' . $row[ID] . ' . $row[Category] . I'm not sure if using single quotes is to the HTML specs though. /option); } ? /select Unfortunately this causes the HTML code to b OPTION value=1Product Category 1/OPTION when I need it to be OPTION value=1Product Category 1/OPTION Can anyone recommend another approach so that the quotation marks are generated around the ID value that is returned? TIA - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and Mysql problem
echo ('option value=' . $row[ID] . '' . $row[Category] . '/option'); You might be able to escape the with / or the like but I'm not great at php, yet. ;) - Original Message - From: Neil Silvester [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 19, 2001 5:42 PM Subject: PHP and Mysql problem I am having a little problem with a PHP 4 statement in one of my webpages. I am using a drop down box of selections that is built a table in a MySQL database. This is what I have so far (everything works well, the correct information is displayed for both the Category and ID column values. select name=Product optionPlease select a category.../option ?php // display entries in the selection box and // associate the column ID of each entry while ($row = mysql_fetch_array($result)) { echo(option value= . $row[ID] . . $row[Category] . /option); } ? /select Unfortunately this causes the HTML code to b OPTION value=1Product Category 1/OPTION when I need it to be OPTION value=1Product Category 1/OPTION Can anyone recommend another approach so that the quotation marks are generated around the ID value that is returned? TIA _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and Mysql problem
On 19-Sep-2001 Neil Silvester wrote: I am having a little problem with a PHP 4 statement in one of my webpages. I am using a drop down box of selections that is built a table in a MySQL database. This is what I have so far (everything works well, the correct information is displayed for both the Category and ID column values. select name=Product optionPlease select a category.../option ?php // display entries in the selection box and // associate the column ID of each entry while ($row = mysql_fetch_array($result)) { echo(option value= . $row[ID] . . $row[Category] . /option); printf('option value=%s%s/option', $row[ID], $row[Category]); Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [PHP] PHP MySQL
At 12:30 PM 7/20/01 -0400, you wrote: on 7/20/01 12:32 PM, Erich Kolb at [EMAIL PROTECTED] wrote: When you query a MySQL Database, how do you set the order alphabetically? If it's a text field just say DESC Susan isn't that reverse alphabetical ASC is (default) alphabetical John Meyer [EMAIL PROTECTED] Programmer If we didn't have Microsoft, we'd have to blame ourselves for all of our programs crashing - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and Mysql
Well, it's difficult to tell but I would say it would be your SQL statement but since you didn't provide us with that... shrug - Original Message - From: Kevin Smith [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 17:40 Subject: PHP and Mysql Hi All, Has anyone ever had this problem when using PHP 4.06 and MySQL 3.23.39 running on Apache 1.3.20 on Windows 2000 Professional SP!? br bWarning/b: Supplied argument is not a valid MySQL result resource in bd:\program files\apache group\apache\www.lemonlaineydesign.com\www\top_frame.php/b on line b68/bbr And here is the line in my HTML... any ideas what might be wrong? This works on my Unix box with no problems... while ($results = mysql_fetch_array($sth)) { Thanks, Kevin Smith Netsmith Limited - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and Mysql
Hit the nail on the head... infact, the problem wasn't the query itself, it was the way in which I imported the tables and data from a Unix platform to my Windows platform that caused the problems... sorry. Many thanks for you help, as it made me look at running the query as you suggested which caused me to realise the database wasn't able to be read by Windows. :) Thanks, Kevin - Original Message - From: Jason Burfield [EMAIL PROTECTED] To: Kevin Smith [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 4:15 PM Subject: Re: PHP and Mysql Kevin... This means that your result set is empty. Try running the query on the command line and see if you get a result. If you do, check the syntax in your code. If you don't, that's the problem. -- Jason On 7/8/01 5:40 AM, Kevin Smith was heard saying: Hi All, Has anyone ever had this problem when using PHP 4.06 and MySQL 3.23.39 running on Apache 1.3.20 on Windows 2000 Professional SP!? br bWarning/b: Supplied argument is not a valid MySQL result resource in bd:\program files\apache group\apache\www.lemonlaineydesign.com\www\top_frame.php/b on line b68/bbr And here is the line in my HTML... any ideas what might be wrong? This works on my Unix box with no problems... while ($results = mysql_fetch_array($sth)) { Thanks, Kevin Smith Netsmith Limited - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and Mysql
On Sun, 8 Jul 2001 19:10, Kevin Smith wrote: Hi All, Has anyone ever had this problem when using PHP 4.06 and MySQL 3.23.39 running on Apache 1.3.20 on Windows 2000 Professional SP!? br bWarning/b: Supplied argument is not a valid MySQL result resource in bd:\program files\apache group\apache\www.lemonlaineydesign.com\www\top_frame.php/b on line b68/bbr And here is the line in my HTML... any ideas what might be wrong? This works on my Unix box with no problems... while ($results = mysql_fetch_array($sth)) { Thanks, Kevin Smith Netsmith Limited Use mysql_error() after your database call to get any error messages that mysql returns. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA The guy who writes all those bumper stickers HATES New York. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and mysql and images
Why would you want to do that? That's what filesystems are for. Can any one tell me how place images in to a mysql database and then retrieve them later? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and mysql and images
This topic has been covered many times - check the PHP-General mailing list archives (http://marc.theaimsgroup.com/?l=php-general) --zak - Original Message - From: Kevin Pratt [EMAIL PROTECTED] To: Mysql List [EMAIL PROTECTED] Sent: Friday, June 15, 2001 12:25 PM Subject: PHP and mysql and images Can any one tell me how place images in to a mysql database and then retrieve them later? Thanks Kevin - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and mysql and images
Is there a particular reason why you want the images in a mysql database. It would be faster if you put that path to the images in a table then the actual images. Mat - Original Message - From: Kevin Pratt [EMAIL PROTECTED] To: Mysql List [EMAIL PROTECTED] Sent: Friday, June 15, 2001 12:25 PM Subject: PHP and mysql and images Can any one tell me how place images in to a mysql database and then retrieve them later? Thanks Kevin - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL result set navigation
If you want to repeatedly loop through a result set in PHP, you can use mysql_data_seek($result, 0); to reset the pointer to the first row. See http://www.php.net/manual/en/function.mysql-data-seek.php -steve At 9:33 AM +0800 6/4/01, Rolf Hopkins wrote: Yep, that's the way you do it. Put it into a 2D array or even better, a class. That's if you are familiar with OOP. - Original Message - From: Marco Bleeker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 04, 2001 6:57 Subject: PHP and MySQL result set navigation I do something like this, where $result is the result of a mysql_query(): ?php while ($row = mysql_fetch_array($result)) { if ($row[col] == 1) { print_entry($row); } } ? This is to fill one column on screen. Now I would like to do the same for the second column: if ($row[col] == 2). But the $result pointer has moved to the end. How to move it back to the start again? reset() won't work, because it's not an array, just an integer pointing to a MySQL result set. How to move through this result set using PHP? Or should I just run a seperate query for each column with a 'where col =' clause? That looks like pretty intensive use of computer resources... I could also turn the result set into a 2D array of rows and work with that. Sounds a bit voluminous as well... Thanks, marco | | Marco Bleeker, Amsterdam | [EMAIL PROTECTED] | http://www.euronet.nl/users/mbleeker/ | | Attachments only after prior notice please. | Don't put me on any kind of mailing list. | | I am now receiving the Snowhite virus 4x a day | - some of you must be infected, please check ! | (No, you did not get it from me, I use Eudora) | __@ | _`\,_ |__(*)/ (*)Ah, op DIE fiets ! -- +--- So long, and thanks for all the fish - -+ | Steve Edberg University of California, Davis | | [EMAIL PROTECTED] Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +--- Douglas Adams 1952 - 11 may 2001 ---+ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL result set navigation
Yep, that's the way you do it. Put it into a 2D array or even better, a class. That's if you are familiar with OOP. - Original Message - From: Marco Bleeker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 04, 2001 6:57 Subject: PHP and MySQL result set navigation I do something like this, where $result is the result of a mysql_query(): ?php while ($row = mysql_fetch_array($result)) { if ($row[col] == 1) { print_entry($row); } } ? This is to fill one column on screen. Now I would like to do the same for the second column: if ($row[col] == 2). But the $result pointer has moved to the end. How to move it back to the start again? reset() won't work, because it's not an array, just an integer pointing to a MySQL result set. How to move through this result set using PHP? Or should I just run a seperate query for each column with a 'where col =' clause? That looks like pretty intensive use of computer resources... I could also turn the result set into a 2D array of rows and work with that. Sounds a bit voluminous as well... Thanks, marco | | Marco Bleeker, Amsterdam | [EMAIL PROTECTED] | http://www.euronet.nl/users/mbleeker/ | | Attachments only after prior notice please. | Don't put me on any kind of mailing list. | | I am now receiving the Snowhite virus 4x a day | - some of you must be infected, please check ! | (No, you did not get it from me, I use Eudora) | __@ | _`\,_ |__(*)/ (*)Ah, op DIE fiets ! - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL
I had this same problem. I could connect via the mysql client if I was ROOT, but not otherwise. You may have a permissions problem. Ensure that /var, /var/lib, and /var/lib/mysql are set to: drwxr-xr-x That cured it for me. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 09, 2001 12:18 PM To: [EMAIL PROTECTED] Subject: PHP and MySQL I wanna access to a DB via php but when I run it in a navigator y get the following message Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /home/httpd/html/challa.php on line 10 Unable to connect to database I can get connected to the DB without problem with the mysql client but I can't via web... what the heck is wrong? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL - still got problem
I think that my file permissions are set OK. Heres a list of my MySQL folder... total 1652 drwx--6 mysql27 4096 Mar 1 11:37 . drwxr-xr-x 20 root root 4096 Feb 15 16:26 .. -rw---1 mysql27244 Feb 26 16:56 .bash_history drwx--2 mysqlroot 4096 Feb 26 15:48 .xauth drwx--2 mysqlmysql4096 Feb 28 16:32 BEN -rw-r--r--1 mysqlmysql 1 Mar 1 10:28 chiefwigham.fubra.err -rw-r--r--1 mysqlmysql8628 Feb 26 15:07 chiefwigham.fubra.err.old -rw-rw1 mysqlmysql 3 Mar 1 10:06 chiefwigham.fubra.pid -rw-rw1 mysqlmysql 322 Feb 26 14:15 chiefwigham.log -rw---1 mysqlmysql 0 Feb 26 16:12 columns_priv.MYD -rw---1 mysqlmysql1024 Feb 26 16:12 columns_priv.MYI -rw---1 mysqlmysql8778 Feb 26 16:12 columns_priv.frm -rw---1 mysqlmysql 302 Feb 26 16:12 db.MYD -rw---1 mysqlmysql3072 Feb 26 16:12 db.MYI -rw---1 mysqlmysql8982 Feb 26 16:12 db.frm -rw---1 mysqlmysql 0 Feb 26 16:12 func.MYD -rw---1 mysqlmysql1024 Feb 26 16:12 func.MYI -rw---1 mysqlmysql8641 Feb 26 16:12 func.frm -rw---1 mysqlmysql 0 Feb 26 16:12 host.MYD -rw---1 mysqlmysql1024 Feb 26 16:12 host.MYI -rw---1 mysqlmysql8958 Feb 26 16:12 host.frm -rw-r--r--1 root root0 Mar 1 11:37 list.txt drwx--2 mysqlmysql4096 Feb 28 14:26 mysql srwxrwxrwx1 mysqlmysql 0 Mar 1 10:06 mysql.sock -rwxr-xr-x1 mysqlmysql 1524536 Feb 19 13:56 mysqld -rw---1 mysqlmysql 0 Feb 26 16:12 tables_priv.MYD -rw---1 mysqlmysql1024 Feb 26 16:12 tables_priv.MYI -rw---1 mysqlmysql8877 Feb 26 16:12 tables_priv.frm drwx--2 mysqlmysql4096 Feb 28 16:13 test -rw---1 mysqlmysql 428 Feb 26 16:12 user.MYD -rw---1 mysqlmysql2048 Feb 26 16:12 user.MYI -rw---1 mysqlmysql9148 Feb 26 16:12 user.frm Thanks Ben K Ireneusz Piasecki wrote: - Original Message - From: "Ben Kennish" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 01, 2001 11:55 AM Subject: PHP and MySQL Who would've thought it would take 3 days to install MySQL, PHP and get them talking???!! I've installed PHP 4.0.4pl1 using an RPM from www.redhat.com I've also installed MySQL (latest ver) server and client versions from www.mysql.com using RPMs. Now MySQL seems to be up and working (using 'mysql' and 'mysqladmin' gives me no trouble) and PHP seems to work fine ?php phpinfo(); ?. I've installed the PHP-MySQL module from redhat.com (a single file - mysql.so) and uncommented the "extension=mysql.so" line in /etc/php.ini But when I type ... mysql_connect('localhost', 'root', 'b'); This can be that: mysql_connect('serwer_name','root','b' ); where serwer_name is serwer, that serve mysql databases or you can chmod file mysql.sock than other can it write (it could help) into a PHP file, (I set b as my root SQL pwd) I get the following error... "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /var/www/html/index.php on line 5" There seems to be nothing in the MySQL error log. Please help! Thanks, -- Ben Kennish Software Developer Fubra Limited web | www.fubra.net email | [EMAIL PROTECTED] phone | +44 (0)870 1222 600 fax | +44 (0)870 1222 699 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Ben Kennish Software Developer Fubra Limited web | www.fubra.net email | [EMAIL PROTECTED] phone | +44 (0)870 1222 600 fax | +44 (0)870 1222 699 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble
RE: PHP and MySQL
I had the same problem. Ensure the permissions for /var, /var/lib, and /var/lib/mysql are set to: drwxr-xr-x -Original Message- From: Ben Kennish [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 4:56 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL Who would've thought it would take 3 days to install MySQL, PHP and get them talking???!! I've installed PHP 4.0.4pl1 using an RPM from www.redhat.com I've also installed MySQL (latest ver) server and client versions from www.mysql.com using RPMs. Now MySQL seems to be up and working (using 'mysql' and 'mysqladmin' gives me no trouble) and PHP seems to work fine ?php phpinfo(); ?. I've installed the PHP-MySQL module from redhat.com (a single file - mysql.so) and uncommented the "extension=mysql.so" line in /etc/php.ini But when I type ... mysql_connect('localhost', 'root', 'b'); into a PHP file, (I set b as my root SQL pwd) I get the following error... "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /var/www/html/index.php on line 5" There seems to be nothing in the MySQL error log. Please help! Thanks, -- Ben Kennish Software Developer Fubra Limited web | www.fubra.net email | [EMAIL PROTECTED] phone | +44 (0)870 1222 600 fax | +44 (0)870 1222 699 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL
Hi, I've installed MYSQL on Red hat. I'm trying to run the command mysqlaccess It asks for the Password for MySQL superuser root: Can anyone tell me the password for this? Thanks Sandeep - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL
Hi, I've installed MYSQL on Red hat. I'm trying to run the command mysqlaccess It asks for the Password for MySQL superuser root: Can anyone tell me the password for this? Thanks Sandeep mysqlaccess is a perl script to check the access priviliges of a user:db:host scenario. What you need is to run safe_mysql to get the daemon running and then mysql (which will not ask for a pass the 1st time) and set a password for root by yourself. best of luck, thalis p.s. alternatively to the above: read the first ~500 lines from the mysql manual - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and mysql
Hi, If you still have that space, I'd take it out. -Original Message- From: Chris Hallgren [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 28 February 2001 10:15 a.m. To: [EMAIL PROTECTED] Subject: PHP and mysql PHP and mysql dont work for some reason i installed both as directed with the rpm and it doesnt work for some reason i get the error MySQL said: Unknown database ' chrishallgren' has anyone see this error with php and mysql or should i be posting to a php list it seems that php likes to use the select function instead of the use - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php The information contained in this email is privileged and confidential and intended for the addressee only. If you are not the intended recipient, you are asked to respect that confidentiality and not disclose, copy or make use of its contents. If received in error you are asked to destroy this email and contact the sender immediately. Your assistance is appreciated. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and mysql
Chris, I *strongly* suggest you read up on SQL. You simply don't know the difference between the most important commands :) There shouldn't be a space in your database (and it cannot either). Please also post what commands you're using to select your database etc. From what you show us here, we can't really help you much. btw; PHP doesn't care what SQL statements you use. It's MySQL that complains and demands the correct syntax.. :) Atle On Tue, 27 Feb 2001, Chris Hallgren wrote: PHP and mysql dont work for some reason i installed both as directed with the rpm and it doesnt work for some reason i get the error MySQL said: Unknown database ' chrishallgren' has anyone see this error with php and mysql or should i be posting to a php list it seems that php likes to use the select function instead of the use - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MYSQL Frustrations...
I can think of a couple of things. You have the wrong URL somewhere in your code, your web server isn't configured correctly or compiled PHP incorrectly. Either way, this does not relate to MySQL and you are much better off asking the PHP list. You may want to try accessing normal HTML pages through the webserver first. If you can't, then you have a web server configuration problem and your best off asking the appropriate list. Also, try running the query from mysql directly. If you get results then you have no problem on the mysql side of things. - Original Message - From: "Steve Rodda" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 14, 2001 13:03 Subject: PHP and MYSQL Frustrations... I don't understand will someone please look at this code and see what is wrong. ?php $dbglobal = mysql_connect('localhost', 'mylog', 'mypass'); mysql_select_db('test', $dbglobal); $query ="SELECT * FROM emails Where id 100"; $result = mysql_query($query); while(list($ID, $EMAIL) = mysql_fetch_row($result)) print("$ID EMAILbr\n"); ? All I want to do is display the results in HTML then I will be unstoppable :) But every time I execute this I get Warning: Failed opening 'c:\inetpub\wwwroot\testmail.php' for inclusion (include_path='') in Unknown on line 0 And no matter what I put in that like in php.ini I get that error. Please if it is obvious let me know other wise please give me some de bugging techniques I am new to both PHP and MYSQL. BTW other scripts run fine just in talking to MYSQL do I get this problem. Thanks in advance.. Steve - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL in red hat 7.0
I tried RedHat, but had the same problem getting apache and php and mysql to talk to each other. I decided to try Mandrake 7.2 and it did all the work for me. Murdmath - Original Message - From: "Luis" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 22, 2001 7:55 AM Subject: Re: PHP and MySQL in red hat 7.0 [EMAIL PROTECTED] wrote: Thanks Matt. MySQL is finally working. But the problem now is that PHP is not recognizing its MySQL functions. The error I am getting is: Fatal error: Call to undefined function: mysql_pconnect() in /var/www/html/Willy/MySQL/test1.php on line 28 Well, the php_mysql RPM has been installed along with mod_php4.rpm. PHP can recognize its own functions but not those of MySQL. I checked for the RPMs to be installed and I have installed all the php RPMs ( including php-mysql RPM). despite doing all that I get this error. MySQL is running perfect as I get the status when I type "mysqladmin -u=root status". Please help me. This is very urgent for me. Thank You. Willy -- From: Matt Wagner[SMTP:[EMAIL PROTECTED]] Sent: Friday, January 19, 2001 4:29 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: socket problem in red hat. [EMAIL PROTECTED] writes: Hi there, I am setting up a lab on MySQL and I am not able to. Its a red hat 7.0 server and has PHP installed and working with apache. I installed MySQL from the very RPMs Red Hat provided. Whenever I try to start the server, I get the error message: Can't connect to local MySQL server through socket '/var/lib/mysql/m ysql.sock' (111) Well the file /var/lib/mysql/mysql.sock exists on the computer. I can't understand what this socket problem is and I went through all documentation and couldn't find a solution to this. Can you please provide a solution to this at the earliest. I have students piling on my head and I have already skipped my deadline of setting the server up. Hi! We have seen this problem (although I have not personally investigated) with many RH7+default_mysql. The quick and easy solution (until I figure out further) is to download the MySQL RPMs from: http://www.mysql.com/downloads/mysql-3.23.html Uninstall the standard RedHat 7.0 MySQL RPMs, then reinstall ours. Like I said, I'm not sure what RedHat is doing wrong with their MySQL RPMs... But I have seen this numerous times with regard to their supplied RPMs. Something is amiss. I will investigate more. Regards, Matt -- __ ___ ___ __ / |/ /_ __/ __/ __ \/ / Matt Wagner [EMAIL PROTECTED] / /|_/ / // /\ \/ /_/ / /__ MySQL AB, http://www.mysql.com/ /_/ /_/\_, /___/\___\_\___/ River Falls, Wisconsin, USA ___/ Developer - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php I had the same problem with setting up php , mysql, and apache. I also notice that the rpm that redhat cd come with does not work . You have to download the tar or the rpm from the site. If you dont mind me asking, how did you set up the apache server to work with php plus if you find any doc on setting up php and mysql let me know. Thank you . Luis - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL combo
ps -ef|grep -c mysql Subtract 3 from this as this is the default number of daemons that start. One is spawned for each new child. Yes, if the php script terminates, the mysql child will also terminate. This is not the behaviour with persistant connections though. Please move this over to the php list as it does not have anything to do with mysql as such. Mike Yuen wrote: Is there anyway to tell how many connections are currently being served by MySQL. I'm using this in combination with PHP. Also, does MySQL automatically shut down when you leave the page? I'm not using mysql_pconnect - just the regular mysql_connect. Thanks, Mike - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: PHP and MySQL combo
Mike Yuen writes: Is there anyway to tell how many connections are currently being served by MySQL. I'm using this in combination with PHP. Also, does MySQL automatically shut down when you leave the page? I'm not using mysql_pconnect - just the regular mysql_connect. Hi! You are probably looking for 'SHOW STATUS': http://www.mysql.com/doc/S/H/SHOW_STATUS.html And yes, if you are NOT using mysql_pconnect, the connection to your mysqld is closed each time. The 'p' in 'mysql_pconnect' is for "persistant" which avoids this problem. :) Regards, Matt -- __ ___ ___ __ / |/ /_ __/ __/ __ \/ / Matt Wagner [EMAIL PROTECTED] / /|_/ / // /\ \/ /_/ / /__ MySQL AB, http://www.mysql.com/ /_/ /_/\_, /___/\___\_\___/ River Falls, Wisconsin, USA ___/ Developer - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php