[PHP-DB] PHP MySQL High CPU on Query
I have a situation where a query run from PHP/Zend Framework on a MySQL database seems to hit the CPU harder than the same query run via the MySQL command line. The query is a simple SELECT statement querying 2 tables, 12 columns with a short WHERE clause that filters the results to less than 100 records. ZF is using the PDO adapter. I've seen the query cause mysqld to show a spike up to 50+% cpu while the query is run from a PHP call, and the same query from the client barely nudges the process to 1%. Is there something I can do to gather more data on what's going on and why this is happening? I'd expect some overhead, but that much of a difference seems wrong. Thanks for your advice, David Christensen = This electronic mail is solely for the use of the intended recipient, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient – whether as addressed or as should reasonably be surmised by the reader – you are hereby notified that any dissemination, distribution or copying of this electronic mail or any attachment is strictly prohibited. If you have received this communication in error, please do not print, copy, retransmit, disseminate or otherwise use the information contained herein or attached hereto and notify us immediately by replying to the electronic mail address listed above. After notifying us, please delete the copy you received. Thank you. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] [PHP] mySQL query assistance...
On Mon, Nov 29, 2010 at 14:35, Don Wieland d...@dwdataconcepts.com wrote: Hi all, Is there a list/form to get some help on compiling mySQL queries? I am executing them via PHP, but do not want to ask for help here if it is no the appropriate forum. Thanks ;-) Yes. For MySQL queries, write to the MySQL General list at my...@lists.mysql.com. For PHP-specific database questions (for any database backend, not strictly MySQL), such as problems in connecting to the database, questions on support for database platform/version, or even query processing, you should use php...@lists.php.net. For your convenience, both have been CC'd on this email. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php mysql comparing two rows in two columns for username and passwort
Hello, i am writing a small login script for a website. The username and passwort are stored in a database in two separate columns. I have it like this: while($dbbenutzer = mysql_fetch_row($sqlbenutzername)) while($dbpasswort = mysql_fetch_row($sqlpasswort)){ echo $dbbenutzer[$i]; echo $dbpasswort[$j]; if($benutzername == $dbbenutzer and $pass == $dbpasswort){ echo 'pSie haben sich erfolgreich angemeldet/p'; echo 'a href=willkommen.htmlWillkommen/a'; } } } Sice the values are entries in rows in two columns, i use mysql_fetch_row to get the entries. Then i want to compare the returned values of the sql statement with the values provided by the user. My problem now is only get the first value pair of username and passwort, not the second. For instance the first value pair is moritz 123456 which i get returned but i dont get returned the second value pair thomas thorr. thank you yours sincerly Alexander Schunk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
Hi, Maybe try... $benutzername = $_GET['username']; $pass = $_GET['password']; $result = SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'; while($r = mysql_fetch_row($result)) { $dbbenutzer = $r[sqlbenutzername]; $dbpasswort = $r[sqlpasswort]; } if($benutzername == $dbbenutzer $pass == $dbpasswort){ echo 'pSie haben sich erfolgreich angemeldet/p'; echo 'a href=willkommen.htmlWillkommen/a'; Karl On Apr 29, 2010, at 7:25 AM, Alexander Schunk wrote: Hello, i am writing a small login script for a website. The username and passwort are stored in a database in two separate columns. I have it like this: while($dbbenutzer = mysql_fetch_row($sqlbenutzername)) while($dbpasswort = mysql_fetch_row($sqlpasswort)){ echo $dbbenutzer[$i]; echo $dbpasswort[$j]; if($benutzername == $dbbenutzer and $pass == $dbpasswort){ echo 'pSie haben sich erfolgreich angemeldet/p'; echo 'a href=willkommen.htmlWillkommen/a'; } } } Sice the values are entries in rows in two columns, i use mysql_fetch_row to get the entries. Then i want to compare the returned values of the sql statement with the values provided by the user. My problem now is only get the first value pair of username and passwort, not the second. For instance the first value pair is moritz 123456 which i get returned but i dont get returned the second value pair thomas thorr. thank you yours sincerly Alexander Schunk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
On 29 April 2010 15:00, Karl DeSaulniers k...@designdrumm.com wrote: Hi, Maybe try... $benutzername = $_GET['username']; $pass = $_GET['password']; $result = SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'; Don't use values from $_GET without sanitizing first. If using mysql_* functions, sanitize with mysql_real_escape_string() first. while($r = mysql_fetch_row($result)) { $dbbenutzer = $r[sqlbenutzername]; $dbpasswort = $r[sqlpasswort]; } if($benutzername == $dbbenutzer $pass == $dbpasswort){ This would work but only if you're storing passwords in the database in clear text - which is a Bad Thing and should be avoided. Hash the passwords before storing and compare with a hashed version, not the cleartext. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
Yes. You are correct. Did not include that part, sry. Dont forget mysql_real_escape_string. :) Karl On Apr 29, 2010, at 9:37 AM, Peter Lind wrote: On 29 April 2010 15:00, Karl DeSaulniers k...@designdrumm.com wrote: Hi, Maybe try... $benutzername = $_GET['username']; $pass = $_GET['password']; $result = SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'; Don't use values from $_GET without sanitizing first. If using mysql_* functions, sanitize with mysql_real_escape_string() first. while($r = mysql_fetch_row($result)) { $dbbenutzer = $r[sqlbenutzername]; $dbpasswort = $r[sqlpasswort]; } if($benutzername == $dbbenutzer $pass == $dbpasswort){ This would work but only if you're storing passwords in the database in clear text - which is a Bad Thing and should be avoided. Hash the passwords before storing and compare with a hashed version, not the cleartext. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort
On 29 April 2010 16:44, Alexander Schunk asch...@gmail.com wrote: Hello, i have it now as follows: while($dbbenutzer = mysql_fetch_assoc($sqlbenutzername)) while($dbpasswort = mysql_fetch_assoc($sqlpasswort)){ You have things very twisted. Check the code posted by Karl - you only need *ONE* row containing your *TWO* fields. mysql_fetch_assoc() retrieves that *ONE* row from a MySQL result set as an array - so having those two while statements will do you no good. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php mysql calendar
Hello list Can someone suggest me a php mysql calender, easy configurable for special needs? I found some googling but the most of them query records form a specific table and its impossible to change the sql query. Thank you in advance Nikos
Re: [PHP-DB] PHP- Mysql problem
Daniel, Now that is just funny stuff... Have you tried http://lmgtfy.com/?q=access+denied+for+user+odbc+localhost or the newer http://www.lmbify.com/search.php?s=access+denied+for+user+odbc+localhost Daniel Brown danbr...@php.net wrote in message news:ab5568160906180636r239f214eh7e4871da7139c...@mail.gmail.com... On Thu, Jun 18, 2009 at 06:03, NADARAJAH SIVASUTHAN NADARAJAHnsivasut...@live.com wrote: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 http://google.com/search?q=Access%20denied%20for%20user%20'ODBC'@'localhost'%20(using%20password:%20NO) http://fart.ly/dm6m7 -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP- Mysql problem
Dear all, When I try to retrive data from two tables using JOIN OR INNER JOIN it display error message given below; Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\ap_v5\inc\profile.inc.php on line 288 what may be the reason? Normally PHP-mysql works fine. Can you figure it out and give me the possible solution? Thank you. suthan _ Windows Live™: Keep your life in sync. Check it out! http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009
Re: [PHP-DB] PHP- Mysql problem
On Thu, Jun 18, 2009 at 6:03 AM, NADARAJAH SIVASUTHAN NADARAJAHnsivasut...@live.com wrote: Dear all, When I try to retrive data from two tables using JOIN OR INNER JOIN it display error message given below; Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\ap_v5\inc\profile.inc.php on line 288 what may be the reason? Normally PHP-mysql works fine. Can you figure it out and give me the possible solution? Thank you. suthan _ Windows Live™: Keep your life in sync. Check it out! http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009 The db user account that you are attempting the connection with does not have access to the db. Check the account details -- Bastien Cat, the other other white meat -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP- Mysql problem
On Thu, Jun 18, 2009 at 06:03, NADARAJAH SIVASUTHAN NADARAJAHnsivasut...@live.com wrote: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285 http://google.com/search?q=Access%20denied%20for%20user%20'ODBC'@'localhost'%20(using%20password:%20NO) http://fart.ly/dm6m7 -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP MySQL Driver Choice -- Fastest?
Which is the fastest driver for this? ADODB PDO mysqli Anything else? -- Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?
Micah Gersten wrote: Which is the fastest driver for this? ADODB PDO mysqli Either mysqli or pdo since they'd deal with the mysql client directly. ADODB is a php library, so it's not going to be as fast because you have php code overhead. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?
How does the default php_mysql.dll compare to these? Is mysqli faster than mysql? tia, Yves -- Original Message -- Received: Wed, 19 Nov 2008 04:00:46 PM CST From: Chris [EMAIL PROTECTED] To: Micah Gersten [EMAIL PROTECTED]Cc: PHP DB php-db@lists.php.net Subject: Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest? Micah Gersten wrote: Which is the fastest driver for this? ADODB PDO mysqli Either mysqli or pdo since they'd deal with the mysql client directly. ADODB is a php library, so it's not going to be as fast because you have php code overhead. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?
Chris wrote: Micah Gersten wrote: Which is the fastest driver for this? ADODB PDO mysqli Either mysqli or pdo since they'd deal with the mysql client directly. ADODB is a php library, so it's not going to be as fast because you have php code overhead. ADODB is precompiled for PHP5. Do you know of any tests? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?
Micah Gersten wrote: Chris wrote: Micah Gersten wrote: Which is the fastest driver for this? ADODB PDO mysqli Either mysqli or pdo since they'd deal with the mysql client directly. ADODB is a php library, so it's not going to be as fast because you have php code overhead. ADODB is precompiled for PHP5. Do you know of any tests? It's a dll or .so file? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?
YVES SUCAET wrote: How does the default php_mysql.dll compare to these? Is mysqli faster than mysql? I'd call that a native driver. No idea about mysqli vs mysql. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?
Chris wrote: Micah Gersten wrote: Chris wrote: Micah Gersten wrote: Which is the fastest driver for this? ADODB PDO mysqli Either mysqli or pdo since they'd deal with the mysql client directly. ADODB is a php library, so it's not going to be as fast because you have php code overhead. ADODB is precompiled for PHP5. Do you know of any tests? It's a dll or .so file? On Linux, it's an .so file, yes: http://packages.debian.org/lenny/i386/php5-adodb/filelist Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?
Micah Gersten wrote: Chris wrote: Micah Gersten wrote: Chris wrote: Micah Gersten wrote: Which is the fastest driver for this? ADODB PDO mysqli Either mysqli or pdo since they'd deal with the mysql client directly. ADODB is a php library, so it's not going to be as fast because you have php code overhead. ADODB is precompiled for PHP5. Do you know of any tests? It's a dll or .so file? On Linux, it's an .so file, yes: http://packages.debian.org/lenny/i386/php5-adodb/filelist Didn't know that :) Cool. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
I should've checked the assumption. A little strange though for a scripting language. I'd say, since default behaviour of mysql_* functions is to assume the last opened link when a parameter is not passed, and since default behaviour is to evaluate null, false and 0 the same, mysql_* functions should issue a warning when a not valid link is passed but still use the last opened link (in that logic, null should also generate a warning though). I'm guessing the reason is that mysql_connect returns false when it fails, but i can't see a reason why an undefined variable cannot be used. All that and I don't remember what it was for. On Fri, Jun 20, 2008 at 1:57 AM, Chris [EMAIL PROTECTED] wrote: [new code] if (!mysql_connect($a, $b, $c)) return; if (!mysql_select_db($dbname)) return; $res = mysql_query(SELECT * FROM manual;, $link); [/new code] Isn't going to work because $link is not defined and definitely not a resource like mysql_query expects. OR, optionally, to surpress the warnings: [new code] if (!mysql_connect($a, $b, $c)) return; $link = null; if (!mysql_select_db($dbname)) return; $res = mysql_query(SELECT * FROM manual;, $link); [/new code] Isn't going to work because mysql_query needs a resource to connect to. You've defined $link as null. $ cat test.php ?php $user = 'my_db_user'; $pass = 'my_pass'; $host = 'localhost'; $db = 'my_db'; error_reporting(E_ALL); ini_set('display_errors', true); if (!mysql_connect($host, $user, $pass)) { die(unable to connect); } if (!mysql_select_db($db)) { die(unable to choose db); } $link = null; $res = mysql_query('select version() as version', $link); while ($row = mysql_fetch_assoc($res)) { print_r($row); } $ php test.php Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /path/to/test.php on line 19 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /path/to/test.php on line 20 -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
My mistake then, it's been a while that I used it that way so some things do fade away from my mind. On Thu, Jun 19, 2008 at 1:57 AM, Chris [EMAIL PROTECTED] wrote: Isaak Malik wrote: Because then the connection resource isn't stored in the $link variable and you will be able to use the mysql functions without passing that variable to each function. RTM again. The link parameter is completely optional. If you don't specify it, it uses the last connection created. I can do this and it's perfectly valid: $link = mysql_connect($server, $user, $pass); if (!$link) { die (Unable to connect to the database server); } $db_selected = mysql_select_db($databasename); if (!$db_selected) { die(Unable to connect to the database $databasename); } $result = mysql_query(select 1); -- Postgresql php tutorials http://www.designmagick.com/ -- Isaak Malik Web Developer
Re: [PHP-DB] PHP-MySQL connection for particular module
Hello Isaak, You've scored the bulleye! It works! Also, I tested by including common.php instead of database.php and it worked too. This solution is perfect for me as I can keep my code compact and tidy. I would, definetely, recommend this site to my fellow developers. Thank you very much, Isaak and all the rest of the guys who took interst in my problem. Best regards. Isaak Malik-3 wrote: To Evert: 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. To bateivan: I can only guess that the database.php file isn't correctly loaded via layout.php, did you already try to include database.php into the module in which it wasn't working? If so and it works then the issue is probably caused by incorrectly including that file, otherwise it has to be something else... And register_globals allows you to use short variables for super global arrays. Ex: $name instead of $_POST['name'], etc. On Wed, Jun 18, 2008 at 9:47 PM, Evert Lammerts [EMAIL PROTECTED] wrote: Pastebin works lots better when you're posting code: www.pastebin.com I don't see your database.php included in both of these modules. Where do you include it? EVert On Wed, Jun 18, 2008 at 9:38 PM, bateivan [EMAIL PROTECTED] wrote: Hello, To answer these qwestions: 1. I am using include in my code. 2. About the $link = mysql_connect('localhost', 'root', 'testing'); variable. I can just include this line before mysql_query function and it works even without entering into mysql_query the $link variable. (Like the connection is waking up). 3.My php.ini register_globals is off as suggested for new versions of PHP but include file should work instead according to the manual. 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. carmade.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; // Quick Login session check login_check(); switch($_REQUEST['req']){ // Insert Case case create_carmade: myheader(Добавяне на автомобилни марки в списъка); // Double check form posted values are there // before performing INSERT query if(!$_POST['car_descr']){ echo 'p align=centerЛипсва информациятя от формата!/p'. 'p align=centerМоля, използвайте бутона'. 'Назад и въведете данните отново!/p'; footer(); exit(); } // Insert Query $sql = mysql_query(INSERT INTO carmade (car_descr) VALUES('{$_POST['car_descr']}')); // Insert query results if(!$sql){ echo Грешка при въвеждане на данните:.mysql_error(); } else { echo 'p align=centerМарката '.$_POST['car_descr']. 'е въведенаbr/с номер:'.mysql_insert_id(); echo 'br / /admin/carmade.php?req=new_carmade Искате ли да'. 'въведете друга марка? '; } break; // Create car made form case case new_carmade: myheader(Въвеждане на нова автомобилна марка); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/carmade_insert.html'; footer(); break; default: myheader(Администриране на списъка с автомобилните марки); include $_SERVER['DOCUMENT_ROOT']. '/html/carmade_admin.html'; footer(); break; } ? login.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; switch($_REQUEST['req']){ case validate: $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); $num_rows = mysql_num_rows($validate); if($num_rows == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['member_id']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; if($row['admin_access'] == 1){ $_SESSION['admin_access'] = true; } $login_time = mysql_query(UPDATE members SET last_login=now() WHERE id='{$row['id']}'); } header(Location: /loggedin.php); } else { myheader(Входът в административната зона е неуспешен!); echo 'p align=centerВходът в страницата не е успешен!/p'; echo 'p align=centerПроверете
Re: [PHP-DB] PHP-MySQL connection for particular module
It's great that you got your problem solved :). On Thu, Jun 19, 2008 at 12:30 PM, bateivan [EMAIL PROTECTED] wrote: Hello Isaak, You've scored the bulleye! It works! Also, I tested by including common.php instead of database.php and it worked too. This solution is perfect for me as I can keep my code compact and tidy. I would, definetely, recommend this site to my fellow developers. Thank you very much, Isaak and all the rest of the guys who took interst in my problem. Best regards. Isaak Malik-3 wrote: To Evert: 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. To bateivan: I can only guess that the database.php file isn't correctly loaded via layout.php, did you already try to include database.php into the module in which it wasn't working? If so and it works then the issue is probably caused by incorrectly including that file, otherwise it has to be something else... And register_globals allows you to use short variables for super global arrays. Ex: $name instead of $_POST['name'], etc. On Wed, Jun 18, 2008 at 9:47 PM, Evert Lammerts [EMAIL PROTECTED] wrote: Pastebin works lots better when you're posting code: www.pastebin.com I don't see your database.php included in both of these modules. Where do you include it? EVert On Wed, Jun 18, 2008 at 9:38 PM, bateivan [EMAIL PROTECTED] wrote: Hello, To answer these qwestions: 1. I am using include in my code. 2. About the $link = mysql_connect('localhost', 'root', 'testing'); variable. I can just include this line before mysql_query function and it works even without entering into mysql_query the $link variable. (Like the connection is waking up). 3.My php.ini register_globals is off as suggested for new versions of PHP but include file should work instead according to the manual. 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. carmade.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; // Quick Login session check login_check(); switch($_REQUEST['req']){ // Insert Case case create_carmade: myheader(Добавяне на автомобилни марки в списъка); // Double check form posted values are there // before performing INSERT query if(!$_POST['car_descr']){ echo 'p align=centerЛипсва информациятя от формата!/p'. 'p align=centerМоля, използвайте бутона'. 'Назад и въведете данните отново!/p'; footer(); exit(); } // Insert Query $sql = mysql_query(INSERT INTO carmade (car_descr) VALUES('{$_POST['car_descr']}')); // Insert query results if(!$sql){ echo Грешка при въвеждане на данните:.mysql_error(); } else { echo 'p align=centerМарката '.$_POST['car_descr']. 'е въведенаbr/с номер:'.mysql_insert_id(); echo 'br / /admin/carmade.php?req=new_carmade Искате ли да'. 'въведете друга марка? '; } break; // Create car made form case case new_carmade: myheader(Въвеждане на нова автомобилна марка); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/carmade_insert.html'; footer(); break; default: myheader(Администриране на списъка с автомобилните марки); include $_SERVER['DOCUMENT_ROOT']. '/html/carmade_admin.html'; footer(); break; } ? login.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; switch($_REQUEST['req']){ case validate: $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); $num_rows = mysql_num_rows($validate); if($num_rows == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['member_id']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; if($row['admin_access'] == 1){ $_SESSION['admin_access'] = true; } $login_time = mysql_query(UPDATE members SET last_login=now()
Re: [PHP-DB] PHP-MySQL connection for particular module
Eric, You gessed right. Both of the files are in my docroot directory. I tried this. Unfortunely, it did not work ( perhaps, I did not use it right), although, I followed your instructions. Isaak gave me an idea which solved my problem (see his replies). Thank you Eric-275 wrote: http://myprojects.srhost.info eric{at}myprojects{dot}srhost{dot}info - Original Message - From: bateivan [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, June 17, 2008 11:19 PM Subject: [PHP-DB] PHP-MySQL connection for particular module : : Hello, : : First of all, please, have in mind that I am new in this business. : : I have a problem connecting with data base in one particular module. That's : right. The rest of the modules can connect to db, update tables with new : info but this one is refusing giving me message like this: : : Warning: mysql_query() [function.mysql-query]: Access denied for user : 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software : Foundation\Apache2.2\htdocs\login.php on line 17 : This error message state that you have provided a wrong username and / or password use the die also to ensure the connection was created. : Warning: mysql_query() [function.mysql-query]: A link to the server could : not be established in : D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on : line 17 : : : It is a authentication module and this is the fragment of the code which is : giving me a hard time: : : *** : ?php : include $_SERVER['DOCUMENT_ROOT']. : '/layout.php'; : Let's your included page on the same directory. Say f:\webroot\docroot As f:\webroot\docroot\layout.php f:\webroot\docroot\login.php then try change the line from include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; to $app_root = './'; include ($app_root . 'layout.php'); : switch($_REQUEST['req']){ : : case validate: : :$validate = mysql_query(SELECT * FROM members :WHERE username = '{$_POST['username']}' :AND password = md5('{$_POST['password']}') :); : : etc : : *** : : My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see : my program files are on D:\. All this may not be important but I listed : anyway. : It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just : replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45. : : I am using persisten connection which should be on until you restart the : server. I have a file included in every page for connection with MySQL and : data base. : PHP manual says that mysql_query reuses the existing connection or try to : create one if not present (I think, according to the warning is trying to : create one). : I had been checking after each step using phpinfo() if the connection is : there and it's there but for some reason the above fragment does not work. : As I mentioned above the rest of my modules are working fine with mysql. : : I checked the php.ini file. I compared it to php.ini.recomended from the : .zip distribusion package and they are almost identical exept couple of : things for error reporting. : I, also checked FAQ, mail listings and other forums but it does not seem : anybody had a similar problem. : : In one of my tests I included a line for connection just before the problem : lines, as described below, and it worked but my intention is to keep such : lines in a separate files and include them in every page instead. : : *** : ... : : $link = mysql_pconnect('localhost', 'root', 'testing'); : : :$validate = mysql_query(SELECT * FROM members :WHERE username = '{$_POST['username']}' :AND password = md5('{$_POST['password']}') :); : etc. : *** : : As I metioned, this is an authentication module and, may be, that's why is : behaving diferently from the rest or I need to do some setup changes in : php.ini which I am not familiar with. : : If anyone has had simmilar problem I would appreciate his/her input. Please, : help me resolve this mistery. : : -- : View this message in context: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html : Sent from the Php - Database mailing list archive at Nabble.com. : : : -- : PHP Database Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
[new code] if (!mysql_connect($a, $b, $c)) return; if (!mysql_select_db($dbname)) return; $res = mysql_query(SELECT * FROM manual;, $link); [/new code] Isn't going to work because $link is not defined and definitely not a resource like mysql_query expects. OR, optionally, to surpress the warnings: [new code] if (!mysql_connect($a, $b, $c)) return; $link = null; if (!mysql_select_db($dbname)) return; $res = mysql_query(SELECT * FROM manual;, $link); [/new code] Isn't going to work because mysql_query needs a resource to connect to. You've defined $link as null. $ cat test.php ?php $user = 'my_db_user'; $pass = 'my_pass'; $host = 'localhost'; $db = 'my_db'; error_reporting(E_ALL); ini_set('display_errors', true); if (!mysql_connect($host, $user, $pass)) { die(unable to connect); } if (!mysql_select_db($db)) { die(unable to choose db); } $link = null; $res = mysql_query('select version() as version', $link); while ($row = mysql_fetch_assoc($res)) { print_r($row); } $ php test.php Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /path/to/test.php on line 19 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /path/to/test.php on line 20 -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
Because then the connection resource isn't stored in the $link variable and you will be able to use the mysql functions without passing that variable to each function. On Wed, Jun 18, 2008 at 1:51 AM, Chris [EMAIL PROTECTED] wrote: It means that either your mysql conenction details are not correctly set or the connection resource isn't accessible for your mysql functions. I suggest you first try by replacing: $link = mysql_pconnect('localhost', 'root', 'testing'); into: mysql_pconnect('localhost', 'root', 'testing'); Why? How is that going to help fix the problem? Personally I'd say to *not* use persistent connections as it will cause you problems later. Use a normal connection: $link = mysql_connect($server, $user, $pass); -- Postgresql php tutorials http://www.designmagick.com/ -- Isaak Malik Web Developer
Re: [PHP-DB] PHP-MySQL connection for particular module
Thank you, Chris, I tried your suggestion using regular connection. Unfortunately, I got the same result. See my reply to Isaak,s reply where I am going to post portion of my code to visualize what I am talking about. Thanx again chris smith-9 wrote: It means that either your mysql conenction details are not correctly set or the connection resource isn't accessible for your mysql functions. I suggest you first try by replacing: $link = mysql_pconnect('localhost', 'root', 'testing'); into: mysql_pconnect('localhost', 'root', 'testing'); Why? How is that going to help fix the problem? Personally I'd say to *not* use persistent connections as it will cause you problems later. Use a normal connection: $link = mysql_connect($server, $user, $pass); -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17989584.html Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
Hello, To answer these qwestions: 1. I am using include in my code. 2. About the $link = mysql_connect('localhost', 'root', 'testing'); variable. I can just include this line before mysql_query function and it works even without entering into mysql_query the $link variable. (Like the connection is waking up). 3.My php.ini register_globals is off as suggested for new versions of PHP but include file should work instead according to the manual. 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. carmade.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; // Quick Login session check login_check(); switch($_REQUEST['req']){ // Insert Case case create_carmade: myheader(Добавяне на автомобилни марки в списъка); // Double check form posted values are there // before performing INSERT query if(!$_POST['car_descr']){ echo 'p align=centerЛипсва информациятя от формата!/p'. 'p align=centerМоля, използвайте бутона'. 'Назад и въведете данните отново!/p'; footer(); exit(); } // Insert Query $sql = mysql_query(INSERT INTO carmade (car_descr) VALUES('{$_POST['car_descr']}')); // Insert query results if(!$sql){ echo Грешка при въвеждане на данните:.mysql_error(); } else { echo 'p align=centerМарката '.$_POST['car_descr']. 'е въведенаbr/с номер:'.mysql_insert_id(); echo 'br / /admin/carmade.php?req=new_carmade Искате ли да'. 'въведете друга марка? '; } break; // Create car made form case case new_carmade: myheader(Въвеждане на нова автомобилна марка); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/carmade_insert.html'; footer(); break; default: myheader(Администриране на списъка с автомобилните марки); include $_SERVER['DOCUMENT_ROOT']. '/html/carmade_admin.html'; footer(); break; } ? login.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; switch($_REQUEST['req']){ case validate: $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); $num_rows = mysql_num_rows($validate); if($num_rows == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['member_id']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; if($row['admin_access'] == 1){ $_SESSION['admin_access'] = true; } $login_time = mysql_query(UPDATE members SET last_login=now() WHERE id='{$row['id']}'); } header(Location: /loggedin.php); } else { myheader(Входът в административната зона е неуспешен!); echo 'p align=centerВходът в страницата не е успешен!/p'; echo 'p align=centerПроверете потребителското си '. 'име и паролата си и опитайте пак или се '. 'обадете на администратора./p'; footer(); } break; default: myheader(Вход!); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/login_form.html'; footer(); break; } ? database.php: ?php $link = mysql_pconnect('localhost','root','testing'); $set = mysql_query('SET NAMES CP1251'); $set = mysql_query('SET_COLLATION=CP1251_GENERAL_CI'); mysql_select_db('samek_db', $link) or die(mysql_error()); ? common.php: ?php // Include Meta Content Class include $_SERVER['DOCUMENT_ROOT'].'/classes/clsMetaContent.php'; // Include Email Class include $_SERVER['DOCUMENT_ROOT'].'/classes/clsEmail.php'; // Include Database Connection File include $_SERVER['DOCUMENT_ROOT'].'/includes/database.php'; // Include Session File include $_SERVER['DOCUMENT_ROOT'].'/includes/session.php'; ? Thank you for your help You're very welcome, I understand that you need a solution which allows you to keep using the connection this way. I doubt that your php.ini is the cause so I'll suggest the following: Try executing your MySQL queries by passing the $link variable to the function as the connection resource: mysql_query(SELECT..., $link); Something that also might cause it is that you use (include|require)_once and that this module doesn't have access to the connection resource, if this is the case change it into include|require and see if that solves your issue. If not then could
Re: [PHP-DB] PHP-MySQL connection for particular module
Pastebin works lots better when you're posting code: www.pastebin.com I don't see your database.php included in both of these modules. Where do you include it? EVert On Wed, Jun 18, 2008 at 9:38 PM, bateivan [EMAIL PROTECTED] wrote: Hello, To answer these qwestions: 1. I am using include in my code. 2. About the $link = mysql_connect('localhost', 'root', 'testing'); variable. I can just include this line before mysql_query function and it works even without entering into mysql_query the $link variable. (Like the connection is waking up). 3.My php.ini register_globals is off as suggested for new versions of PHP but include file should work instead according to the manual. 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. carmade.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; // Quick Login session check login_check(); switch($_REQUEST['req']){ // Insert Case case create_carmade: myheader(Добавяне на автомобилни марки в списъка); // Double check form posted values are there // before performing INSERT query if(!$_POST['car_descr']){ echo 'p align=centerЛипсва информациятя от формата!/p'. 'p align=centerМоля, използвайте бутона'. 'Назад и въведете данните отново!/p'; footer(); exit(); } // Insert Query $sql = mysql_query(INSERT INTO carmade (car_descr) VALUES('{$_POST['car_descr']}')); // Insert query results if(!$sql){ echo Грешка при въвеждане на данните:.mysql_error(); } else { echo 'p align=centerМарката '.$_POST['car_descr']. 'е въведенаbr/с номер:'.mysql_insert_id(); echo 'br / /admin/carmade.php?req=new_carmade Искате ли да'. 'въведете друга марка? '; } break; // Create car made form case case new_carmade: myheader(Въвеждане на нова автомобилна марка); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/carmade_insert.html'; footer(); break; default: myheader(Администриране на списъка с автомобилните марки); include $_SERVER['DOCUMENT_ROOT']. '/html/carmade_admin.html'; footer(); break; } ? login.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; switch($_REQUEST['req']){ case validate: $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); $num_rows = mysql_num_rows($validate); if($num_rows == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['member_id']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; if($row['admin_access'] == 1){ $_SESSION['admin_access'] = true; } $login_time = mysql_query(UPDATE members SET last_login=now() WHERE id='{$row['id']}'); } header(Location: /loggedin.php); } else { myheader(Входът в административната зона е неуспешен!); echo 'p align=centerВходът в страницата не е успешен!/p'; echo 'p align=centerПроверете потребителското си '. 'име и паролата си и опитайте пак или се '. 'обадете на администратора./p'; footer(); } break; default: myheader(Вход!); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/login_form.html'; footer(); break; } ? database.php: ?php $link = mysql_pconnect('localhost','root','testing'); $set = mysql_query('SET NAMES CP1251'); $set = mysql_query('SET_COLLATION=CP1251_GENERAL_CI'); mysql_select_db('samek_db', $link) or die(mysql_error()); ? common.php: ?php // Include Meta Content Class include $_SERVER['DOCUMENT_ROOT'].'/classes/clsMetaContent.php'; // Include Email Class include $_SERVER['DOCUMENT_ROOT'].'/classes/clsEmail.php'; // Include Database Connection File include $_SERVER['DOCUMENT_ROOT'].'/includes/database.php'; // Include Session File include $_SERVER['DOCUMENT_ROOT'].'/includes/session.php'; ? Thank you for your help You're very welcome, I understand that you need a solution which allows you to keep using the connection this way. I doubt that your php.ini is the cause so I'll suggest the following: Try executing your MySQL queries by passing the $link variable to the function as the connection resource: mysql_query(SELECT..., $link); Something that also might cause it is that
Re: [PHP-DB] PHP-MySQL connection for particular module
To Evert: 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. To bateivan: I can only guess that the database.php file isn't correctly loaded via layout.php, did you already try to include database.php into the module in which it wasn't working? If so and it works then the issue is probably caused by incorrectly including that file, otherwise it has to be something else... And register_globals allows you to use short variables for super global arrays. Ex: $name instead of $_POST['name'], etc. On Wed, Jun 18, 2008 at 9:47 PM, Evert Lammerts [EMAIL PROTECTED] wrote: Pastebin works lots better when you're posting code: www.pastebin.com I don't see your database.php included in both of these modules. Where do you include it? EVert On Wed, Jun 18, 2008 at 9:38 PM, bateivan [EMAIL PROTECTED] wrote: Hello, To answer these qwestions: 1. I am using include in my code. 2. About the $link = mysql_connect('localhost', 'root', 'testing'); variable. I can just include this line before mysql_query function and it works even without entering into mysql_query the $link variable. (Like the connection is waking up). 3.My php.ini register_globals is off as suggested for new versions of PHP but include file should work instead according to the manual. 4. I am posting some of my code to compare. Module carmade.php works v.s. login.php which does not. Also, I am posting my database.php which is establishing the connection and is included in every page through layout.php-common.php-database.php. carmade.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; // Quick Login session check login_check(); switch($_REQUEST['req']){ // Insert Case case create_carmade: myheader(Добавяне на автомобилни марки в списъка); // Double check form posted values are there // before performing INSERT query if(!$_POST['car_descr']){ echo 'p align=centerЛипсва информациятя от формата!/p'. 'p align=centerМоля, използвайте бутона'. 'Назад и въведете данните отново!/p'; footer(); exit(); } // Insert Query $sql = mysql_query(INSERT INTO carmade (car_descr) VALUES('{$_POST['car_descr']}')); // Insert query results if(!$sql){ echo Грешка при въвеждане на данните:.mysql_error(); } else { echo 'p align=centerМарката '.$_POST['car_descr']. 'е въведенаbr/с номер:'.mysql_insert_id(); echo 'br / /admin/carmade.php?req=new_carmade Искате ли да'. 'въведете друга марка? '; } break; // Create car made form case case new_carmade: myheader(Въвеждане на нова автомобилна марка); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/carmade_insert.html'; footer(); break; default: myheader(Администриране на списъка с автомобилните марки); include $_SERVER['DOCUMENT_ROOT']. '/html/carmade_admin.html'; footer(); break; } ? login.php: ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; switch($_REQUEST['req']){ case validate: $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); $num_rows = mysql_num_rows($validate); if($num_rows == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['member_id']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address']; if($row['admin_access'] == 1){ $_SESSION['admin_access'] = true; } $login_time = mysql_query(UPDATE members SET last_login=now() WHERE id='{$row['id']}'); } header(Location: /loggedin.php); } else { myheader(Входът в административната зона е неуспешен!); echo 'p align=centerВходът в страницата не е успешен!/p'; echo 'p align=centerПроверете потребителското си '. 'име и паролата си и опитайте пак или се '. 'обадете на администратора./p'; footer(); } break; default: myheader(Вход!); include $_SERVER['DOCUMENT_ROOT']. '/html/forms/login_form.html'; footer(); break; } ? database.php: ?php $link = mysql_pconnect('localhost','root','testing'); $set = mysql_query('SET NAMES CP1251'); $set =
Re: [PHP-DB] PHP-MySQL connection for particular module
Isaak Malik wrote: Because then the connection resource isn't stored in the $link variable and you will be able to use the mysql functions without passing that variable to each function. RTM again. The link parameter is completely optional. If you don't specify it, it uses the last connection created. I can do this and it's perfectly valid: $link = mysql_connect($server, $user, $pass); if (!$link) { die (Unable to connect to the database server); } $db_selected = mysql_select_db($databasename); if (!$db_selected) { die(Unable to connect to the database $databasename); } $result = mysql_query(select 1); -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP-MySQL connection for particular module
Hello, First of all, please, have in mind that I am new in this business. I have a problem connecting with data base in one particular module. That's right. The rest of the modules can connect to db, update tables with new info but this one is refusing giving me message like this: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on line 17 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on line 17 It is a authentication module and this is the fragment of the code which is giving me a hard time: *** ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; switch($_REQUEST['req']){ case validate: $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); etc *** My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see my program files are on D:\. All this may not be important but I listed anyway. It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45. I am using persisten connection which should be on until you restart the server. I have a file included in every page for connection with MySQL and data base. PHP manual says that mysql_query reuses the existing connection or try to create one if not present (I think, according to the warning is trying to create one). I had been checking after each step using phpinfo() if the connection is there and it's there but for some reason the above fragment does not work. As I mentioned above the rest of my modules are working fine with mysql. I checked the php.ini file. I compared it to php.ini.recomended from the .zip distribusion package and they are almost identical exept couple of things for error reporting. I, also checked FAQ, mail listings and other forums but it does not seem anybody had a similar problem. In one of my tests I included a line for connection just before the problem lines, as described below, and it worked but my intention is to keep such lines in a separate files and include them in every page instead. *** ... $link = mysql_pconnect('localhost', 'root', 'testing'); $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); etc. *** As I metioned, this is an authentication module and, may be, that's why is behaving diferently from the rest or I need to do some setup changes in php.ini which I am not familiar with. If anyone has had simmilar problem I would appreciate his/her input. Please, help me resolve this mistery. -- View this message in context: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
If you get an error of this kind: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on line 17 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on line 17 It means that either your mysql conenction details are not correctly set or the connection resource isn't accessible for your mysql functions. I suggest you first try by replacing: $link = mysql_pconnect('localhost', 'root', 'testing'); into: mysql_pconnect('localhost', 'root', 'testing'); On 6/17/08, bateivan [EMAIL PROTECTED] wrote: Hello, First of all, please, have in mind that I am new in this business. I have a problem connecting with data base in one particular module. That's right. The rest of the modules can connect to db, update tables with new info but this one is refusing giving me message like this: Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on line 17 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on line 17 It is a authentication module and this is the fragment of the code which is giving me a hard time: *** ?php include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; switch($_REQUEST['req']){ case validate: $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); etc *** My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see my program files are on D:\. All this may not be important but I listed anyway. It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45. I am using persisten connection which should be on until you restart the server. I have a file included in every page for connection with MySQL and data base. PHP manual says that mysql_query reuses the existing connection or try to create one if not present (I think, according to the warning is trying to create one). I had been checking after each step using phpinfo() if the connection is there and it's there but for some reason the above fragment does not work. As I mentioned above the rest of my modules are working fine with mysql. I checked the php.ini file. I compared it to php.ini.recomended from the .zip distribusion package and they are almost identical exept couple of things for error reporting. I, also checked FAQ, mail listings and other forums but it does not seem anybody had a similar problem. In one of my tests I included a line for connection just before the problem lines, as described below, and it worked but my intention is to keep such lines in a separate files and include them in every page instead. *** ... $link = mysql_pconnect('localhost', 'root', 'testing'); $validate = mysql_query(SELECT * FROM members WHERE username = '{$_POST['username']}' AND password = md5('{$_POST['password']}') ); etc. *** As I metioned, this is an authentication module and, may be, that's why is behaving diferently from the rest or I need to do some setup changes in php.ini which I am not familiar with. If anyone has had simmilar problem I would appreciate his/her input. Please, help me resolve this mistery. -- View this message in context: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Isaak Malik Web Developer
Re: [PHP-DB] PHP-MySQL connection for particular module
http://myprojects.srhost.info eric{at}myprojects{dot}srhost{dot}info - Original Message - From: bateivan [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, June 17, 2008 11:19 PM Subject: [PHP-DB] PHP-MySQL connection for particular module : : Hello, : : First of all, please, have in mind that I am new in this business. : : I have a problem connecting with data base in one particular module. That's : right. The rest of the modules can connect to db, update tables with new : info but this one is refusing giving me message like this: : : Warning: mysql_query() [function.mysql-query]: Access denied for user : 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software : Foundation\Apache2.2\htdocs\login.php on line 17 : This error message state that you have provided a wrong username and / or password use the die also to ensure the connection was created. : Warning: mysql_query() [function.mysql-query]: A link to the server could : not be established in : D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on : line 17 : : : It is a authentication module and this is the fragment of the code which is : giving me a hard time: : : *** : ?php : include $_SERVER['DOCUMENT_ROOT']. : '/layout.php'; : Let's your included page on the same directory. Say f:\webroot\docroot As f:\webroot\docroot\layout.php f:\webroot\docroot\login.php then try change the line from include $_SERVER['DOCUMENT_ROOT']. '/layout.php'; to $app_root = './'; include ($app_root . 'layout.php'); : switch($_REQUEST['req']){ : : case validate: : :$validate = mysql_query(SELECT * FROM members :WHERE username = '{$_POST['username']}' :AND password = md5('{$_POST['password']}') :); : : etc : : *** : : My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see : my program files are on D:\. All this may not be important but I listed : anyway. : It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just : replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45. : : I am using persisten connection which should be on until you restart the : server. I have a file included in every page for connection with MySQL and : data base. : PHP manual says that mysql_query reuses the existing connection or try to : create one if not present (I think, according to the warning is trying to : create one). : I had been checking after each step using phpinfo() if the connection is : there and it's there but for some reason the above fragment does not work. : As I mentioned above the rest of my modules are working fine with mysql. : : I checked the php.ini file. I compared it to php.ini.recomended from the : .zip distribusion package and they are almost identical exept couple of : things for error reporting. : I, also checked FAQ, mail listings and other forums but it does not seem : anybody had a similar problem. : : In one of my tests I included a line for connection just before the problem : lines, as described below, and it worked but my intention is to keep such : lines in a separate files and include them in every page instead. : : *** : ... : : $link = mysql_pconnect('localhost', 'root', 'testing'); : : :$validate = mysql_query(SELECT * FROM members :WHERE username = '{$_POST['username']}' :AND password = md5('{$_POST['password']}') :); : etc. : *** : : As I metioned, this is an authentication module and, may be, that's why is : behaving diferently from the rest or I need to do some setup changes in : php.ini which I am not familiar with. : : If anyone has had simmilar problem I would appreciate his/her input. Please, : help me resolve this mistery. : : -- : View this message in context: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html : Sent from the Php - Database mailing list archive at Nabble.com. : : : -- : PHP Database Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php : -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
It means that either your mysql conenction details are not correctly set or the connection resource isn't accessible for your mysql functions. I suggest you first try by replacing: $link = mysql_pconnect('localhost', 'root', 'testing'); into: mysql_pconnect('localhost', 'root', 'testing'); Why? How is that going to help fix the problem? Personally I'd say to *not* use persistent connections as it will cause you problems later. Use a normal connection: $link = mysql_connect($server, $user, $pass); -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP-MySQL connection for particular module
excuseme but, you can access by terminal? [shell] ODBC is the user? or is a ODBC database? Please answer me and i can help you. **Excuse me my english is bad. :( El 17/06/2008, a las 06:51 p.m., Chris escribió: It means that either your mysql conenction details are not correctly set or the connection resource isn't accessible for your mysql functions. I suggest you first try by replacing: $link = mysql_pconnect('localhost', 'root', 'testing'); into: mysql_pconnect('localhost', 'root', 'testing'); Why? How is that going to help fix the problem? Personally I'd say to *not* use persistent connections as it will cause you problems later. Use a normal connection: $link = mysql_connect($server, $user, $pass); -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php + mysql + copy file
Hi, try this, $carpeta = $_SERVER['DOCUMENT_ROOT']./subidos; // nombre de la carpeta ya creada. chmool 777 (todos los permisos) copy($_FILES['file']['tmp_name'] , $carpeta . $_FILE['file']['name']); Regards, Tacio Vilela 2008/4/2 Chris [EMAIL PROTECTED]: $carpeta = subidos; // nombre de la carpeta ya creada. chmool 777 (todos los permisos) copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE ['file']['name']); It's $_FILES not $_FILE (an 's' on the end). It's always worth using error_reporting(E_ALL) and ini_set('display_errors', true) when doing development, this would have triggered a notice or warning (can't remember which). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- /*** *** *** *** Tácio Vilela *** *** MSN: [EMAIL PROTECTED] *** *** SKYPE: taciovilela *** *** *** ***/
[PHP-DB] php + mysql + copy file
Hello I have the next code: -- archive_a_subir.php -- form action=archivo_subir.php method=post enctype=multipart/form-data input type=file name=file input type=submit value=ADJUNTAR ARCHIVO /form In archive_subir.php: ? $carpeta = subidos; // nombre de la carpeta ya creada. chmool 777 (todos los permisos) copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE ['file']['name']); ? You can see this in http://www.portbora.com.ar/foro/archivo_a_subir.php, when I run these appears the next warning Warning: copy(subidos/) [ http://www.portbora.com.ar/foro/function.copy function.copy]: failed to open stream: Is a directory in /home/pu000561/public_html/foro/archivo_subir.php on line 3 Why this? How can I run correctly? Thanks. + _ // Emiliano Boragina _ // Diseño Comunicación // + _ // [EMAIL PROTECTED] / // 15 40 58 60 02 /// + _
Re: [PHP-DB] php + mysql + copy file
$carpeta = subidos; // nombre de la carpeta ya creada. chmool 777 (todos los permisos) copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE ['file']['name']); It's $_FILES not $_FILE (an 's' on the end). It's always worth using error_reporting(E_ALL) and ini_set('display_errors', true) when doing development, this would have triggered a notice or warning (can't remember which). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP, MySQL and Lookups
On Wed, Feb 27, 2008 at 9:52 AM, Tobias Franzén [EMAIL PROTECTED] wrote: Consider this, if you have not already: What if two users happen to have the same password? It is wrong to assume that no two users will never have the same password. Doing an update like that, just based on the password column, is an accident waiting to happen. You should have a uniquely distinguished name or designation for each user, and validate the user and password combination. Also, such a designation should be unique, and keeping entries in a column unique can be enforced with MySQL. It's also safe to presume, however, that - since the OP said, Basically, what I'm trying to do is give a load of users an individual password - by individual password he means that the password *will* be the unique key. Just a thought. ;-P For all other intents and purposes, however, you're 100% correct. Using a unique auto_increment key would be your best bet. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP, MySQL and Lookups
Daniel Brown wrote: On Tue, Feb 26, 2008 at 8:55 AM, Henry Felton [EMAIL PROTECTED] wrote: Hi everyone, I'm just getting into PHP at the moment and was wondering; what code would I need to look at a field value entered in a form, then if that value is found in my table, enter all the other information entered in the form, to the other fields on that record. Basically, what I'm trying to do is give a load of users an individual password that they enter, with various other pieces of information such as year of birth, single/married or whatever, into a form. In MySQL I have a table with three fields, but only the password one has any data in them. A script will then took in the table to find the password entered in the form, and then append all the other information (i.e. data for the other two fields) to the particular record that holds the password value entered. Henry (AKA: Max), Try this: ? include('config.php'); // Your database configuration and connection information if($_POST) { $dob = mysql_real_escape_string($_POST['dob']); $married = mysql_real_escape_string($_POST['married']); $pass = mysql_real_escape_string($_POST['pass']); // When designing the database, call the password field `pass` (without quotes). // The word `password` is a MySQL reserved word and could cause errors. $sql = UPDATE table_name SET dob='.$dob.', married='.$married.' WHERE pass='.$pass.' LIMIT 1; mysql_query($sql) or die(Incorrect password specified. Please try again.); // If we've reached here, then we can do whatever we want to acknowledge. // Let's redirect to a thank you page, sending the variables as a GET request // to be parsed by the thank you page script. header(Location: thankyou.php?dob=.$dob.married=.$married); exit; } ? form method=post action=?=$_SERVER['PHP_SELF'];? / Password: input type=password name=pass /br / Date of birth (mm/dd/): input type=text name=dob /br / Status: input type=radio name=married value=Married /Married input type=radio name=married value=Single /Single input type=radio name=married value=Widowed /Widowed input type=radio name=married value=Divorced /Divorced input type=radio name=married value=Wishing /Wishing I Was Singlebr / input type=submit value=Process Now / /form Consider this, if you have not already: What if two users happen to have the same password? It is wrong to assume that no two users will never have the same password. Doing an update like that, just based on the password column, is an accident waiting to happen. You should have a uniquely distinguished name or designation for each user, and validate the user and password combination. Also, such a designation should be unique, and keeping entries in a column unique can be enforced with MySQL. /Tobias -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP, MySQL and Lookups
Hi everyone, I'm just getting into PHP at the moment and was wondering; what code would I need to look at a field value entered in a form, then if that value is found in my table, enter all the other information entered in the form, to the other fields on that record. Basically, what I'm trying to do is give a load of users an individual password that they enter, with various other pieces of information such as year of birth, single/married or whatever, into a form. In MySQL I have a table with three fields, but only the password one has any data in them. A script will then took in the table to find the password entered in the form, and then append all the other information (i.e. data for the other two fields) to the particular record that holds the password value entered. Hope that made sense, but I'd be so grateful if someone could help me with this Thanks, Max
Re: [PHP-DB] PHP, MySQL and Lookups
On Feb 26, 2008, at 8:55 AM, Henry Felton wrote: Hi everyone, I'm just getting into PHP at the moment and was wondering; what code would I need to look at a field value entered in a form, then if that value is found in my table, enter all the other information entered in the form, to the other fields on that record. Basically, what I'm trying to do is give a load of users an individual password that they enter, with various other pieces of information such as year of birth, single/married or whatever, into a form. In MySQL I have a table with three fields, but only the password one has any data in them. A script will then took in the table to find the password entered in the form, and then append all the other information (i.e. data for the other two fields) to the particular record that holds the password value entered. Hope that made sense, but I'd be so grateful if someone could help me with this What you're looking for to me sounds like using the UPDATE syntax in MySQL... something along the lines of: $sql = UPDATE tablename field1=$MySuperData1 field2=$MySuperData2 where password=$MySuperHardPassword; Of course, this is untested check the mysql site for specifics on using update. Also... always be sure to escape your data or you are asking for trouble... That should be enough to get you started! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP-DB] PHP, MySQL and Lookups
Lemme see if I get this right: You could just do this: UPDATE userPW SET field1=$satinized_post_field1, field2=$sanitized_post_field2 WHERE userid=$userId and password=$userPw if (mysql_affected_rows($conn) 0){ echo updated }else{ echo error: .mysql_error($conn); } http://docs.php.net/manual/function.mysql-query.php I suppose you have a relationship between pw and user (as stated in userid=$userid). Hope this helps! -Mensagem original- De: Henry Felton [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 26 de fevereiro de 2008 10:55 Para: php-db@lists.php.net Assunto: [PHP-DB] PHP, MySQL and Lookups Hi everyone, I'm just getting into PHP at the moment and was wondering; what code would I need to look at a field value entered in a form, then if that value is found in my table, enter all the other information entered in the form, to the other fields on that record. Basically, what I'm trying to do is give a load of users an individual password that they enter, with various other pieces of information such as year of birth, single/married or whatever, into a form. In MySQL I have a table with three fields, but only the password one has any data in them. A script will then took in the table to find the password entered in the form, and then append all the other information (i.e. data for the other two fields) to the particular record that holds the password value entered. Hope that made sense, but I'd be so grateful if someone could help me with this Thanks, Max -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP, MySQL and Lookups
On Tue, Feb 26, 2008 at 8:55 AM, Henry Felton [EMAIL PROTECTED] wrote: Hi everyone, I'm just getting into PHP at the moment and was wondering; what code would I need to look at a field value entered in a form, then if that value is found in my table, enter all the other information entered in the form, to the other fields on that record. Basically, what I'm trying to do is give a load of users an individual password that they enter, with various other pieces of information such as year of birth, single/married or whatever, into a form. In MySQL I have a table with three fields, but only the password one has any data in them. A script will then took in the table to find the password entered in the form, and then append all the other information (i.e. data for the other two fields) to the particular record that holds the password value entered. Henry (AKA: Max), Try this: ? include('config.php'); // Your database configuration and connection information if($_POST) { $dob = mysql_real_escape_string($_POST['dob']); $married = mysql_real_escape_string($_POST['married']); $pass = mysql_real_escape_string($_POST['pass']); // When designing the database, call the password field `pass` (without quotes). // The word `password` is a MySQL reserved word and could cause errors. $sql = UPDATE table_name SET dob='.$dob.', married='.$married.' WHERE pass='.$pass.' LIMIT 1; mysql_query($sql) or die(Incorrect password specified. Please try again.); // If we've reached here, then we can do whatever we want to acknowledge. // Let's redirect to a thank you page, sending the variables as a GET request // to be parsed by the thank you page script. header(Location: thankyou.php?dob=.$dob.married=.$married); exit; } ? form method=post action=?=$_SERVER['PHP_SELF'];? / Password: input type=password name=pass /br / Date of birth (mm/dd/): input type=text name=dob /br / Status: input type=radio name=married value=Married /Married input type=radio name=married value=Single /Single input type=radio name=married value=Widowed /Widowed input type=radio name=married value=Divorced /Divorced input type=radio name=married value=Wishing /Wishing I Was Singlebr / input type=submit value=Process Now / /form -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/MySQL - Matrix
Hi, I am developing a web site where I have a photos table, several records from the photos table can be linked to a different table referentially. When I do a SELECT to all photos records I can get multiple records, I do not have any problems doing this, the problem is all the procedure after this. When I get all the records from the photos table, I am using a web page to display only the first record, then, if the user hits a next link then the user should be able to see the next record (next picture) and so on, I do not want to do a select every time the user hits next or back to get the picture name and then display it Is there anyway to do a one SELECT statement, save them in a matrix and then just go thru it. I am using the same web page to display all pictures, e.g. the next link points to the same web page where the first picture was displayed, is it possible to pass a matrix variable ? Regards, Eduardo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/MySQL - Matrix
When I get all the records from the photos table, I am using a web page to display only the first record, then, if the user hits a next link then the user should be able to see the next record (next picture) and so on, I do not want to do a select every time the user hits next or back to get the picture name and then display it Why? You're selecting one record - it will be quick as long as you're db is indexed correctly. Is there anyway to do a one SELECT statement, save them in a matrix and then just go thru it. I am using the same web page to display all pictures, e.g. the next link points to the same web page where the first picture was displayed, is it possible to pass a matrix variable ? Sure. Stuff it all in an array and then save it in the session. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/MySQL - Matrix
Hi Chris How do I save the matrix in the session ? Actually, my first question is, what do you mean by a session ? Regards Eduardo Chris [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] When I get all the records from the photos table, I am using a web page to display only the first record, then, if the user hits a next link then the user should be able to see the next record (next picture) and so on, I do not want to do a select every time the user hits next or back to get the picture name and then display it Why? You're selecting one record - it will be quick as long as you're db is indexed correctly. Is there anyway to do a one SELECT statement, save them in a matrix and then just go thru it. I am using the same web page to display all pictures, e.g. the next link points to the same web page where the first picture was displayed, is it possible to pass a matrix variable ? Sure. Stuff it all in an array and then save it in the session. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/MySQL - Matrix
Eduardo Vizcarra wrote: Hi Chris How do I save the matrix in the session ? Actually, my first question is, what do you mean by a session ? http://www.php.net/session Look under the examples. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP + MySQL
I just can't figure it out and Google yielded no help. I have a table named 'settings' which contains two fields, 'item' and 'content'. What I would like to do is grab that data and use the 'item' field as the name, and use the respective 'content' as the value in an array. For Example: Array ( copyright = Copyright 2007 yada yada version = 2.15.1 ) That way I can do ?= $settings['version'] ? Can you help point me in the right direction? Any help would be greatly appreciated!! :-D -- -Dan
Re: [PHP-DB] PHP + MySQL
On 7/18/07, Dan Maret [EMAIL PROTECTED] wrote: I just can't figure it out and Google yielded no help. I have a table named 'settings' which contains two fields, 'item' and 'content'. What I would like to do is grab that data and use the 'item' field as the name, and use the respective 'content' as the value in an array. For Example: Array ( copyright = Copyright 2007 yada yada version = 2.15.1 ) That way I can do ?= $settings['version'] ? Can you help point me in the right direction? Any help would be greatly appreciated!! :-D -- -Dan You need mysql_fetch_assoc() / mysql_fetch_array() functions http://www.php.net/mysql_fetch_assoc http://www.php.net/manual/en/function.mysql-fetch-array.php They come with a good examples in the manual pages. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/MySQL UTF-8 SNAFU
Charles Sheinin napsal(a): Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I have a php page which has meta http-equiv=content-type content=application/xhtml+xml; charset=utf-8 / at the top of the html section and mysql_set_charset(utf8); after my connection (it's php 2.2.3, so that's more or less the same as mysql_query(SET NAMES 'utf8');/(SET SESSION character_set_client = utf8);, though I tried all that too, anyway). I have all my php.ini mbstring stuff configured for utf-8: mbstring.language = Neutral mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.encoding_translation = On mbstring.detect_order = auto and for what it's worth, echo mb_internal_encoding(); reports UTF-8. when I run a query that pulls out (in this case, Japanese, but say any) UTF8 data, it displays properly in MySQL Query Browser. With php in the above context however, it does not. Instead, it prints a ? corresponding to each character. When I use mb_detect_encoding(); on each such string, it tells me they are encoded as ASCII. The nearest I can tell is that somewhere between using mysql_query() and mysql_fetch_row(), things got messed up. Is this a bug? Is there something I'm missing? Any clues? Help! do you have *meta http-equiv=Content-Type content=text/html; charset=utf-8* header in your script? OKi98 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Issue!
On Jul 12, 2007, at 9:50 PM, Austin C wrote: Hello, I dont get any errors. Just a blank page. But, I go to the database, and it did what I told it to with the header table, but not with the circulation table. Check your error log or add this as the first line in your script. ini_set('display_errors', '1'); Maybe you are testing this on a production server with errors not displayed. Remove the line before you deploy the code. Hopefully you will see a meaningful message now. Regards, Dwight
Re: [PHP-DB] PHP MySQL Issue!
On Jul 12, 2007, at 9:50 PM, Austin C wrote: Hello, I dont get any errors. Just a blank page. But, I go to the database, and it did what I told it to with the header table, but not with the circulation table. After you built the SQL for the circulation table, you did not execute it [with a $query = mysqli_query($cxn,$sql);]. Instead, you selected the db again. Your code did what you told it to do. Hence, no error messages. Regards, Dwight
[PHP-DB] PHP/MySQL UTF-8 SNAFU
Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I have a php page which has meta http-equiv=content-type content=application/xhtml+xml; charset=utf-8 / at the top of the html section and mysql_set_charset(utf8); after my connection (it's php 2.2.3, so that's more or less the same as mysql_query(SET NAMES 'utf8');/(SET SESSION character_set_client = utf8);, though I tried all that too, anyway). I have all my php.ini mbstring stuff configured for utf-8: mbstring.language = Neutral mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.encoding_translation = On mbstring.detect_order = auto and for what it's worth, echo mb_internal_encoding(); reports UTF-8. when I run a query that pulls out (in this case, Japanese, but say any) UTF8 data, it displays properly in MySQL Query Browser. With php in the above context however, it does not. Instead, it prints a ? corresponding to each character. When I use mb_detect_encoding(); on each such string, it tells me they are encoded as ASCII. The nearest I can tell is that somewhere between using mysql_query() and mysql_fetch_row(), things got messed up. Is this a bug? Is there something I'm missing? Any clues? Help! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/MySQL UTF-8 SNAFU
Hi What functions are you using? Many of PHP's functions are not multibyte aware and default to ASCII. I had this problems myself end of last year. -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP MySQL Issue!
Hello everyone, im trying to use PHP to create 2 tables in a database and populate them with tables, however, it just wont work. Here is my full code: ?php $hostname = $_GET['hostname']; $dbname = $_GET['dbname']; $dbusername = $_GET['dbusername']; $dbpassword = $_GET['dbpassword']; $dbprefix = $_GET['dbprefix']; echo centerbrbInstall- Processing Database Info . . . . ./b p p; $cxn = mysqli_connect($hostname,$dbusername,$dbpassword,$dbname) or die (Basic Library System could not connect to the database you specified. Please go back and make sure the information you submitted is correct.); $file = '../config.php'; $fh = fopen($file, 'w') or die('Failed to open config.php file'); fwrite($fh, '?php $hostname='.$hostname.'; $dbname='.$dbname.'; $dbusername='.$dbusername.'; $dbpassword='.$dbpassword.'; $dbprefix='.$dbprefix.'; ?') or die('Could not write to config.php'); fclose($fh); mysqli_select_db($cxn,$dbname) or die (Could not connect to the database you specified. Please go back and make sure you entered the correct database.); mysqli_select_db($cxn,$dbname); $sql = CREATE TABLE .$dbprefix._circulation ( title varchar(100), author varchar(100), pubdate varchar(100), genre varchar(100), medium varchar(100), price varchar(100), id int(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY(id) ); mysqli_select_db($cxn,$dbname); $sql = CREATE TABLE .$dbprefix._holder ( space varchar(100) ); $query = mysqli_query($cxn,$sql); if(!$query){ echo Basic Library System was unable to submit the information to the database. Please make sure you specified correct information.; }else{ echo Successfully created table. Do something here; } mysqli_close($cxn); ? -- Visit galacticwebdesigns.com for tutorials and more!
Re: [PHP-DB] PHP MySQL Issue!
Hello, I dont get any errors. Just a blank page. But, I go to the database, and it did what I told it to with the header table, but not with the circulation table. On 7/12/07, Niel [EMAIL PROTECTED] wrote: Hi Give us a clue? What's the error(s) you get returned? -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thanks, the webmaster of Galacticneo
Re: [PHP-DB] PHP MySQL Issue!
- Original Message - From: Austin C [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Friday, July 13, 2007 8:41 AM Subject: [PHP-DB] PHP MySQL Issue! Hello everyone, im trying to use PHP to create 2 tables in a database and populate them with tables, however, it just wont work. Here is my full code: ?php $hostname = $_GET['hostname']; $dbname = $_GET['dbname']; $dbusername = $_GET['dbusername']; $dbpassword = $_GET['dbpassword']; $dbprefix = $_GET['dbprefix']; echo centerbrbInstall- Processing Database Info . . . . ./b p p; $cxn = mysqli_connect($hostname,$dbusername,$dbpassword,$dbname) or die (Basic Library System could not connect to the database you specified. Please go back and make sure the information you submitted is correct.); $file = '../config.php'; $fh = fopen($file, 'w') or die('Failed to open config.php file'); fwrite($fh, '?php $hostname='.$hostname.'; $dbname='.$dbname.'; $dbusername='.$dbusername.'; $dbpassword='.$dbpassword.'; $dbprefix='.$dbprefix.'; ?') or die('Could not write to config.php'); fclose($fh); mysqli_select_db($cxn,$dbname) are this should be mysqli_select_db($dbname, $cxn) ??? and the rest seem miss place in the function or die (Could not connect to the database you specified. Please go back and make sure you entered the correct database.); mysqli_select_db($cxn,$dbname); $sql = CREATE TABLE .$dbprefix._circulation ( title varchar(100), author varchar(100), pubdate varchar(100), genre varchar(100), medium varchar(100), price varchar(100), id int(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY(id) ); mysqli_select_db($cxn,$dbname); $sql = CREATE TABLE .$dbprefix._holder ( space varchar(100) ); $query = mysqli_query($cxn,$sql); if(!$query){ echo Basic Library System was unable to submit the information to the database. Please make sure you specified correct information.; }else{ echo Successfully created table. Do something here; } mysqli_close($cxn); ? -- Visit galacticwebdesigns.com for tutorials and more!
Re: [PHP-DB] PHP MySQL Issue!
Hi Give us a clue? What's the error(s) you get returned? -- Niel Archer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MySQL Issue!
Austin C wrote: Hello everyone, im trying to use PHP to create 2 tables in a database and populate them with tables, however, it just wont work. Where does it stop working? Looks fine from what you've shown us but you need to track down the problem a bit further. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP - MySQL webhosting
If anyone is interested in some VERY good webhosting that has support for PHP and MySQL, please take a look at the following link: http://www.sturdyhosting.com/idevaffiliate/idevaffiliate.php?id=100 They offer domain names for $8.95 and also webhositng solutions for as low as $2.95 per month. I hope that some of you are interested and can join the greatest webhosting company in the world!
[PHP-DB] PHP - MySQL webhosting
If anyone is interested in some VERY good webhosting that has support for PHP and MySQL, please take a look at the following link: http://www.sturdyhosting.com/idevaffiliate/idevaffiliate.php?id=100 They offer domain names for $8.95 and also webhositng solutions for as low as $2.95 per month. I hope that some of you are interested and can join the greatest webhosting company in the world!
[PHP-DB] PHP-MySQL CMS Generator
Does anyone know of a program that can generate a good Content Management System? For example, it would ask which fields to add to a database table, the types of the fields, etc and create the database in MySQL and php's to manage the data. I did find a few such programs already (AppGini, PHPRunner) but they don't allow custom templates.I'd like to control how the pages look. Thanks. -t
[PHP-DB] PHP/Mysql search
Hello, Please be patient and assist meI am building a web application where a search function is required. I have a number of drop down lists from which a user has to select what they are searching for..they may choose to do a multi-fields search or search only one. Are there any resources you can point me to which implements something like this? Eustace
RE: [PHP-DB] PHP/Mysql search
CREATIVITY is what you are looking for. -Original Message- From: Eustace [mailto:[EMAIL PROTECTED] Sent: Lunes, 22 de Mayo de 2006 07:59 a.m. To: php-db@lists.php.net Subject: [PHP-DB] PHP/Mysql search Hello, Please be patient and assist meI am building a web application where a search function is required. I have a number of drop down lists from which a user has to select what they are searching for..they may choose to do a multi-fields search or search only one. Are there any resources you can point me to which implements something like this? Eustace Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP/Mysql search
http://www.weberdev.com/get_example-4236.html is an example that I wrote that does this bastien From: Eustace [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] PHP/Mysql search Date: Mon, 22 May 2006 14:58:59 +0200 Hello, Please be patient and assist meI am building a web application where a search function is required. I have a number of drop down lists from which a user has to select what they are searching for..they may choose to do a multi-fields search or search only one. Are there any resources you can point me to which implements something like this? Eustace -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/Mysql search
Miguel Guirao wrote: CREATIVITY is what you are looking for. What do you mean by CREATIVITY? -J -Original Message- From: Eustace [mailto:[EMAIL PROTECTED] Sent: Lunes, 22 de Mayo de 2006 07:59 a.m. To: php-db@lists.php.net Subject: [PHP-DB] PHP/Mysql search Hello, Please be patient and assist meI am building a web application where a search function is required. I have a number of drop down lists from which a user has to select what they are searching for..they may choose to do a multi-fields search or search only one. Are there any resources you can point me to which implements something like this? Eustace Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP/Mysql search
Thanks, I have somewhere to start! Eustace -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Monday, May 22, 2006 4:10 PM To: [EMAIL PROTECTED]; php-db@lists.php.net Subject: RE: [PHP-DB] PHP/Mysql search http://www.weberdev.com/get_example-4236.html is an example that I wrote that does this bastien From: Eustace [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] PHP/Mysql search Date: Mon, 22 May 2006 14:58:59 +0200 Hello, Please be patient and assist meI am building a web application where a search function is required. I have a number of drop down lists from which a user has to select what they are searching for..they may choose to do a multi-fields search or search only one. Are there any resources you can point me to which implements something like this? Eustace -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Internal Virus Database is out-of-date. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.5.6/336 - Release Date: 5/10/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/MySQL/Linux developer needed in Long Beach, CA
Hello, We're looking for a PHP developer to work on-site in Long Beach to start immediately. Job description is below. Thanks, Christian Internet Transaction Services, Inc. - An Internet Paymenet Processing company located in Long Beach, CA is looking to hire a contract PHP developer to work in our office for a 6 month project. This project will be helping us to expand on our risk management system. Possible travel to Holland may be required for training. We're looking for someone with 2 to 3 years PHP/MySQL/Linux experience. Please email your resume to [EMAIL PROTECTED] No third party or agency responses please. Looking to fill this position ASAP. This position pays $40 to $45 an hour to start with an increase in 60 days. -- Christian Fea CTO Internet Transaction Services, Inc. [EMAIL PROTECTED] 110 Pine Ave Suite 1080 Long Beach, CA 90802 Office - 562-951-1122 Skype - christianfea Yahoo - christianfea
[PHP-DB] PHP, MySQL and Apache
Hi all, I intend to create a database to be accessed from a voice application. I plan to use MySQL as a database engine and PHP as a scripting language to generate dynamic VoiceXML documents. However, I have two questions I could not get answers to: 1. Do I need to install Apache to work with MySQL and PHP? In other words, can MySQL and PHP work together without Apache. Note: The database and the application are on the same machine for the timebeing. 2. What database API should be used? I recently read about MyODBC. But many standard books skip this part as if PHP and MySQL have something natural to talk to eachother without requiring anything like ODBC, etc. Your answers to these questions are highly appreciated! Best regards, Kinfe T. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP, MySQL and Apache
Answer 1. No, you do not need Apache. You could be using IIS along with PHP and MySQL if that is what you need! But talking about natural relationships, there is nothing better that the great combitation formed by XAMP. Answer 2. There is a MySQL API specially done for PHP, so there is no need to use another different API. Search for functions like mysql_pconnect(), mysql_select_db(), mysql_query() and related functions on the php web site. Chicolinux!! -Original Message- From: Kinfe Tadesse [mailto:[EMAIL PROTECTED] Sent: Lunes, 27 de Febrero de 2006 09:07 a.m. To: php-db@lists.php.net Subject: [PHP-DB] PHP, MySQL and Apache Hi all, I intend to create a database to be accessed from a voice application. I plan to use MySQL as a database engine and PHP as a scripting language to generate dynamic VoiceXML documents. However, I have two questions I could not get answers to: 1. Do I need to install Apache to work with MySQL and PHP? In other words, can MySQL and PHP work together without Apache. Note: The database and the application are on the same machine for the timebeing. 2. What database API should be used? I recently read about MyODBC. But many standard books skip this part as if PHP and MySQL have something natural to talk to eachother without requiring anything like ODBC, etc. Your answers to these questions are highly appreciated! Best regards, Kinfe T. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries companies. No part of this message or attachments may be used or reproduced in any manner whatsoever. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP, MySQL and Apache
Hi kinfe, To connect to myql from php you only need build your php with mysql support. Now, for render vxml documents you are using apache o IIS ? I recommend LAMP (Linux+Apache+Myql+Php) Regards, Luis Morales On Mon, 2006-02-27 at 16:07 +0100, Kinfe Tadesse wrote: Hi all, I intend to create a database to be accessed from a voice application. I plan to use MySQL as a database engine and PHP as a scripting language to generate dynamic VoiceXML documents. However, I have two questions I could not get answers to: 1. Do I need to install Apache to work with MySQL and PHP? In other words, can MySQL and PHP work together without Apache. Note: The database and the application are on the same machine for the timebeing. 2. What database API should be used? I recently read about MyODBC. But many standard books skip this part as if PHP and MySQL have something natural to talk to eachother without requiring anything like ODBC, etc. Your answers to these questions are highly appreciated! Best regards, Kinfe T. -- - Luis Morales Consultor de Tecnologia Cel: +(58)416-4242091 - Empieza por hacer lo necesario, luego lo que es posible... y de pronto estarás haciendo lo imposible - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP, MySQL, XML books recommendation
hi guys, any recommendation on good books or resources for me? I'm totally clueless about XML but would love to pick it up now. Any one can give me titles of good books? thanks!! look forward to hear from you, hwee
[PHP-DB] Php-MySQL general function for insert, update,delete, count query
Hi friends, I am using one perfect function for my queries for PHP+Oracle pages, this is below == function sorgu($sql) { global $baglanti; $stmt=ociparse($baglanti,$sql); $sonuc=ociexecute($stmt,OCI_DEFAULT); $erra=OCIError(); $e=$erra['message']; $sorgutipi=ocistatementtype($stmt); $kayit_dizi=array(); $kayit_sayisi=-1; if($sonuc) { if($sorgutipi==SELECT) { $kayit_sayisi = OCIFetchStatement($stmt,$kayit_dizi,0,-1,OCI_FETCHSTATEMENT_BY_ROW); } else { $kayit_sayisi = ocirowcount($stmt); } } return array($sonuc,$kayit_sayisi,$kayit_dizi); } == I am using it for every kind of oracle db query. So my all queries under my control. Now I am looking for one function with PHP+MySQL Anybody know like short function as above php+oracle function? I am using some function sets they are using much database queries. I want to use min. query and connection. Thanks alot. Rasim [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Php-MySQL general function for insert, update,delete, count query
I wrote this one and use it in a lot of places ? //conn.php //check if a current session is in place and the user is correctly logged in //also check the calling page / domain to ensure the call only comes from //this domain -- this check may take a little configuration to get the //correct host name //echo server is : .$_SERVER['SERVER_NAME']; //use this the first time to get the host name...then comment it out or delete to complete the security check //if (($_SERVER['SERVER_NAME']!=www.fishinweather.com)){ if (($_SERVER['SERVER_NAME']!=localhost)){ echo piss off, hackers!; die(); } function connect($sql) { $username = *; $pwd= ; $host = localhost; $dbname = test; /* $username = fishinwe_alton; $pwd= cooperaz; $host = localhost; $dbname = fishinwe_fishinweather; */ if (!($conn=mysql_connect($host, $username, $pwd))) { printf(error connecting to DB. ); exit; } $db=mysql_select_db($dbname,$conn) or die(Unable to connect to database1.mysql_error()); $result = mysql_query($sql, $conn); if (!$result){ echo database query failed: . mysql_error(); }else{ return $result; }//end if }//end function ? bastien From: Rasim ÞEN [EMAIL PROTECTED] Reply-To: Rasim ÞEN [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Php-MySQL general function for insert, update,delete, count query Date: Sat, 25 Jun 2005 17:52:31 +0300 Hi friends, I am using one perfect function for my queries for PHP+Oracle pages, this is below == function sorgu($sql) { global $baglanti; $stmt=ociparse($baglanti,$sql); $sonuc=ociexecute($stmt,OCI_DEFAULT); $erra=OCIError(); $e=$erra['message']; $sorgutipi=ocistatementtype($stmt); $kayit_dizi=array(); $kayit_sayisi=-1; if($sonuc) { if($sorgutipi==SELECT) { $kayit_sayisi = OCIFetchStatement($stmt,$kayit_dizi,0,-1,OCI_FETCHSTATEMENT_BY_ROW); } else { $kayit_sayisi = ocirowcount($stmt); } } return array($sonuc,$kayit_sayisi,$kayit_dizi); } == I am using it for every kind of oracle db query. So my all queries under my control. Now I am looking for one function with PHP+MySQL Anybody know like short function as above php+oracle function? I am using some function sets they are using much database queries. I want to use min. query and connection. Thanks alot. Rasim [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/MySQL with Javascript
Hi there everyone, Just a quick question, I have a login system that stores whether you are logged in or not with a PHP Session. However, I need it so when people submit a form to add an item to their cart that Javascript can pickup the PHP Value of whether people are logged in or not. I don't really need code as I don't want to take anyones time up, but if someone could point me in the right direction of how I can use PHP Values in Javascript I would REALLY appreciate it. Chris
Re: [PHP-DB] PHP/MySQL with Javascript
You can have PHP generate a small javascript section where you define the variables or you can use cookies. - Frank Hi there everyone, Just a quick question, I have a login system that stores whether you are logged in or not with a PHP Session. However, I need it so when people submit a form to add an item to their cart that Javascript can pickup the PHP Value of whether people are logged in or not. I don't really need code as I don't want to take anyones time up, but if someone could point me in the right direction of how I can use PHP Values in Javascript I would REALLY appreciate it. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP/MySQL with Javascript
you can supply the value to js as a hidden variable in the form bastien From: Chris Payne [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] PHP/MySQL with Javascript Date: Wed, 15 Jun 2005 16:55:32 -0400 Hi there everyone, Just a quick question, I have a login system that stores whether you are logged in or not with a PHP Session. However, I need it so when people submit a form to add an item to their cart that Javascript can pickup the PHP Value of whether people are logged in or not. I don't really need code as I don't want to take anyones time up, but if someone could point me in the right direction of how I can use PHP Values in Javascript I would REALLY appreciate it. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/MySQL Access Denied
Everybody's favorite problem but this one is strange. I can connect to my mysql 4.1.7 database fine from the command line, but php won't connect no matter what I try, I always get the same error. Here is the script ?php $link = mysql_connect(localhost:3306, xoops, notmypassword ); /* check connection */ if (!$link) { printf(Connect failed: %s\n, mysql_error()); exit(); } /* close connection */ $mysql-close(); ? This is what I get, doesn't matter what username/password I use, or whether I use a socket or TCP/IP to connect. Access denied for user 'root'@'localhost' (using password: NO) I find it annoying that it insists I am trying to connect as root with no password, when that is not the case. I know about the 4.1 password issues and that should not have anything to do with this error. It also does this if I set the passwords to NULL in the script and database. Anyone have any help for me? Tod Schmidt System Administrator The Nature Conservancy [EMAIL PROTECTED] (703) 841-2028 (Phone) (703) 276-0713 (Fax) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP, MySQL and phpMyAdmin versions...
I am running MySQL 3.23.49 under Windows NT (XP Home). I also run PHP 4.3.9 on the same server, and use phpMyAdmin 2.6.0-pl2 for admin to my databases. I cannot upgrade to MySQL 4.x becuase apparently the MySQL API included with my PHP distro is not up to date enough to work with the revised security system in MySQL 4. I can't find a newer or better binary distro of PHP4 with a more suitable API, nor do i have the time, facilities or knowledge to bake my own from the source. Any suggestions, as I really need some of the facilities in MySQL 4.1.x? P.S. for Matrin Nowland - thanks for the help on the 'ON DUPLICATE KEY UPDATE' thing, I didn't realise it was a new thing in MySQL 4.1.0! goes away to kick himself ;-) -- Mark Benson http://homepage.mac.com/markbenson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP, MySQL and phpMyAdmin versions...
huh? you can and should be able to upgrade to 4.0.x without too many problems. PHP 4.3.9 has no problems with that, nor will PHPMyAdmin. Moving to mySQL 4.1 will involve more pain as the protocols are vastly different and uses a different php library (mysqli). For upgrade info see here (http://dev.mysql.com/doc/mysql/en/Upgrade.html) What you might want to do, is back up your v3 db. then install 4.0.x (they can co-exist on the same machine). Configure PHP and PHPMyAdmin to handle the new server as well, then migrate the data to the new server (in the case of MyISAM tables, just copy the folders from the v3 db to the data folder in the v4 db) hth bastien From: Mark Benson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP, MySQL and phpMyAdmin versions... Date: Fri, 17 Dec 2004 15:58:08 + I am running MySQL 3.23.49 under Windows NT (XP Home). I also run PHP 4.3.9 on the same server, and use phpMyAdmin 2.6.0-pl2 for admin to my databases. I cannot upgrade to MySQL 4.x becuase apparently the MySQL API included with my PHP distro is not up to date enough to work with the revised security system in MySQL 4. I can't find a newer or better binary distro of PHP4 with a more suitable API, nor do i have the time, facilities or knowledge to bake my own from the source. Any suggestions, as I really need some of the facilities in MySQL 4.1.x? P.S. for Matrin Nowland - thanks for the help on the 'ON DUPLICATE KEY UPDATE' thing, I didn't realise it was a new thing in MySQL 4.1.0! goes away to kick himself ;-) -- Mark Benson http://homepage.mac.com/markbenson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP, MySQL and phpMyAdmin versions...
-Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] huh? you can and should be able to upgrade to 4.0.x without too many problems. PHP 4.3.9 has no problems with that, nor will PHPMyAdmin. Moving to mySQL 4.1 will involve more pain as the protocols are vastly different and uses a different php library (mysqli). Which will, however, be almost completely pointless as the functionality he wants is only in 4.1. Also, it's not painful moving to mysql 4.1 at all - you can still use the mysql_* functions just fine. Mysqli_* functions are an option, not a requirement. Still, surely it can't be that hard to find mysql 4.1 for NT... http://dev.mysql.com/downloads/mysql/4.1.html#Windows Definitely read up on those upgrade/release notes! Windows binaries for php 4.10 / php 5 - these should be new enough to work with however the libraries bit works, so you'd just need to find the php mysql[i] windows library, driver, etc. whatever they call it. http://www.php.net/downloads.php Installing phpmyadmin is nothing, you just drop it in place essentially - works fine with php5 and mysql4.1 here. Cheers, - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php mysql dates
Hi all, currently I have a form which prompts for the user to choose a date. The dropdown lists are stored into variables: $month//e.g. January, February, ... $day //e.g 1 - 31 $year //e.g. 2004 (four digits) then combined into $articleDate How can I manipulate this variable to be in such a format that I can insert the information into a DATE column in a mySQL database. Dates are a bit of a mystery to me as PHP and MySQL handle them differently. Your help is appreciated. Thanks
RE: [PHP-DB] php mysql dates
Sure I understand Y-m-d. But won't the database cry because the Month is in text format? (January, february)? Thanks again. Subject: Re: [PHP-DB] php mysql dates On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr [EMAIL PROTECTED] wrote: Hi all, currently I have a form which prompts for the user to choose a date. The dropdown lists are stored into variables: $month//e.g. January, February, ... $day //e.g 1 - 31 $year //e.g. 2004 (four digits) then combined into $articleDate How can I manipulate this variable to be in such a format that I can insert the information into a DATE column in a mySQL database. Dates are a bit of a mystery to me as PHP and MySQL handle them differently. Your help is appreciated. Y-m-d -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql dates
On Wed, 28 Jul 2004 14:39:01 -0700, Irm Jr [EMAIL PROTECTED] wrote: Sure I understand Y-m-d. But won't the database cry because the Month is in text format? (January, february)? Thanks again. Whoops, I should read *all* the text of the question... Easiest way to deal with that, IMHO, is strtotime and date. $mysqlDate = date('Y-m-d', strtotime($month.' '.$day.', '.$year)); If you're using dates far in the past or future, though, this won't work. Better to use a date handling class, such as: http://pear.php.net/package/Date Subject: Re: [PHP-DB] php mysql dates On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr [EMAIL PROTECTED] wrote: Hi all, currently I have a form which prompts for the user to choose a date. The dropdown lists are stored into variables: $month//e.g. January, February, ... $day //e.g 1 - 31 $year //e.g. 2004 (four digits) then combined into $articleDate How can I manipulate this variable to be in such a format that I can insert the information into a DATE column in a mySQL database. Dates are a bit of a mystery to me as PHP and MySQL handle them differently. Your help is appreciated. Y-m-d -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php mysql dates
I would suggest creating the select dropdown so that the value is actually the numeric value of the month. i.e: select name=month id=month size=1 option value=01January/option option value=02February/option . . . /select Then you can do a simple concat before adding to the database. --Nicole --- Nicole Swan Web Programming Specialist Carroll College CCIT (406)447-4310 -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 3:44 PM To: Irm Jr Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] php mysql dates On Wed, 28 Jul 2004 14:39:01 -0700, Irm Jr [EMAIL PROTECTED] wrote: Sure I understand Y-m-d. But won't the database cry because the Month is in text format? (January, february)? Thanks again. Whoops, I should read *all* the text of the question... Easiest way to deal with that, IMHO, is strtotime and date. $mysqlDate = date('Y-m-d', strtotime($month.' '.$day.', '.$year)); If you're using dates far in the past or future, though, this won't work. Better to use a date handling class, such as: http://pear.php.net/package/Date Subject: Re: [PHP-DB] php mysql dates On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr [EMAIL PROTECTED] wrote: Hi all, currently I have a form which prompts for the user to choose a date. The dropdown lists are stored into variables: $month//e.g. January, February, ... $day //e.g 1 - 31 $year //e.g. 2004 (four digits) then combined into $articleDate How can I manipulate this variable to be in such a format that I can insert the information into a DATE column in a mySQL database. Dates are a bit of a mystery to me as PHP and MySQL handle them differently. Your help is appreciated. Y-m-d -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php mysql dates
Thanks for the replies. I believe I have two solutions now! Take care. Much apprecitated. -Original Message- From: Swan, Nicole [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 2:48 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] php mysql dates I would suggest creating the select dropdown so that the value is actually the numeric value of the month. i.e: select name=month id=month size=1 option value=01January/option option value=02February/option . . . /select Then you can do a simple concat before adding to the database. --Nicole --- Nicole Swan Web Programming Specialist Carroll College CCIT (406)447-4310 -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 28, 2004 3:44 PM To: Irm Jr Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] php mysql dates On Wed, 28 Jul 2004 14:39:01 -0700, Irm Jr [EMAIL PROTECTED] wrote: Sure I understand Y-m-d. But won't the database cry because the Month is in text format? (January, february)? Thanks again. Whoops, I should read *all* the text of the question... Easiest way to deal with that, IMHO, is strtotime and date. $mysqlDate = date('Y-m-d', strtotime($month.' '.$day.', '.$year)); If you're using dates far in the past or future, though, this won't work. Better to use a date handling class, such as: http://pear.php.net/package/Date Subject: Re: [PHP-DB] php mysql dates On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr [EMAIL PROTECTED] wrote: Hi all, currently I have a form which prompts for the user to choose a date. The dropdown lists are stored into variables: $month//e.g. January, February, ... $day //e.g 1 - 31 $year //e.g. 2004 (four digits) then combined into $articleDate How can I manipulate this variable to be in such a format that I can insert the information into a DATE column in a mySQL database. Dates are a bit of a mystery to me as PHP and MySQL handle them differently. Your help is appreciated. Y-m-d -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mysql dates
Dear Irm Jr, Here are two functions:: http::/www.php.net/strtotime http::/www.php.net/mktime using these functions togethor you can do the need full. BTW why not store just unix time stamp in mysql database. Most People use a string field in mysql database to store timestamp, it simply work without any problem. zareef ahmed --- Irm Jr [EMAIL PROTECTED] wrote: Hi all, currently I have a form which prompts for the user to choose a date. The dropdown lists are stored into variables: $month//e.g. January, February, ... $day //e.g 1 - 31 $year //e.g. 2004 (four digits) then combined into $articleDate How can I manipulate this variable to be in such a format that I can insert the information into a DATE column in a mySQL database. Dates are a bit of a mystery to me as PHP and MySQL handle them differently. Your help is appreciated. Thanks = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php/mysql error
I am getting a weird error on one of my servers that says something about query requires full tablescan. I was not getting this error until today that I noticed. I Googled for a minute and saw where a ton of other sites had the same problem but no reason why. I did find one board that said to turn off mysql.trace_mode in the php.ini file. I did this and it fixed the problem. Is there something different that I should be doing when I write code? Have I just band aided the problem or solved the problem? thanks, Doug -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Php-Mysql, select and update trouble
Dear Phpers, I have the following part of a script that retrieve an URL site. I'd like to count the clicks for every URL. I have added to mysql table a column hit. May anybody tell me how to insert into an sql selection also an update, referring to the HIT variable (i.e. to realize a select and update together) ? This is the select I'm using: ? require(../connection.php); $link = mysql_connect($host,$user,$password); $result=mysql_db_query($base,select url from .$baseofsites. where id=.$s. ,$link); $url = mysql_result($result,0,url); header(Location: .$url.); exit(); ? This should be (I suppose) the sql update I must include ... UPDATE table.sites SET hit = hit + 1 WHERE id=$s Thanks for all, Alessandro -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/MySQL learning project
Hi everyone! In trying to learn PHP and MySQL, I'm trying to create a web-based database application that will keep track of my movies. I have five tables (shown in the graphic). I'm trying to be able to display the results of the tables with one movie title, all of the actors associated with it, and all of the genre's associated with it. Of course I can do the query: Select * From MovieMain, MovieActor, MovieGenre, Genre, Actors Where MovieMain.MovieID=MovieGenre.MovieID And MovieMain.MovieID=MovieActor.MovieID And MovieActor.ActorID=Actors.ActorID And MovieGenre.GenreID=Genre.GenreID But that displays the movie title for every genre and actor there is. Is there another way to perform the query that will display the title once, and all of the associated genres and all of the associated actors for that movie? Or should I try to code it using PHP to find the movie title first? Thanks in advance, everyone! begin 666 Drawing1.jpg M_]C_X `02D9)[EMAIL PROTECTED] [EMAIL PROTECTED]@!@!0@'!P)[EMAIL PROTECTED] L+ M#!D2$P\4'1H?'AT:'!P@)XG((L(QP*#I+# Q-#0T'RY/[EMAIL PROTECTED]/XS-#+_ MVP!#`0D)[EMAIL PROTECTED]@R(1PA,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R M,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C+_P `1 !8`KD#`2(``A$!`Q$!_\0` M'P```04!`0$!`0$```$`P0%!@(0H+_\0`M1 [EMAIL PROTECTED]($`P4% M! 0```%]`0(#``01!1(A,4$$U%A!R)Q%#*!D:$((T*QP152T? D,V)R@@D* M%A81HE)BH*2HT-38W.#DZ0T1%1D=(24I35%565UA96F-D969G:EJW1U M=G=X7J#A(6AXB)BI*3E)66EYB9FJ*CI*6FIZBIJK*SM+6VM[BYNL+#Q,7 MQ\C)RM+3U-76U]C9VN'BX^3EYN?HZKQ\O/T]?;W^/GZ_\0`'P$``P$!`0$! M`0$!`0$`P0%!@([EMAIL PROTECTED]! 0#! %! 0``0)W``$ M`Q$$!2$Q!A)!40=A1,B,H$(%$*1H;'!2,S4O 58G+1A8D-.$E\181HF M)[EMAIL PROTECTED]@Y.D-$149'2$E*4U155E=865IC95F9VAI:G-T=79W'[EMAIL PROTECTED] MA8:'B(F*DI.4E9:7F)F:HJ.DI::GJ*FJLK.TM;:WN+FZPL/$Q;'R,G*TM/4 MU=;7V-G:XN/DY;GZ.GJ\O/T]?;W^/GZ_]H`# ,!``(1`Q$`/P#H=)T^._T] M;JYN;]YI))S?;YAGYV[!\5=_L.T_PM_\`^#?_P+IOAW_D0_P_)_Z MU:E ;_8=I_SUO\`_P`$_\`\71_8=I_SUO_`/P83_\`Q=:5% ;_8=I_P`] M;_\`\$__P`71_8=I_SUO_\`P83_`/Q=.UV[FL- U[MQF:W1.,\A205A MW%K::,]EH=5E=I(?,OXY_,23P7#AGY#9'09!'[EMAIL PROTECTED]:_L.T_PM_\`^#? M_P+H_L.T_YZW_\`X,)__BZR(_$UY-J4BQ6KO;IFT,:6[EMAIL PROTECTED]:3S0-G!R= MOH.N*=I.N:I?V=7*68MKVYFMPD:L'38)[EMAIL PROTECTED].,[EMAIL PROTECTED] MM_\`^#?_P+H_L.T_YZW_\`X,)__BZY^+Q1JIT_2I)TMEFU-3)'Y-M+-Y2* MN3E%.YCRO3 3Z]%HU]-J.G+-6[PS!V1E:-H]V#C`P! (PF=J _V' M:?\`/6__`/!A/_\`%T?V':?\];__`,$_P#\76E10!F_V':?\];_`/\`!A/_ M`/%T?V':?\];_P#\$__`,76E10!M^ I))/!MH999)666= [EMAIL PROTECTED] M`'X5TES\/\`_D3;7_KO_\`H^2NFH BBB@ KQW0-.COO#VG7=SZA M)/-;I)(YU;[EMAIL PROTECTED]/7L5S221?2)XI9(I!IT6'C8JPX7H1TH`Z'^P[3_G [EMAIL PROTECTED]/[#M/\`GK?_`/@PG_\`BZY2[U*]N-+TRS%S(MU8W*^D1R MQCF6( G_`]V_P!PM;;:W?A9+[R[;[ E]]C,6,I'F^5OW9P/FYVXZ=Z`-#^ MP[3_`)ZW_P#X,)__`([EMAIL PROTECTED];XMS!$;N!+LW:@L MH1(E.TC!R-VZ(CGH3Z5$?%-ZIE2VMD%I#6B6UGF:=FC5R!(N0G# #=G)ZX M'- _P#V':?\];__`,$_P#\71_8=I_SUO\`_P`$_\`\760\,JW^KS7B7= MR+.9(H+.4QD+Y:MOQN7))\GH%XJ+Q%)!;V5C:FZ:1C;Y;NUDN9$$3[-K M+$22L!N)[9.2: [EMAIL PROTECTED]/BZ/[#M/^M_P#^#?_`.+K(M] MUG4+RTM;VM[266SDN)/M44F0RR;,!J'KS@@'O3/\`A)K]XUNXX+9;6+28 MM2G5MQ[EMAIL PROTECTED]@#A[EMAIL PROTECTED]/^M_P#^#?_`.+K3\'1?8_%U];13W+0 MPCDV37$DHW8PR-Q..*Y[1-:O;Z[2ZMV*20;YJVT*QL/D)DR#D$8^ MZ.E=+X8_P1XO/^P;'_`.CH [EMAIL PROTECTED] /,M5M1J'C+717%X5 MAEA2-8[N6-5!A0D`*P'4D_C4?]AVG_/6_P#_``83_P#Q=6Y_^1R\1_\`7#_ M`-$1U/0!F_V':?\`/6__`/!A/_\`%T?V':?\];__`,$_P#\76E7%#4Y=-\ M:I/=7,G]G$+R,YV1L(1(!VR%D''4D4`='_`':?\];_P#\$__`,71_8=I M_P`];_\`\$__P`77/:/?:G;)+:NP:_O=2Q_I)9EM]UNDS+C.2%^8!01]16A M'XAN()@M^END4-W):7,R9AO+$B.`2[EMAIL PROTECTED](.2.:`-'^P[3_`)ZW_P#X,)__ M`([EMAIL PROTECTED])?%%U;R+RV8$\]C#)'#(VTRSE$!09R0# M3D#M3=7O]1U;1;FRWW%K(;NUBCO([6UWB20 X5^01WP2,$M '2_V':?\` M/6__`/!A/_\`%T?V':?\];__`,$_P#\77-OK%SJUWH,LKPK$T9NT1B`97) M0H==NR3(/J*OVGBZGUFTMRUO+;7,TL0,5O* FU78$2GY),[.0`.O@#5_L M.T_YZW__`(,)[EMAIL PROTECTED])M/A%DEID6DQ7K? MYDA).\; 2V?)]XDD^.LM9_M5G!;=OFQJ^W.94`4_[#M/^M__`.# [EMAIL PROTECTED]/BZTJ* -GP[EMAIL PROTECTED]748:5R[;5N)%4$D MDG `'/I735S'P_\`^10B_POR\_]*I:Z@```.0\2W B6T%YV MR7%\R2M;3-S*()[EMAIL PROTECTED]=;_\`!E-_\56]XZ_X^O#?_80? M_P!)IJX_P!2O+/QY;)Y[?VUO%%+%_'D:0*_UW(J_\H VO[-E_P@SK?_ M`(,IO_BJ/[-E_P@SK?_`(,IO_BJYVPU^[2YU6\DWW,S6_V*WSM))'C3![ [EMAIL PROTECTED]()H+LVM[9+'(DT,[EMAIL PROTECTED]/WUVD$#Y- %[^S9?\` MH,ZW_P#*;_XJC^S9?\`H,ZW_P#*;_XJL;Q1'ZWLD4BVJ0WDBE901(D+( M-V,=^\#USPMGXRM9%NC_9E%O:M=LUMH5?O*3MY'J#V- O\`V;+_ M`-!G6_\`P93?_%4?V;+_`-!G6_\`P93?_%5SGAWQ*JV^HB_U*]VHDP.K ME$*Y,[EMAIL PROTECTED]MMFNDT^VD_M'(+D.`=5*G*?PP(Y//'(!M M?V;+_P!!G6__``93?_%4?V;+_P!!G6__``93?_%5FW'[EMAIL PROTECTED] M2^0^[Y=Q1=OS!=WC.#^-W2=3NM2ENVSCAMH9Y8$3[FHY4G;M `./4_U MH Z3P'+$:W;3WESI;WRI$US,[EMAIL PROTECTED]W.,L3^-=?7'^!?^/KQ)_V$$_] M)H:[@[EMAIL PROTECTED]FPK--DVHQQR3*T99=KG5(.,@?E76UR7C[_CQ MTC_L*1?^@/0!S?\`8=I_SUO_`/P83_\`Q=']AVG_`#UO_P#P83__`!=:5% M;_8=I_SUO_\`P83_`/Q=']AVG_/6_P#_``83_P#Q=:5%`;_`':?\];_P#\ M$__`,71_8=I_P`];_\`\$__P`77,P:_GQ2M[Y]R;6Z:P$6Q_*8 20-C9 MDR!AUSAQZ5MVNH:I?$W,'V%+1IY8$24-O[EMAIL PROTECTED]/RX'!ZT 6_PP[3_G
[PHP-DB] PHP / MySQL Developer
Hi All, This is just a request to all you programmers out there, I have been programming using PHP/MySql for approx 5 years now. I was involved in a motor car accident last year October and I broke my back in 3 places, this has left me paralyzed from the waist down but luckily my I can still code. What I am looking for is any freelance work that you may be able to throw my way I am prepared to do anything Please mail me Regards Kenny [EMAIL PROTECTED]
[PHP-DB] php-mysql problem
have redhat 9.0 and Server version: Apache/2.0.40. i have installed rpms php-4.2.2-17.2.i386.rpm php-mysql-4.2.2-17.2.i386.rpm After i create a database called mydb and serveral tables in mysql, I tried to run following testdb.php script -- html body ?php $db = mysql_connect(localhost, root,xx); mysql_select_db(mydb,$db); $result = mysql_query(SELECT * FROM employees,$db); printf(First Name: %sbr\n, mysql_result($result,0,first)); printf(Last Name: %sbr\n, mysql_result($result,0,last)); printf(Address: %sbr\n, mysql_result($result,0,address)); printf(Position: %sbr\n, mysql_result($result,0,position)); ? /body /html --- but i got error message with: http://coopunit.forestry.uga.edu:8080/testdb.php the error is: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/testdb.php on line 13 How can Fix this problem? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php-mysql problem
hello, did you load the mysql module in your php.ini configuration file? i.e. is the following line there: extension=mysql.so regards On Thu, 13 May 2004 11:47:41 -0400 Jianping Zhu [EMAIL PROTECTED] wrote: have redhat 9.0 and Server version: Apache/2.0.40. i have installed rpms php-4.2.2-17.2.i386.rpm php-mysql-4.2.2-17.2.i386.rpm After i create a database called mydb and serveral tables in mysql, I tried to run following testdb.php script -- html body ?php $db = mysql_connect(localhost, root,xx); mysql_select_db(mydb,$db); $result = mysql_query(SELECT * FROM employees,$db); printf(First Name: %sbr\n, mysql_result($result,0,first)); printf(Last Name: %sbr\n, mysql_result($result,0,last)); printf(Address: %sbr\n, mysql_result($result,0,address)); printf(Position: %sbr\n, mysql_result($result,0,position)); ? /body /html --- but i got error message with: http://coopunit.forestry.uga.edu:8080/testdb.php the error is: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/testdb.php on line 13 How can Fix this problem? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] php, mysql security question
Hi, I have a php, mysql security question. You know how there is a way to enable/disable hot linking to your images via CPanel to allow/disallow people to link to your images from an external site? Well is there a way to allow/disable external sites connecting to a mysql via PHP? So is there a way to allow only localhost access to the db's somehow? I wonder this to add extra security to my db's and not only that to educate others on this list if it is possible or not. Thanks for your time. J Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php, mysql security question
JeRRy wrote: You know how there is a way to enable/disable hot linking to your images via CPanel to allow/disallow people to link to your images from an external site? Well is there a way to allow/disable external sites connecting to a mysql via PHP? So is there a way to allow only localhost access to the db's somehow? I wonder this to add extra security to my db's and not only that to educate others on this list if it is possible or not. Yes, it's possible and recommended. This would be better asked on a MySQL forum or email list, though. You give permission for each user to connect from a specific host when you GRANT them permissions. Read the MySQL manual about the GRANT command. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: spam: [PHP-DB] php, mysql security question
JeRRy wrote: Hi, I have a php, mysql security question. You know how there is a way to enable/disable hot linking to your images via CPanel to allow/disallow people to link to your images from an external site? Well is there a way to allow/disable external sites connecting to a mysql via PHP? So is there a way to allow only localhost access to the db's somehow? I wonder this to add extra security to my db's and not only that to educate others on this list if it is possible or not. Thanks for your time. J Even if your db server doesn't sit behind a firewall, you can always restrict what userid/password/address combinations can gain access to what DB / Tables / Columns and what functions they can perform (select, insert, update, etc.) in those areas using the MySQL administration features. I have different PHPUsers for my scripts that have varying levels of authorization to coincide with what the scripts need to do -- Select (read only), Update (can only revise existing records), Insert (can add new new records), etc. All the db_connect scripts are well_outside the public areas to minimize opportunities to compromise the userid/pw. Start here: http://www.mysql.com/doc/en/Security.html All of which forces the conclusion that this isn't a PHP issue at all. DT -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP-DB] php, mysql security question]
Oops. For some reason my filter concluded your email was spam and it modifies the subject line. I missed cleaning the subject line on the first reply. Here is is again in case others filter on that keyword. I apologize for the double post and possible confusion. \Doug JeRRy wrote: Hi, I have a php, mysql security question. You know how there is a way to enable/disable hot linking to your images via CPanel to allow/disallow people to link to your images from an external site? Well is there a way to allow/disable external sites connecting to a mysql via PHP? So is there a way to allow only localhost access to the db's somehow? I wonder this to add extra security to my db's and not only that to educate others on this list if it is possible or not. Thanks for your time. J Even if your db server doesn't sit behind a firewall, you can always restrict what userid/password/address combinations can gain access to what DB / Tables / Columns and what functions they can perform (select, insert, update, etc.) in those areas using the MySQL administration features. I have different PHPUsers for my scripts that have varying levels of authorization to coincide with what the scripts need to do -- Select (read only), Update (can only revise existing records), Insert (can add new new records), etc. All the db_connect scripts are well_outside the public areas to minimize opportunities to compromise the userid/pw. Start here: http://www.mysql.com/doc/en/Security.html All of which forces the conclusion that this isn't a PHP issue at all. DT -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php