RE: [PHP] Php with mysql
[snip] $sql = "SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name` = '$_POST['user_id']' AND '$_POST['user_id']' "; [/snip] echo $sql; //to see the query and check the syntax $sql = "SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name` = '" . $_POST['user_id'] . "' AND '" . $_POST['user_id'] . "' "; Your variables may not be parsed due to the single quotes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Php with mysql
(posted again with another syntax error corrected) This is a beginner's guide to SQL syntax, please review it http://www.webdevelopersnotes.com/tutorials/sql/mysql_guide_querying_mys ql_tables.php3?PHPSESSID=fb6c7c7a548b6a271a75d623ce04cc9c The answer to your question (which someone has already given in a previous reply to you) is SELECT `User_name` , (replaces AND) `User_pass` FROM `user` WHERE `User_name` = '$_POST['user_id']' AND (PASSWORD= ADDED HERE) PASSWORD='$_POST['user_id']' -Original Message- From: Rittwick Banerjee [mailto:[EMAIL PROTECTED] Sent: 23 May 2005 09:01 To: php-general@lists.php.net Subject: [PHP] Php with mysql Hi friends, I am Rittwick Banerjee Some one gave me an idea about that past php code that is : $sql = "SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name` = '$_POST['user_id']' AND '$_POST['user_id']' "; but I found that it still not working ... Plaese give me another code , by the way I am using Fedora 2(PCQ Linux 2004) Thank you.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com E&OE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com E&OE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Php with mysql
This is a beginner's guide to SQL syntax, please review it http://www.webdevelopersnotes.com/tutorials/sql/mysql_guide_querying_mys ql_tables.php3?PHPSESSID=fb6c7c7a548b6a271a75d623ce04cc9c The answer to your question (which someone has already given in a previous reply to you) is SELECT `User_name` , (replaces AND) `User_pass` FROM `user` WHERE `User_name` = '$_POST['user_id']' AND '$_POST['user_id']' -Original Message- From: Rittwick Banerjee [mailto:[EMAIL PROTECTED] Sent: 23 May 2005 09:01 To: php-general@lists.php.net Subject: [PHP] Php with mysql Hi friends, I am Rittwick Banerjee Some one gave me an idea about that past php code that is : $sql = "SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name` = '$_POST['user_id']' AND '$_POST['user_id']' "; but I found that it still not working ... Plaese give me another code , by the way I am using Fedora 2(PCQ Linux 2004) Thank you.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com E&OE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php with mysql ( support data manipulation or not )??
[snip] Regarding to php with mysql , if the php with mysql implement data manipulating like (insert , update , delete ..etc) or just implement the query operation only ??. [/snip] You can do any SQL operation with PHP and MySQL. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T
Hey, Thanks for replying. Nope, that didnt work, but i modified my search terms on google and kept on trying with different search terms and got the solution here: http://dbforums.com/arch/230/2002/11/623223 Cheers, -Ryan On 2/10/2004 3:14:21 AM, Shaunak Kashyap ([EMAIL PROTECTED]) wrote: > Try this: > > "SELECT COUNT(*), order_number FROM " . $prefix . > "_purchases GROUP BY > order_number" > > as your query. > > Shaunak > > - Original Message - > From: "Ryan A" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, February 09, 2004 8:36 PM > Subject: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T > > > > Hi, > > I have a table where a users details are entered for the products he > bought, > > the only part that is repeated is the order_id, > > I basically need to only get the order per person, and paginate for all > the > > customers > > > > eg: > > if user "tom" bought 3 items in the database it would be entered as: > > order_id item_name > > 023 soap > > 023 brush > > 023 towel > > > > So i am trying this: > > $num_rows = > mysql_result(mysql_query("SELECT COUNT(*), > > DISTINCT(order_number) FROM ". > $prefix."_purchases"),0); > > > > (the idea being taht $num_rows will give my paginating part of the > program > > the total number of -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T
Try this: "SELECT COUNT(*), order_number FROM " . $prefix . "_purchases GROUP BY order_number" as your query. Shaunak - Original Message - From: "Ryan A" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 09, 2004 8:36 PM Subject: [PHP] php with mysql COUNT, DISTINCT syntax, might be a bit 0T > Hi, > I have a table where a users details are entered for the products he bought, > the only part that is repeated is the order_id, > I basically need to only get the order per person, and paginate for all the > customers > > eg: > if user "tom" bought 3 items in the database it would be entered as: > order_id item_name > 023 soap > 023 brush > 023 towel > > So i am trying this: > $num_rows = mysql_result(mysql_query("SELECT COUNT(*), > DISTINCT(order_number) FROM ".$prefix."_purchases"),0); > > (the idea being taht $num_rows will give my paginating part of the program > the total number of records > that match my search.) > > > which gives me the most pretty error of: > Warning: mysql_result(): supplied argument is not a valid MySQL result > resource in \www\p\admin\show_purc.php on line 9 > > I''m pretty sure the problem is in my SQL statement, but have had no luck > searching and reading in the mysql manual for > "count" with "distinct" but am pretty sure it can be done as i have not > found anything saying the opposite...any ideas? > > Thanks, > -Ryan > > -- > 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
Re: [PHP] PHP with MySQL
Ok. Then the second message was even more idiotic. Damn! :) Bogdan Miguel Cruz wrote: >Your message? Actually you're right. I just noticed in the manual: > > The simple form user is a synonym for user@"%". > >miguel > >On Fri, 3 May 2002, Bogdan Stancescu wrote: > >>Um. Sorry. That was idiotic. >> >>Bogdan >> >>Bogdan Stancescu wrote: >> >>>You can simply grant username instead of username@machine. >>> >>>Bogdan >>> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with MySQL
Your message? Actually you're right. I just noticed in the manual: The simple form user is a synonym for user@"%". miguel On Fri, 3 May 2002, Bogdan Stancescu wrote: > Um. Sorry. That was idiotic. > > Bogdan > > Bogdan Stancescu wrote: > > > You can simply grant username instead of username@machine. > > > > Bogdan > > > > Paras Mukadam wrote: > > > >> Hi Gurus, > >> one MySQL - PHP query : while granting permissions to particular user in > >> MySQL, the administrator has to give username@machine_address !! Then > >> how > >> can we connect to MySQL through PHP only by passing "username" as one > >> of the > >> arguments to mysql_connect() ? > >> > >> Thanks. > >> Paras. > >> > >> > >> > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with MySQL
Um. Sorry. That was idiotic. Bogdan Bogdan Stancescu wrote: > You can simply grant username instead of username@machine. > > Bogdan > > Paras Mukadam wrote: > >> Hi Gurus, >> one MySQL - PHP query : while granting permissions to particular user in >> MySQL, the administrator has to give username@machine_address !! Then >> how >> can we connect to MySQL through PHP only by passing "username" as one >> of the >> arguments to mysql_connect() ? >> >> Thanks. >> Paras. >> >> >> > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with MySQL
On Thu, 2 May 2002, Paras Mukadam wrote: > one MySQL - PHP query : while granting permissions to particular user in > MySQL, the administrator has to give username@machine_address !! Then how > can we connect to MySQL through PHP only by passing "username" as one of the > arguments to mysql_connect() ? If the MySQL database is on the same machine as PHP, then grant access to 'username@localhost'. If you want to allow PHP (and other mysql client library programs) on all hosts to be able to connect, then grant access to 'username@"%"' (the % works as a wildcard). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with MySQL
You can simply grant username instead of username@machine. Bogdan Paras Mukadam wrote: >Hi Gurus, >one MySQL - PHP query : while granting permissions to particular user in >MySQL, the administrator has to give username@machine_address !! Then how >can we connect to MySQL through PHP only by passing "username" as one of the >arguments to mysql_connect() ? > >Thanks. >Paras. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP with MySQL
mysql_connect("host","username","password"); If there is no password, leave it blank. "host" is the name or IP address of the MySQL server. Set it to localhost if it's on the same machine as the script. ---John Holmes... > -Original Message- > From: Paras Mukadam [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 02, 2002 12:46 PM > To: [EMAIL PROTECTED] > Subject: [PHP] PHP with MySQL > > Hi Gurus, > one MySQL - PHP query : while granting permissions to particular user in > MySQL, the administrator has to give username@machine_address !! Then how > can we connect to MySQL through PHP only by passing "username" as one of > the > arguments to mysql_connect() ? > > Thanks. > Paras. > > > > -- > 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
Re: [PHP] PHP with MySQL doubt
You're done. Just add the port into your mysql_connect function. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Pablo Pasqualino <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Friday, March 02, 2001 9:43 PM Subject: [PHP] PHP with MySQL doubt > Hi > > I have an account on a hosting service provider. > > They have a server with a lot of clients... and there, each client has his own > Apache binary compiled with PHP 4. > > They also offer MySQL... but they only have ONE server for all their customers, > and so, they just offer one db to each one. > > I need to have a lot of different db, so I compiled my own MySQL on the server > > The General MySQL runs at port 3310 > I compiled my own MySQL to run at port 3311 > > I tried it with php, conecting to localhost:3311 and it works fine (with > phpMyAdmin)... > > Now, the question is: > Should I do something special with my Apache/php? > > I generally compile my PHP with the --with-mysql=/path/to/mysql > > But now I am using normally the preinstalled PHP on the server without > any problem... > > Should I recompile my php and tell to the ./configure script the path where my > own MySQL is? or it isn't necesary? > > Thanks! > > Pablo Pasqualino > Mar del Plata, Argentina > http://www.marplatense.com > > > > -- > PHP General 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] > -- PHP General 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]