Re: [PHP-DB] Subject Matter
On Fri, Aug 23, 2013 at 4:21 AM, Matijn Woudt tijn...@gmail.com wrote: The problem is: there is no maintainer;) Sure there is. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Subject Matter
On Tue, Aug 27, 2013 at 12:10 PM, Matijn Woudt tijn...@gmail.com wrote: Uh, you're right. I meant moderator.. Yeah, as far as moderation, we only do in extreme circumstances. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql query
Ethan, It's hard to tell from the code formatting in your email what the exact problem might be, but a few reasons that this might fail in PHP rather than when sent to MySQL with hardcoded values: 1. var_dump/print_r $_POST to see what you're getting as input is what you expect (and sanitize!). 2. Check that the SQL statement concatenation in PHP is building the string you're expecting. It looks like you're joining 2 strings when defining $sql2 that doesn't leave a space between the close parentheses and values. Compare this against what you're sending on the command line. 3. Get rid of all single quotes... escape your double quotes where needed. This will avoid any variable-in-string interpolation errors and may help you find the issue with input data. Same with your echo $sql2 statement... that's not going to give you the same thing as the print_r below it. Thanks, Daniel Krook Software Engineer, Advanced Cloud Solutions, GTS IBM Senior Certified IT Specialist - L3 Thought Leader The Open Group Certified IT Specialist - L3 Distinguished Cloud, Java, PHP, BlackBerry, DB2 Solaris Certified Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote on 08/21/2013 07:48:12 PM: From: Ethan Rosenberg erosenb...@hygeiabiomedical.com To: PHP Database List php-db@lists.php.net Date: 08/21/2013 07:48 PM Subject: [PHP-DB] mysql query Dear List - I can't figure this out mysql describe Inventory; +-+-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | +-+-+--+-+-+---+ | UPC | varchar(14) | YES | | NULL | | | quant | int(5) | NO | | NULL | | | manuf | varchar(20) | YES | | NULL | | | item| varchar(50) | YES | | NULL | | | orderpt | tinyint(4) | NO | | NULL | | | ordrpt_flag | tinyint(3) | YES | | NULL | | | stock | int(3) | YES | | NULL | | +-+-+--+-+-+---+ Here are code snippets - $upc = $_SESSION['UPC']; $qnt = $_POST['quant']; $mnf = $_POST['manuf']; $itm = $_POST['item']; $odrpt = $_POST['oderpt']; $opf = $_POST['ordrpt_flag']; $stk= $_POST['stock']; $sql2 = insert into Inventory (UPC, quant, manuf, item, orderpt, ordrpt_flag, stock) .values ('$upc', $qnt,'$mnf','$itm', odrpt, 0, $stk); $result2 = mysqli_query(cxn, $sql2); echo '$sql2br /'; print_r($sql2); echo br /$upc $qnt $mnf $itm $odrpt $opf $stkkbr /; if (!$result2) die('Could not enter data: ' . mysqli_error()); The mysql query fails. I cannot figure out why. It works from the command line. TIA Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql query
Ethan, What about: $result2 = mysqli_query(cxn, $sql2); Doesn't look like you're sending it a connection link as a variable ($cxn) and that's passed through as a literal? Thanks, Daniel Krook Software Engineer, Advanced Cloud Solutions, GTS IBM Senior Certified IT Specialist - L3 Thought Leader The Open Group Certified IT Specialist - L3 Distinguished Cloud, Java, PHP, BlackBerry, DB2 Solaris Certified Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote on 08/21/2013 11:59:19 PM: From: Ethan Rosenberg erosenb...@hygeiabiomedical.com To: Daniel Krook/White Plains/IBM@IBMUS Cc: PHP Database List php-db@lists.php.net Date: 08/21/2013 11:59 PM Subject: Re: [PHP-DB] mysql query On 08/21/2013 11:30 PM, Daniel Krook wrote: Ethan, It's hard to tell from the code formatting in your email what the exact problem might be, but a few reasons that this might fail in PHP rather than when sent to MySQL with hardcoded values: 1. var_dump/print_r $_POST to see what you're getting as input is what you expect (and sanitize!). 2. Check that the SQL statement concatenation in PHP is building the string you're expecting. It looks like you're joining 2 strings when defining $sql2 that doesn't leave a space between the close parentheses and values. Compare this against what you're sending on the command line. 3. Get rid of all single quotes... escape your double quotes where needed. This will avoid any variable-in-string interpolation errors and may help you find the issue with input data. Same with your echo $sql2 statement... that's not going to give you the same thing as the print_r below it. Thanks, Daniel Krook Software Engineer, Advanced Cloud Solutions, GTS IBM Senior Certified IT Specialist - L3 Thought Leader The Open Group Certified IT Specialist - L3 Distinguished Cloud, Java, PHP, BlackBerry, DB2 Solaris Certified Ethan Rosenberg erosenb...@hygeiabiomedical.com wrote on 08/21/ 2013 07:48:12 PM: From: Ethan Rosenberg erosenb...@hygeiabiomedical.com To: PHP Database List php-db@lists.php.net Date: 08/21/2013 07:48 PM Subject: [PHP-DB] mysql query Dear List - I can't figure this out mysql describe Inventory; +-+-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | +-+-+--+-+-+---+ | UPC | varchar(14) | YES | | NULL | | | quant | int(5) | NO | | NULL | | | manuf | varchar(20) | YES | | NULL | | | item| varchar(50) | YES | | NULL | | | orderpt | tinyint(4) | NO | | NULL | | | ordrpt_flag | tinyint(3) | YES | | NULL | | | stock | int(3) | YES | | NULL | | +-+-+--+-+-+---+ Here are code snippets - $upc = $_SESSION['UPC']; $qnt = $_POST['quant']; $mnf = $_POST['manuf']; $itm = $_POST['item']; $odrpt = $_POST['oderpt']; $opf = $_POST['ordrpt_flag']; $stk= $_POST['stock']; $sql2 = insert into Inventory (UPC, quant, manuf, item, orderpt, ordrpt_flag, stock) .values ('$upc', $qnt,'$mnf','$itm', odrpt, 0, $stk); $result2 = mysqli_query(cxn, $sql2); echo '$sql2br /'; print_r($sql2); echo br /$upc $qnt $mnf $itm $odrpt $opf $stkkbr /; if (!$result2) die('Could not enter data: ' . mysqli_error()); The mysql query fails. I cannot figure out why. It works from the command line. TIA Ethan Daniel - Thanks. Tried all your suggestions. Sorry, no luck. Ethan
Re: [PHP-DB] Gnome Desktop Button
On Tue, Nov 27, 2012 at 5:31 PM, Ethan Rosenberg, PhD erosenb...@hygeiabiomedical.com wrote: Dear list - Maybe this fell thru the cracks, so here it is again. Is there a way to have a button in the tray that will minimize all the windows and show the desktop? Well, it's neither a PHP nor database question, so that may be why it wasn't even noticed before (I know I didn't see it). That said, button-wise I'm not sure, but you could do a keystroke combination. Go to System Systems - Keyboard, click the Shortcuts tab, Navigation, and then bind Hide all normal windows. By default, GNOME generally comes with it set to either CTRL+ALT+D or CTRL+Super+D (where, on most keyboards, Super is the Windows key). Checking mine, it does indeed toggle all windows with CTRL+Windows_Key+D. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Vulnerability Announced in phpMyAdmin
Thank you for the heads up. On 9/26/12, tamouse mailing lists tamouse.li...@gmail.com wrote: On Tue, Sep 25, 2012 at 3:20 PM, Daniel Brown danbr...@php.net wrote: Just a three-list cross-post to bring it to everyone's attention at once, in case you weren't already aware. It was announced today that a compromised SourceForge mirror was distributing a malicious file with the phpMyAdmin package that allows an attacker to arbitrarily execute code on a server hosting the exploitable package. Obligatory (not intentionally self-serving) social media link here: https://twitter.com/oidk/status/250688002005811200 Signal boosting... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Daniel Fenn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Vulnerability Announced in phpMyAdmin
Afternoon, folks; Just a three-list cross-post to bring it to everyone's attention at once, in case you weren't already aware. It was announced today that a compromised SourceForge mirror was distributing a malicious file with the phpMyAdmin package that allows an attacker to arbitrarily execute code on a server hosting the exploitable package. Obligatory (not intentionally self-serving) social media link here: https://twitter.com/oidk/status/250688002005811200 I don't especially know how this might affect other projects that are hosting on the same mirror, but I hope at least some of the more popular projects will take a moment to verify the integrity of their packages on the affected mirror ('cdnetworks-kr-1' mirror in Korea, for those interested). Those of you who have phpMyAdmin installed should check immediately to see if your installation is vulnerable to the exploit, particularly if it's auto-updated or has been installed or updated recently. We now return you to your regularly-scheduled Tuesday (unless you're east of the EEST time zone, in which case, Happy Hump Day). -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Unsubscribe me Please
On Fri, Sep 21, 2012 at 11:17 PM, Sam js...@yahoo.com wrote: I saw where you did it for others. I will just block your address thx Sent from Sam's IPad And yet you missed that I said I wouldn't be doing it in lieu of following the obvious unsubscription instructions. Please do block all of our addresses, as they are intended for technical folks, not the general web community. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unsubscribe me please
On Thu, Sep 20, 2012 at 9:29 PM, Alan Vickers alanvick...@cox.net wrote: Please remove me, too. Thanks! Please follow the unsubscription instructions as posted all over, included in the foot of every single list message, and as I posted twice in this thread yesterday. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unsubscribe me please
On Wed, Sep 19, 2012 at 6:43 PM, Graham H. mene...@gmail.com wrote: Hi, I tried unsubscribing from the list, but I was unsuccessful, I believe because when I subscribed I cleverly added +php to the end of my email address (for Gmail filtering). Could I be removed please? Thanks. No problem, I'll remove you, Graham. I guess I'll remove the rest from this thread, too, rather than have them unsubscribe the right way (php-db-unsubscr...@lists.php.net or http://php.net/mailinglists, for anyone else who may be wondering). -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unsubscribe me please
On Thu, Sep 20, 2012 at 11:51 AM, Valentin Nedkov mana...@bds.bg wrote: Hello, please, unsubscribe me too. Sure. It seems no one knows the unsubscription instructions. So, for all others: From your subscribed email address, send a blank message to php-db-unsubscr...@lists.php.net. - OR - Go to http://php.net/mailinglists and select the list from which you want to unsubscribe, enter your address, and click the Unsubscribe button. No further manual requests will be processed today. Sorry for the inconvenience. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unsubscribing
On Tue, Sep 11, 2012 at 3:37 AM, Aaron Wood - Slurpy Studios aa...@slurpystudios.com wrote: Hello, I have been trying to unsubscribe from this list, but it doesn't seem to be stopping - could you look into it for me and take me off the list? I've removed you from php-db@lists.php.net manually just now, Aaron. Sorry you were having trouble. Below you'll see the command history, for verification of your removal. I've masked your email address in this email for your privacy and protection. # ezmlm-list ~ezmlm/php-db | grep slurpy {...}@slurpy{...} # ezmlm-unsub ~ezmlm/php-db {...}@slurpy{...} # ezmlm-list ~ezmlm/php-db | grep slurpy # If you have any questions or concerns, or have any further issues with our mailing list subscription services, please don't hesitate to let us know. Thanks. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Test 2 w/copy
Looks like your mail from string in your email headers is coming through blank to the server. Can you check your email client settings and see if that fixes it? Also, if you have access to Earthlink webmail, try sending an email from there. On Fri, Aug 31, 2012 at 1:23 PM, Ethan Rosenberg eth...@earthlink.net wrote: Dan - Dear list - I am not receiving replies. I have been instructed to send a test email. Ethan -- -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] echo into variable or the like
On Tue, Aug 21, 2012 at 12:01 AM, s@optusnet.com.au wrote: Hi, this is my first post so forgive me if I missed a rule and do something wrong. I have this code, echo $_SERVER['PHP_SELF'].?; foreach ($_GET as $urlvar=$urlval) echo $urlvar.=.$urlval.; It works by it’s self. I want to insert the output in a table. Is there a way to ‘echo’ into a variable(i.e. make the output of this echo the value of a variable) or am I on the wrong track all together? This question actually belongs on the PHP General mailing list. As for echoing into a variable, the only way that's really possible is with output buffering (ob_start(), ob_get_contents(), ob_end_clean(), et al). However, you don't need (and shouldn't want) to do this here. Instead, as your snippet really won't do much of anything useful, you should (entirely) rewrite your code to look something like this, for an HTML table: ?php echo $_SERVER['PHP_SELF'].'?'.PHP_EOL; echo 'table'.PHP_EOL; foreach ($_GET as $key = $value) { echo ' tr'.PHP_EOL; echo ' td'.$key.'/td'.PHP_EOL; echo ' td'.$value.'/td'.PHP_EOL; echo ' /tr'.PHP_EOL; } echo '/table'; ? However, since it looks almost as if you're trying to build a query string based upon the supplied GET variables, you may want to try looking into http_build_query(). -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Installing IBM DB2 drivers onto an Apache Server under Fedora 16 x64 to access IBM POWER7 DB2 via PHP....
Hi Charles, So you just need to get the Apache on Fedora configured to connect to the DB2 servers on AIX? This is a good a list to ask as any :) Here are the steps I would take (some of which you might have already done... so it's up to you whether you want to start fresh or tweak my instructions). This is based on RHEL / CentOS using DB2 v9.7, so it might be slightly different for you. (Sorry for the top post, it's easier to write this all up front.) 1. Download the DB2 Runtime Client. Based on the specs you mention, it would be: IBM Data Server Runtime Client (Linux AMD64 and Intel EM64T) ibm_data_server_runtime_client_linuxx64_v10.1.tar.gz (613 MB) 2. Install and configure the DB2 RC (I use 9.7, so modify this for 10.1): tar -xzvf ibm_data_server_runtime_client_linuxx64_v9.7.tar.gz cd rtcl echo no rsp.txt ./db2_install rsp.txt groupadd db2iadm1 useradd db2inst1 -g db2iadm1 /opt/ibm/db2/V9.7/instance/db2icrt -s client db2inst1 echo '. /home/db2inst1/sqllib/db2profile' /etc/sysconfig/httpd # Assuming yum install of httpd... otherwise put it in apachectl 2. Then either download the PHP and IBM DB2 extension source (instructions here: http://us.php.net/manual/en/ibm-db2.installation.php), or use Zend Server (which I recommend if you want to manage everything with yum, including the DB2 drivers). http://www.zend.com/en/products/server/downloads Install, then add the php-5.3-ibmdb2-zend-server extra package (you could also install the PDO one). 3. Catalog the remote system (optional... you'd just use a lengthier connection string in step 4) . /home/db2inst1/sqllib/db2profile db2 catalog tcpip node aixbox1 remote db2.example.com server 5 remote_instance db2inst1 ostype aix db2 catalog database sample as sample at node aixbox1 4. Test your connection from /var/www/html/index.php. $conn_resource = db2_connect($db2_name, $db2_user, $db2_pass); if ($conn_resource) { echo 'Connection to database succeeded.'; db2_close($conn_resource); } else { echo 'Connection to database failed.br /'; echo 'SQLSTATE: ' . db2_conn_error() . 'br /'; echo 'Message: ' . db2_conn_errormsg(). 'br /'; } Hope that gets you on the right track. Thanks, -Dan Daniel Krook, IBM L2 Certified IT Specialist Software Engineer, Advanced Cloud Technology, GTS, IBM Cloud Architecture, Java EE, PHP, BlackBerry, DB2 Solaris Certified Charles W Buege cbu...@moreycorp.com wrote on 05/11/2012 09:48:08 AM: From: Charles W Buege cbu...@moreycorp.com To: php-db@lists.php.net Date: 05/11/2012 09:52 AM Subject: [PHP-DB] Installing IBM DB2 drivers onto an Apache Server under Fedora 16 x64 to access IBM POWER7 DB2 via PHP All - I know that this topic only vaguely relates to this mailing list, but I thought I'd start here. If anyone has a better location for me to look at for this information, please feel free to tell me. Okay, here's my scenario. We are an IBM POWER7 shop and have several instances of Apache running on our POWER7 for customer information lookup, part ordering, etc. What I am attempting to do is setup a web server as a virtual machine in Fedora 16 as a front- end to all of these servers to perform the following tasks: - centralized access to all of the sites - a table of contents/central portal - a server that, when the POWER7 is down for backup and/or maintenance, it can provide a 'Temporarily Out Of Service' message to any users attempting to access these sites with a message of 'The system is down for (whatever the reason). It will be back up by (time).' - Another development/deployment platform other than our POWER7 for testing/learning/etc. since setting up a virtual host on Apache under Linux means that it is something that I can do instead of involving our POWER7 administrator since he is as busy as I am Here is what I have done so far. I've got the Apache running on the Fedora 16 box no problem. I'm getting good phpinfo() results, so all good there. I'm trying to follow IBM's instructions for getting DB2 drivers using the following sites: Setting up the PHP environment on Linux or UNIX - http:// publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=% 2Fcom.ibm.swg.im.dbclient.php.doc%2Fdoc%2Ft0011926.html which lead me to this page to get the IBM Data Server Driver Package mentioned in bullet point three Download initial Version 10.1 clients and drivers - http:// www-01.ibm.com/support/docview.wss?uid=swg21385217 which I did download and that page sent me to here: Installing IBM Data Server Driver Package (Linux and UNIX) - http:// publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=% 2Fcom.ibm.swg.im.dbclient.install.doc%2Fdoc%2Ft0054799.html where, after reading this page, I attempted to run the installDSDriver which apparently requires ksh to be installed to run so I downloaded
Re: [PHP-DB] MOD_Rewrite
On Tue, Sep 20, 2011 at 17:01, Gavin Chalkley gavin.chalk...@gmail.com wrote: Hey all, I am trying to use MOD_Rewrite with EasyPHP. I have this in my htaccess: RewriteEngine On RewriteBase / RewriteRule ^([0-9]+)/?$ main_index.php?key=$1 My main page is MAIN_INDEX.PHP my db identifier is KEY How ever i have never done any MOD_REWRITE so look at the following: http://www.knowledgesutra.com/forums/topic/10219-php-mod-rewrite-tutorial/ But i cannot get this to function. What I am trying to do is www.website.com/KEYNUMBER Could some one kindly help me out?? This is not a PHP question, but rather a mod_rewrite question. Further, it has very little to do with databases, so it's not pertinent to this list in that respect either. Finally, we ARE NOT associated with EasyPHP, we DO NOT support it, and we DO NOT endorse it by any means whatsoever. To get the answers you need to your questions, please contact a mod_rewrite group or the Apache httpd mailing list. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSsql madness
On Fri, Jun 24, 2011 at 16:07, Paul Wilson paulwilso...@gmail.com wrote: please remove me from this list Email php-db-unsubscr...@lists.php.net. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] radio form submission
On Thu, Jun 23, 2011 at 15:46, Chris Stinemetz chrisstinem...@gmail.com wrote: Use an if or a switch. For example: I think your suggestions are exactly what I am looking for. I am not sure exactly where to place it. Do I insert it after the query statment? During your while() loop. This line here: td class=post-content' . $posts_row['post_tptest'] . If you convert it to a function as Karl suggested, you could do something like this: td class=post-content' . getSpeed($posts_row['post_tptest']) . -- /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
Re: [PHP-DB] radio form submission
On Thu, Jun 23, 2011 at 16:08, Chris Stinemetz chrisstinem...@gmail.com wrote: I must be missing something. I am just getting a blank page. Your help is greatly apprecieated. This is why you're supposed to take the advice and write it out yourself, not copy and paste the code. ;-P By copying and pasting the stuff, you broke your query. Karl suggested you use a column which doesn't exist. Instead, change the query back to what it was before, add the function (you should be able to copy and paste that part though) at the end of the file, and then use the line of code I gave you. Obviously, I can't write it out for you, but you'll get the idea. The function and query statement is: function getSpeed($val) { if($val != 'undefined') { switch ($val){ case 1: $post_tptest = 0-250kbps; break; case 2: $post_tptest = 250-300kbps; break; case 3: $post_tptest = 300-400kbps; break; case 4: $post_tptest = 400-600kbps; break; case 5: $post_tptest = 600kbps-3.8mbps; break; default: $post_tptest = Speed Undetected; // or 0-250kbps break; } } else { return(Error, no speed value set); } } } $post_speed = getSpeed($post_tptest); //fetch the posts from the database $posts_sql = SELECT posts.post_store, posts.post_content, posts.post_speed, posts.post_date, posts.post_by, users.user_id, users.user_name, users.first_name, users.last_name FROM posts LEFT JOIN users ON posts.post_by = users.user_id WHERE posts.post_store = . mysql_real_escape_string($_GET['id']) . ORDER BY posts.post_date DESC ; The call: while($posts_row = mysql_fetch_assoc($posts_result)) { echo 'tr class=topic-post td class=user-post' . $posts_row['first_name'] . ' ' . $posts_row['last_name'] . 'br/' . date('m-d-Y h:iA', strtotime($posts_row['post_date'])) . '/td td class=post-content' . getSpeed($posts_row['post_tptest']) . 'br/' . htmlentities(stripslashes($posts_row['post_content'])) . '/td /tr'; } } Thank you! -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/
Re: [PHP-DB] radio form submission
On Thu, Jun 23, 2011 at 14:18, Chris Stinemetz chrisstinem...@gmail.com wrote: So far I am good on creating the form and submitting it to mysql database and calling the submitting value from a different script. My question is: How can I make it so when a user selects radio option value 1 it will then be displayed as 0-250kbps when I call it the value in the bottom script? Use an if or a switch. For example: ?php // Using if/elseif/else if ($row['tp_test'] == '1') { echo '0-250Kbps'; } elseif ($row['tp_test'] == '2') { echo 'The second value.'; } elseif ($row['tp_test'] == '3') { echo 'The third value.'; } else { echo 'I have no clue. I give up.'; } // Using switch switch ($row['tp_test']) { case '1': echo 'First case.'; break; case '2': echo 'Second case.'; break; case '3': echo 'Third case.'; break; default: echo 'No idea whatsoever.'; break; } ? -- /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] Re: [PHP] mysql error
On Thu, May 5, 2011 at 10:29, Grega Leskovšek legr...@gmail.com wrote: Can smbd please look at this sentence - I got an error and do not know how to fix it - I am still very unfamiliar with MYSQL: CREATE TABLE log ( idlog int auto_increment not null, imepriimek varchar(50), clock timestamp, action varchar(30), onfile varchar(100), filesize float(6,2), uniqueid(idlog) ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(idlog) )' at line 1 This is by no means a PHP question, and should not be asked on the PHP General mailing list. Please ask questions in the appropriate place; for this, the MySQL General list is the correct forum, and they've been CC'd. In the future, if it relates to a PHP database issue, you may want to use the PHP Database mailing list, also CC'd. This not only means you'll get more on-target help faster, but also helps in archiving data in the proper location for future searchers. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] testing
On Fri, Mar 18, 2011 at 17:35, Jim Giner jim.gi...@albanyhandball.com wrote: first time poster There's no need to test. We've known it's worked for years. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT WHERE length of content question
On Wed, Mar 9, 2011 at 17:49, Ron Piggott ron.pigg...@actsministries.org wrote: Is there a command in mySQL that would allow me to SELECT the rows where the `fax` column is more than 11 characters long? There is. SELECT * FROM tblName WHERE CHAR_LENGTH(fax) = 11; (Presuming you meant greater than or equal to eleven, as in an invalid US/Canadian phone number.) -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Submitting data to MySQL database using HTML/PHP form
On Sun, Feb 20, 2011 at 16:43, Donovan Brooke li...@euca.us wrote: $insert = INSERT INTO user_info(login,password) VALUES('.mysql_real_escape_string($login).','.mysql_real_escape_string($password).'); Look at that one more time Dan. ;-) Yeah, well, that's why one should never copy and paste, and why I shouldn't reply to a thread on quotes from my phone. Go figure. ;-P -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Submitting data to MySQL database using HTML/PHP form
On Sun, Feb 20, 2011 at 14:11, Nazish Zafar naz...@jhu.edu wrote: $insert = INSERT INTO user_info (login, password) VALUES ($login, $password); You're using double-quotes to encapsulate your $insert variable data, then never closing them. What's more, you're also using double-quotes to encapsulate each individual variable in the query. Rewrite $insert to this: $insert = INSERT INTO user_info(login,password) VALUES('.mysql_real_escape_string($login).','.mysql_real_escape_string($password).'); -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] bool type (between MySQL and PHP)
On Tue, Jan 25, 2011 at 17:05, Donovan Brooke li...@euca.us wrote: What is the best PHP practice when using bools with MySQL? Save 1's and 0's instead of true/false? You could either do an INT(1) DEFAULT 0 or an ENUM('Y','N') to make it easier on yourself. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] bool type (between MySQL and PHP)
On Tue, Jan 25, 2011 at 17:40, Donovan Brooke li...@euca.us wrote: Thanks Dan, I think the error would still persist using DEFAULT.. because as mentioned, I don't think MySQL likes: UPDATE tablename SET vbool= ..which is not great news for me since I'd like to avoid having to redo all my bool's in PHP (input checking, updates, add's etc.. ;-) ENUM would require that route as well I guess. Oh, sorry, I must've skimmed that part of the message. If you're not changing the value from the default, just omit it from the query. You can't send an empty value. If, for whatever reason, you MUST send the `vbool` column data in your UPDATE query, then define it: 0 = false, 1 = true (of course). Two easy workarounds here: ?php /** * Method #1 - note the triple-equals. If you set $tvar to anything * other than boolean true/false (such as 0/1), drop it to double-equals. */ if ($tvar === true) { mysql_query(UPDATE tablename SET vbool='1'); } /** * Method #2 - do it on the fly with a ternary operator. */ $sql = UPDATE tablename SET vbool='.isset($tvar) $tvar ? '1' : '0'.'; ? -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connecting PHP to MySQL on Windows
On Fri, Jan 7, 2011 at 15:06, Gavin Chalkley gavin.chalk...@gmail.com wrote: Mike, A plain HOST file should have the commented part at the top, and only 1 reference to localhost unless you are creating Virtual hosts. I would suggest removing the ::1 line As long as he never plans to use IPv6 on there, that would be fine. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connecting PHP to MySQL on Windows
On Thu, Jan 6, 2011 at 01:13, michael manning michaelgmann...@gmail.com wrote: Hi, I have installed MySQL 5.1.52, Apache 2.2.15 and PHP 5.3.2 on my Windows Vista computer. The MySQL works fine with the command line client and I have tested the Apache and PHP and it appears fine when I test this with the phpinfo() function. There is just one exception - I cannot connect to a MySQL database from within a PHP script. I have installed the MySQLi extension I know you said MySQL works fine from the CLI, but a stupid question: is the MySQL server running while you're trying to test from PHP? And, if so, on what port does netstat show it running? -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] using PDO vs mysql extension
On Thu, Jan 6, 2011 at 02:52, Miriam Natanzon miriamna...@gmail.com wrote: Hi, I want to build an internal module for common DB-involved tasks: starting with connection, simple queries and go on to multiple pages of results and connecting tables and so on. We are currently working with MySQL but maybe in the future we'll add use of MSSQL (but it's negligible in comparison with the MYSQL percentage of use). I wonder if to base my functions on the abstract layer of PDO or to use mysql function (means mysql_connect and so on). As I see it, mysql functions are more readable and comfortable, but in this case : using MSSQL in the future would affect with new DB module with another implementation. What do would do in such a situation?? You could stick with the native mysql_* and mysqli_* functions, but if you have any hint that your application may eventually change its database platform, or if you at least want the option to easily swap, you should definitely use abstraction. You could use PDO or, as I did, create your own abstraction layers with a common application interface. Then all you need to do is change a configuration variable if you need to switch from, say, MySQL to SQL Server, PostgreSQL, et cetera. The application never notices a difference. For example: ?php define('DB_PLATFORM','mysql'); $db = new DB(DB_PLATFORM); $db-select('*','tablename'); ? There will be some pitfalls and intricacies now and again that require some additional adjustments in the model, but I've found that, for myself, I prefer having full control over the code. Well, that and the fact that it was a specific requirement in the spec of the project. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Word Matching Application
On Wed, Jan 5, 2011 at 21:23, Ron Piggott ron.pigg...@actsministries.org wrote: I only know how to do one array at a time, using FOREACH, like this: === echo ul\r\n; foreach($match_words as $word) { echo li . $word . /li\r\n; } echo /ul\r\n; === You could either swap that out for a simple `for` loop or add in an array_combine() call and sort like so: foreach ($new_array_name as $word = $explanation) -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Job Search
On Fri, Dec 31, 2010 at 09:11, Ethan Rosenberg eth...@earthlink.net wrote: Dear list - I am an entry level data base programmer [PHP/MySQL HTTP/CSS] looking for work in the NY metropolitan area. Any ideas? Search Google, but trust me, you're going to need more experience than entry-level to pick up a job around here, unless you're working remotely, and for relatively-minimal wage for the industry. I'm out in Scranton, and even here, when companies hire for someone with skills in those areas, they want a minimum of 2-4 years. Should we have a job search board? No. Not only would that be reinventing the wheel, but if we did it, it would be square. Many others can do it much better than we would have any interest in doing. That said, I'd highly recommend checking your local CraigsList, in the Gigs section, for computer and web jobs. Sometimes they have some quick one-off ones that can not only help you build experience, but also start building your roster of contacts. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Regex for telephone numbers
On Fri, Dec 31, 2010 at 12:05, Dmitriy Ugnichenko mitya.ugniche...@gmail.com wrote: I guess, this will work fine ereg('[0-9]{3}-[0-9]{3}-[0-9]{4}', $phone_number); Not quite. Plus, all ereg* functions have been deprecated for some time now. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Regex for telephone numbers
On Fri, Dec 31, 2010 at 19:09, Jim Lucas li...@cmsws.com wrote: Actually... Specified here [1] it says that the {1,} is the same as '+'. I think you should drop the comma. If you don't this would be valid 844-2345-123456 ^[2-9]{1,}[0-9]{2,}\-[2-9]{1,}[0-9]{2,}\-[0-9]{4,}$ should be ^[2-9]{1}[0-9]{2}\-[2-9]{1}[0-9]{2}\-[0-9]{4}$ Bah, you're absolutely correct. Force of habit with the commas. I didn't even notice the sample test cases I put into that test array didn't check for more than the number of digits per field, either. Good catch, Jim, and Happy New Year. -- /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
Re: [PHP-DB] Re: [PHP] Regex for telephone numbers
On Thu, Dec 30, 2010 at 14:07, Ethan Rosenberg eth...@earthlink.net wrote: Josh - I used use \d{3}-\d{3}-\d{4}. It works beautifully!! Just keep in mind that invalid numbers will also pass that check, such as 000-000- or 123-456-6789. That's why my example was a bit more involved. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP-INSTALL] php - libmysqlclient question
On Wed, Dec 29, 2010 at 04:57, Hajo Locke hajo.lo...@gmx.de wrote: Hello, i want to talk from php to different mysql-servers with different versions. is it a recommend way to compile php always against newest libmysqlclient or not so important? You should use the newest stable version so you can take advantage of the latest features and fixes, but unless you're going back really far - like MySQL 3.23 - any modern client version should have no negative impact. Even in that case it may not, but that's a better question for either the php-db@ list or the MySQL General list (both CC'd for folks to add anything I may have forgotten). -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Regex for telephone numbers
On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-. Congrats. People in Hell would like ice water. Now we all know that everyone wants something. ;-P Really, this isn't a PHP question, but rather one of regular expressions. That said, something like this (untested) should work: ?php $numbers = array( '123-456-7890', '2-654-06547', 'sf34-asdf-', 'abc-def-ghij', '555_555_', '000-000-', '8007396325', '241-555-2091', '800-555-0129', '900-976-739', '5352-342=452', '200-200-2000', ); foreach ($numbers as $n) { echo $n.(validate_phone($n) ? ' is ' : ' is not ').'a valid US/Canadian telephone number.'.PHP_EOL; } function validate_phone($number) { if (preg_match('/^[2-9]{1,}[0-9]{2,}\-[2-9]{1,}[0-9]{2,}\-[0-9]{4,}$/',trim($number))) { return true; } return false; } ? -- /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
Re: [PHP-DB] Re: [PHP] Problems w/ goto
On Sat, Dec 18, 2010 at 17:02, David Hutto smokefl...@gmail.com wrote: or maybe it's saturday morning and i'm drunk? This seems to be the most likely, and considering how all messages are permanently and independently archived and propagate throughout the Internet, it might be a good reason not to go nuts in sending unrelated and unintelligible messages of this nature in the future. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Problems w/ goto
On Fri, Dec 17, 2010 at 11:38, Ethan Rosenberg eth...@earthlink.net wrote: I am trying to write a program that can have two(2) independent forms in one PHP file. When I run the code below [from PHP - A Beginner's Guide], to which I have added a second form, it freezes. [snip!] What did I do wrong? You presumed that A Beginner's Guide meant that it was a book for beginners not one written by a beginner. Firstly, while GOTO has a place in programming for certain things, the example (and I can see the difference between the original and your additions) is atrocious, and is not at all representative of any code you would ever, ever want to put into production. That looks like a nightmare of taking a math final, not knowing the answer, and suddenly realizing you're in your underwear --- and have explosive uncontrollable diarrhea on top of it, and your ankles are chained to the chair. Who is the author? I saw one on Amazon by Vikram Vaswani, but there was no use of GOTO that I could find there. I'd like to see what other tips are included, or perhaps to see if that code was used in a different context (as in, what will work, but what not to do anyway, or, I wrote this on April Fool's Day). -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: [PHP] Problems w/ goto
On Fri, Dec 17, 2010 at 12:16, Richard Quadling rquadl...@gmail.com wrote: And have you seen all the sad faces ... : { on http://docs.php.net/manual/en/control-structures.goto.php#92763 Can't be good for them. If only people knew how many hours - literally, hours - it took me to keep that page clean and free from vandalism after GOTO was introduced. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Problems w/ goto
On Fri, Dec 17, 2010 at 12:22, Robert Cummings rob...@interjinn.com wrote: I was one of the people that argued in favour of GOTO on the Internals list a few years ago. GOTO has a use, and a very good one at that. It is by far the most efficient construct when creating parsers or other similar types of logic flow. The demonized GOTO of the 80s was primarily due to jumping to arbitrary points in the code, or in the case of basic to arbitrary line numbers in the code which had little meaning for future readers. Not to mention failure to properly break, as in the OP's code example. -- /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
Re: [PHP-DB] Resetting auto_increment
On Tue, Dec 14, 2010 at 12:34, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thanks for all your help. How do I reset auto_increment so that the primary key will start from 1. The primary key is now 2421. I have deleted all the data in the table and started over, and the primary key just increments from its previous value. Setting auto_increment=0 does not work for me, why I don't know. UPDATE tablename AUTO_INCREMENT=1; -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Resetting auto_increment
On Tue, Dec 14, 2010 at 13:02, Ethan Rosenberg eth...@earthlink.net wrote: UPDATE tablename AUTO_INCREMENT=1; mysql update Visit3 auto_increment=1; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=1' at line 1 Same error if auto_increment is in caps. What did I do wrong? Sorry, you didn't --- I did. I was working on something for myself simultaneously and somehow crossed wires. My apologies. That's not an UPDATE query, it's an ALTER TABLE query. ALTER TABLE Visit3 AUTO_INCREMENT=1; Again, my apologies. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Resetting auto_increment
On Tue, Dec 14, 2010 at 13:43, Toby Hart Dyke t...@hartdyke.com wrote: Use 'ALTER tablename AUTO_INCREMENT=1' rather than 'UPDATE tablename AUTO_INCREMENT=1'. Yeah, again, my fault. Not enough coffee on this cold (~7F) winter's day, perhaps. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- 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] Re: [PHP] Strange Query Error...
On Sat, Nov 27, 2010 at 12:30, Don Wieland d...@dwdataconcepts.com wrote: Hi gang, I am executing a query via PHP that gives me a PHP error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.`Preferred_First_Name` LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wielan' at line 1 but when I copy the ECHO of the select query and run it in Sequel Pro Query, it returns no error. Here is the query: select m.* from Members m inner join Member_Years my on m.aucciim_id = my.member_id where now() DATE_ADD(DATE_SUB(concat(`member_year` + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.`Preferred_First_Name` LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wieland' group by m.AUCCIIM_ID order by m.preferred_last_name What is causing it to choke via PHP? This is actually better-suited to the DB list (CC'd) than the General list, but one primary question: are you using the mysql_* family, mysqli_* family, or another method of interfacing with MySQL? -- /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] Re: [PHP] Strange Query Error...
On Sat, Nov 27, 2010 at 13:18, Don Wieland d...@dwdataconcepts.com wrote: On Nov 27, 2010, at 10:07 AM, Bastien wrote: Try removing the backticks around the table names. If you do use them, then all values (field names and table names) need it. I tried that and still chokes... select m.* from Members m inner join Member_Years my on m.aucciim_id = my.member_id where now() DATE_ADD(DATE_SUB(concat(member_year + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by m.preferred_last_name ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.Preferred_First_Name LIKE 'Don%'' at line 1 Note how you keep changing case here. For example, m.aucciim_id vs. m.AUCCIIM_ID. Also note that all of this is cAsE-sEnSiTiVe. -- /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
Re: [PHP-DB] French and Spanish Accent Letters
On Wed, Nov 10, 2010 at 10:03, Ron Piggott ron.pigg...@actsministries.org wrote: I have a column that is VARCHAR 250. I need it to be able to accept french and spanish accents. The purpose of the column is organization names. The “Collation” default is “latin1_swedish_ci” What do I need to do? Ron You need to ask on a database list. If it's MySQL, blast it to my...@lists.mysql.com, or - regardless of database - you can send it to php...@lists.php.net. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] French and Spanish Accent Letters
On Wed, Nov 10, 2010 at 10:16, Ron Piggott ron.pigg...@actsministries.org wrote: I did Daniel --- php-db@lists.php.net ; Thank you for telling me about the mySQL list. I failed to mention in my original e-mail the database is mySQL. My fault. Force of habit mentioning the php-db@ list. Sorry if there was any confusion on that. In any case, you'll probably get exactly the answer you're trying to find on the MySQL list. Quite possibly quicker there than the php-db@ list as well. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: ezmlm warning
On Fri, Nov 5, 2010 at 08:13, Lester Caine les...@lsces.co.uk wrote: Karl DeSaulniers wrote: Hi, Can anyone admin please explain this to me? If the email server gets bounce messages back for emails set out, then it tries to check those emails. If the warning message gets through then nothing really happens, but if that bounces as well, then it will disable sending more emails to that address. I had one for this list this morning as well ... Mostly everyone on the list would've gotten that same one. It's nothing of which to be concerned, it just means that your local mailservers did what they should: they bounced a poor attempt at a phishing message claiming to be from the lists.php.net support team (there is no such group). When your mailserver rightfully bounced the email, ezmlm sent the notice to you that it bounced. You can check the content of bounced messages yourself by following the instructions in any given bounce message you receive from us. Inside the email, you'll see a message number (not to be confused with a message ID), and you can build a dynamic email address to which you simply send a blank email. Moments later, you should receive a copy of the original email --- and usually that will come through, by request. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php_warn
On Thu, Feb 11, 2010 at 08:49, madunix madu...@gmail.com wrote: some of my web pages having the following issue when i call them Warning:main(main_page.html.php): failed to open stream: No such file or directory in /www/htdocs/web/public/public.php on line 50 Warning:main(): Failed opening 'main_page.html.php' for inclusion (include_path='.:/usr/local/lib/php') in /www/htdocs/web/public/public.php on line50 The following is useless for debugging this issue: PHP Core shows the following Directive = Local Value = Master Value allow_call_time_pass_reference = Off = Off disable_classes = no value = no value disable_functions = exec, shell_exec, system, passthru,popen, virtual, show_source, pclose ,ftp_connect,mysql_list_tables, display_errors = Off = Off display_startup_errors = Off = Off doc_root = no value = no value docref_ext = no value = no value docref_root = no value = no value enable_dl = On = On error_append_string = no value = no value error_log = no value = no value error_prepend_string = no value = no value error_reporting = no value = no value expose_php = On = On extension_dir = ./ = ./ file_uploads = On = On gpc_order = GPC = GPC html_errors = Off = On include_path = .:/usr/local/lib/php = .:/usr/local/lib/php log_errors = On = On log_errors_max_len = 1024 = 1024 magic_quotes_gpc = On = On magic_quotes_runtime = Off = Off magic_quotes_sybase = Off = Off max_execution_time = 0 = 240 implicit_flush = On = Off include_path = .:/usr/local/lib/php = .:/usr/local/lib/php log_errors = On = On Because it's not an issue with the core. What is your code on the lines mentioned in the error message? Did you use one of the following? * include * include_once * requre * require_once Lastly, is the file main_page.html.php actually even in the same directory as public.php? Is it named with the dual-extension .html.php? -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Looking for hosting or dedicated servers? Ask me how we can fit your budget! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] trying to dump out table info
On Tue, Jul 14, 2009 at 08:16, h...@deweywilliams.comh...@deweywilliams.com wrote: The problem I have always had with the PHP Manual (online) has been the lack of complete examples. Yes, there are examples of how to use each function. But functions such as the MySQL related ones require multiple steps to get to a point where anything works. There are at least two steps to get any database function to work 1)connect to database 2)select connected database. Until these two things are correct, none of the other functions will work because you do not have a database to work on. This is a continuous process, and one of which we're definitely aware. For now, you can get more information and examples from the user notes at the bottom of each page, but we are working on official examples as well. For some things, however, full examples will not be provided, as it would be out of the scope of the individual function's manual entry. In such events, the official documentation is a good reference, but not a substitute for learning on your own and from others. That said, we are *always* looking for people who would be serious about providing long-term assistance to the PHP Project, including the official documentation. If you're interested in learning how to do so, get in touch with me off-list at danbr...@php.net and I'll be happy to point you in the right direction. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] trying to dump out table info
On Mon, Jul 13, 2009 at 16:53, Govindagovinda.webdnat...@gmail.com wrote: Hi all I am not sure why this is failing/giving error. I am quite new at PHP/Mysql, and apologize for what will undoubtedly end up being a trivial error on my part. Hey, I recognize that code ;-P Here is my code: $db_billing=mysql_connect(localhost,metheuser,mypass,billing); if (!$db_billing) { die('Could not connect: ' . mysql_error()); } $sql = SHOW TABLES; $result = mysql_query($sql) or die(mysql_error()); Note the addition to the $result definition. This will cause the script to exit with the MySQL error message (if any) if the issue is in the query. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] trying to dump out table info
On Mon, Jul 13, 2009 at 17:24, Govindagovinda.webdnat...@gmail.com wrote: No database selected You're getting warmer How would you select a MySQL database in PHP? (Hint: there's a built-in function.) -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] trying to dump out table info
On Mon, Jul 13, 2009 at 19:28, Govindagovinda.webdnat...@gmail.com wrote: $db_billing=mysql_connect(localhost,metheuser,mypass,billing); if (!$db_billing) { die('Could not connect: ' . mysql_error()); } if(!mysql_select_db('dbname',$db_billing)) die(mysql_error()); //$sql = SHOW TABLES FROM billing LIKE 'mytable'; $sql = SHOW TABLES; //line 237 The fourth parameter you have in mysql_connect() only evaluates within the engine as a boolean True statement. RTFM to see why. ;-P -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] trying to dump out table info
On Mon, Jul 13, 2009 at 20:17, Govindagovinda.webdnat...@gmail.com wrote: Dan, I am really making the effort.. despite how it may look. I believe you. I sent you the function and code that should work for you, but it may have been lost in the chopped replies. So it'll be something like this: ?php $host = 'localhost'; $user = 'user_name'; $pass = '123'; $db_name = 'my_database'; $link = mysql_connect($host,$user,$pass); $conn = mysql_select_db($db_name,$link); $sql = SHOW TABLES; $result = mysql_query($sql); // ? -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Checking Special Characters
On Sat, Jul 11, 2009 at 02:41, Manu Guptamanugu...@gmail.com wrote: Dear All, I have to design a databse where I need to check for date using date as datatype in mysql I am having problems while inserting it Can you help me with it?? Google. Also I am having problems with eregi(), erege(); This is a serious issue, and one that you will continue to experience: because there's no such function as erege(). PLUS can i know various ways to secure password in a db Sure! See: http://tinyurl.com/ljrvzt -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] A prepared statements question
[Redirected to PHP-DB: php...@lists.php.net] On Sun, Jul 12, 2009 at 00:31, Jason Carsonja...@jasoncarson.ca wrote: Hello everyone, I am having a problem getting my prepared statements working. Here is my setup... index.php - authenticate.php - admin.php 1)index.php has a login form on it so when someone enters their username the form redirects to another page I call authenticate.php. 2)In the authenticate.php file I want to use prepared statements to interact with the MySQL database. I want to compare the username submitted from the form with the username in the database. 3)If the login username was legitimate then you are forwarded to admin.php Its step 2 I am having problems with. Here is what I have but I don't think it makes any sense and it doesn't work. $link = mysqli_connect($hostname, $dbusername, $password, $database); $stmt = mysqli_prepare($link, SELECT * FROM administrators WHERE adminusers=?); mysqli_stmt_bind_param($stmt, 's', $username); $result = mysqli_stmt_execute($stmt); $count=mysqli_num_rows($result); if($count==1){ header(location:admin.php); } else { echo Failure; } Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- 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
Re: [PHP-DB] Please help a newbie
Rij wrote: I input the values from a HTML form. Here is the partial code. $phone = $_POST['phone']; $name = $_POST['name']; $address = $_POST['address']; $query = INSERT INTO contacts VALUES ('$phone', '$name', '$address'); if (mysql_query($query, $con)) echo Values inserted; else die('Unable to create table : '.mysql_error()); This is unsafe code. I suggest you lookup prepared statements and the PDO library (which is part of PHP). Daniel. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Is Temporary table right approach
I think a temporary table is likely to be the right approach. I have some times found massive seed improvements by caching a result set inside a temporary table. If the data in the table is just ids (ie, just one field), you could get an additional speed bump by rewriting your WHERE clause to use IN. For example, if you have: SELECT * FROM t JOIN tempTable ON t.someId = tempTable.id You can rewrite that as: SELECT * FROM t WHERE t.someId IN (SELECT * FROM tempTable) MySQL can apply some extra optimizations to the IN clause (e.g. sort the data and search for a match using a binary tree search). Daniel. Manoj Singh wrote: Hi All, I have a query which returns the large number of ids which i am using in other queries. I am doing this in PHP. Now the first query can return unlimited number of ids which might create problem in PHP. I want to store this ids in MYSQL through temporary table so that i can access that ids in other queries directly. Do you think the approach is right or there is any other good approach? Please suggest. Regards, Manoj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dynamic text for every user
Wilson Osemeilu wrote: How do i create a table with user id and password, where every user get to see a dynamic text related to them only I get the same dynamic text when every user logs in but i really want them to see their details in the mysql database only. Please help php/mysql users You mean just a single piece of text? Like the anti-phishing thing some banks do where you enter a secret phrase and the bank displays it to you after you login, so if the text is wrong you know there is a problem? Is that what you want? CREATE TABLE users ( idINT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, loginCHAR(30) CHARACTER SET utf8 UNIQUE, passwordCHAR(40) CHARACTER SET ascii, secretPhraseCHAR(40) CHARACTER SET utf8 ); Is this what you want? Or did I misunderstand your question? Cheers, Daniel. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re : Problem with PDO exceptions
Neil Smith [MVP, Digital media] wrote: When you create your DB connection $db, follow the connection line directly after with this : $db-setAttribute(PDO::ATTR_ERRMODE , PDO::ERRMODE_EXCEPTION); The default is I believe PDO::ERRMODE_SILENT which is confusing to most people the first time. Thanks! It works now. Cheers, Daniel. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with PDO exceptions
Hello, I have MySQL 5.1 and PHP 5.2. For some reason PDO is not throwing exceptions when I give it a broken SQL query. For example: try { $stmt = $db-prepare(SELECT * FROM foobar WHERE 1); } catch(PDOException $e) { error($e-getMessage()); } In this example there is no table called 'foobar', so this should give an error. Yet, it doesn't. Any ideas why that would happen? Possible causes I can think of: 1) PDO decide to emulate prepared statements. 2) PDO has some sort of errors off setting. 3) My try-catch statement is wrong. I doubt it's (1) because I have MySQL 5.1 and PDO is only supposed to emulate prepared statements for MySQL versions prior to 4.1. And phpinfo says that I'm running pdo_mysql version 5.1.30. Btw, $db-exec() and $db-query() also fail to produce an error when I give them a broken query. That's another reason why I think that the problem is elsewhere. Any ideas? Thank you very much for your help. Best, Daniel. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci_connect
On Wed, Nov 19, 2008 at 8:15 PM, Fred Silsbee [EMAIL PROTECTED] wrote: [snip!] Fred, Please keep all of your posts in the same thread with the same subject. You're making it very difficult for others to follow along with your ramblings, and seem to even be confusing yourself a bit. Chris has been trying to get the information he needs from you, but it looks like you're running over yourself. It happens with frustration, I completely understand. ;-P Keep everything in one thread so that it's easy to follow and so that Chris and others can help you out. Once you get the information sorted out in one linear fashion, I think you'll find the problems aren't as serious as you might have thought. And if they are, then we can all help you to solve them. -- /Daniel P. Brown http://www.parasane.net/ [EMAIL PROTECTED] || [EMAIL PROTECTED] Ask me about our current hosting/dedicated server deals! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Kesalahan posting?
On Mon, Nov 3, 2008 at 11:46 AM, Alejandro Peña [EMAIL PROTECTED] wrote: Hi, if you try on http://www.appliedlanguage.com/language_identifier.shtml you'll see the Language: *Malay *;) The Don Komo emails have been hitting this list for a while. At least a year or two. They were on the MySQL list, too, but I think they stopped. In any case, I put up filters here so that I wouldn't have to read the crap anymore. -- /Daniel P. Brown http://www.parasane.net/ [EMAIL PROTECTED] || [EMAIL PROTECTED] Ask me about our current hosting/dedicated server deals! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] CREATE question
On Thu, Oct 30, 2008 at 2:19 PM, Dan Shirah [EMAIL PROTECTED] wrote: Is it possible for us to use PHP to create temp tables in our database? [snip!] But all that does is give me an ifx_prepare fails message. (Forwarded to PHP-DB as well.) Dan, make sure Informix is set to allow that user to use the CREATE syntax. Also, not sure about IFX, but with other SQL databases - including MySQL - you have to use the full word `TEMPORARY`, not just `TEMP`. -- /Daniel P. Brown http://www.parasane.net/ [EMAIL PROTECTED] || [EMAIL PROTECTED] Ask me about our current hosting/dedicated server deals! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] moved code to a new server
Forwarded to General, since this doesn't belong on DB. On Fri, Oct 24, 2008 at 6:18 PM, Marc Fromm [EMAIL PROTECTED] wrote: We moved our website to a new linux server. The code was running on a different linux server. Thus the OS environment is the same. We are receiving this error: [Fri Oct 24 14:53:37 2008] PHP Fatal error: require() [a href='function.require'function.require/a]: Failed opening required 'this was a url to a .js file' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/path to .php file on line 4 I'm not a php programmer thus I am in the dark. You don't have to be, you just have to read the error message. If you copied that verbatim, then 'this was a url to a .js file' exists on line 4 of .php in /var/www/html/path, and PHP failed to open it. Make sure the file exists exactly where PHP is looking for it, and that it's accessible and readable to and by the user as which the server is running when executing `.php` in /var/www/html/path, and that the target file can be found from that directory. -- /Daniel P. Brown http://www.parasane.net/ [New Look] [EMAIL PROTECTED] || [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] OCI
On Mon, Jul 21, 2008 at 12:22 PM, Mad Unix [EMAIL PROTECTED] wrote: How could I build the OCI8 extension module for php5 under CentOS5? I have installe PHP/APACHE/MYSQL through yum install ... OCI8 is a PECL extension. 'pecl install oci8' If you need more help with that, you can either check Google or perhaps go directly to the PECL OCI8 page. -- /Daniel P. Brown Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] CURL and ASP
On Wed, Jul 9, 2008 at 9:35 AM, ioannes [EMAIL PROTECTED] wrote: Has anyone here experience of CURLing .asp pages which use session cookies as I am having difficulty doing so on two different sites, both asp. Forwarded to PHP-General, John. If you're not already subscribed there, please subscribe to continue to follow this thread. If you're referring to using cURL from PHP to grab or spider pages written in ASP on a remote server, no, I've had no problems at all. In fact, once the content is served on the web, server-side language matters nil. It all comes out in the standard HTML/JavaScript/etc. format, and all HTTP policies and procedures (such as session handling) are [pretty-much] universal. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php upload questions --move_uploaded_file
Hai, I'm forwarding this email over to the PHP-General list, since it's not database-related. If you're not already subscribed there, please subscribe and I'm sure you'll get some responses. ORIGINAL MESSAGE FOLLOWS: On Thu, Jun 26, 2008 at 6:21 AM, Liu, Hai Tao (Taylor) [EMAIL PROTECTED] wrote: Hi all: I meet a very strange problem about php upload. Usually, we use move_uploaded_file to upload, but it could not work in flex use php to upload. Same Php upload code can work in html page, and move_uploaded_file function will return 1; But it could not work in flex, and move_uploaded_file function return nothing. I wonder if PHP have some restriction? Has anyone meet such problems? Thank you very much! Flex upload code: file = new FileReference(); .. var request:URLRequest = new URLRequest(http://www.a.com/upload.php;); ... file.upload(request); Php code: ?php $uploadFolder = $_SERVER['DOCUMENT_ROOT']./previews/order/; // upload folder $destFileName = $_REQUEST['fileName']; $dest = $uploadFolder.$destFileName; if (sizeof($_FILES)==0) { echo no file; } $f=array_pop($_FILES); echo $f['tmp_name'].br ; error_log($uploadFolder.\r\n, 3, $_SERVER['DOCUMENT_ROOT']./FileService.log); error_log($f['tmp_name'].'::'.$f['name'].\r\n, 3, $_SERVER['DOCUMENT_ROOT']./FileService.log); error_log((is_uploaded_file($f['tmp_name'])?true:false).\r\n, 3, $_SERVER['DOCUMENT_ROOT']./FileService.log); return true here! echo $dest; $r = move_uploaded_file($f['tmp_name'],$dest); error_log(uploadresult--.$r.--\r\n, 3, $_SERVER['DOCUMENT_ROOT']./FileService.log); chmod($dest,0777); ? Thank! Luna -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Recommended web developers
On Tue, Jun 24, 2008 at 3:45 PM, Ken Keefe [EMAIL PROTECTED] wrote: I'm a little surprised no one else has commented on this, but for a website that complicated, 10k is way too low. I actually did this morning, but the message included other information (no advertisement or offers or anything) that I thought was better left as a personal email. In any case, Ken, from the (somewhat vague) description in the original email, you're correct. It took Yahoo! over 13 years to build to where they are now, at an ever-expanding cost of millions-upon-millions of dollars. Trying to basically clone the site for $10,000 isn't practical, but I'm sure the OP knows that and might have just left some specifics out of the email. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] bcrypt ideas
Hey folks, I was just wondering if anyone has tried to write a bcrypt cypher script in php (in a similar fashion to php pear's 'crypt_blowfish') - my experience with compiling suhosin (which includes the one-way crypt_blowfish used in bcrypt) hasn't been pretty and I'm wondering whether anyone else has explored alternative methods. Thanks
[PHP-DB] Re: [PHP] question, about mysql query
This isn't a PHP question at all. It's a MySQL question. However, answers are below, with forwards to the appropriate lists for archiving purposes. On Mon, Jun 2, 2008 at 9:19 PM, LKSunny [EMAIL PROTECTED] wrote: two table, tablea and tableb tablea uid, col1, col2, col3 1,xx, xx, xx 2,xx, xx, xx 3,xx, xx, xx tableb id, uid, col1, firstdata 1, 1, xx, 1 2, 2, xx, 0 3, 2, xx, 0 4, 1, xx, 0 i want query tablea, and join tableb, uid is associate, ok LEFT JOIN `tableb` b ON a.uid = b.uid, and than i want tableb firstdata=1 or tableb no associate uid b.firstdata=1 OR b.uid IS NULL, by the time all ok, but i want add one case, if tableb firstdata all is 0, result one row, like b.uid IS NULL, i don't know how to i want result is all tablea data no double, tableb one case firstdata is 1 (one uid in tableb just one row possible is firstdata=1), or no row in tableb, or all firstdata = 0 Thank You Very Much !! This query can't SELECT a.*, b.* FROM `tablea` a LEFT JOIN `tableb` b ON a.uid = b.uid WHERE (b.firstdata=1 OR b.firstdata=0 OR b.uid IS NULL) Okay, I had a difficult time understanding what it is you need, but hopefully got enough from your message to be able to help you out. What I think you may be looking for is something like this: SELECT * FROM tableb WHERE firstdata='1' AND id IN (SELECT DISTINCT id FROM tablea ORDER BY id ASC); That will select only unique `id` columns from `tablea` and select only the rows from `tableb` where the `id` columns match and `firstdata` is set to '1'. You can then modify that query as needed. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse error: syntax error, unexpected T_ELSE
On Tue, Apr 15, 2008 at 5:56 PM, Javier Viegas [EMAIL PROTECTED] wrote: Thanks Daniel i ´ve removed the unexpected else secction. Now it works but it tells me that there might be a syntax error on the query, this is good news because now i know i´m having connection with the database but also there must be something wrong with the query. $del_str = DELETE FROM libros WHERE bnumero=.$_GET['Id']; [snip!] You didn't enclose the value in quotes, that's all (and you should sanitize the input --- NEVER accept data without sanitizing it first!). ?php $del_str = DELETE FROM libros WHERE bnumero='.mysql_real_escape_string($_GET['Id']).' LIMIT 1; ? -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [Stored Procedure] - Error handling
Ratheesh, There's a specific list for PHP database functions, Databases and PHP (PHP-DB), which you can find at http://php.net/mailinglists . I'm forwarding your message over to there, and recommend that you subscribe to that list. You'll probably get more direct responses by narrowing-down the lists to the support you need. LIST: Original message follows. On Tue, Apr 15, 2008 at 12:53 PM, Ratheesh K J [EMAIL PROTECTED] wrote: Hello folks, Any way to retrieve the error code/error number from a stored proc. Scenario -- calling a stored proc from PHP - using mysqli_multi_query() The stored proc has multiple queries. Lets say one of the queries generates an exception. How do I retrieve the error message within the procedure itself? OR Is there any way from PHP to get the last error msg? I tried with mysqli_error().. Did not work.. Any inputs will be appriciated. Thanks, Ratheesh -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse error: syntax error, unexpected T_ELSE
On Tue, Apr 15, 2008 at 4:49 PM, Javier Viegas [EMAIL PROTECTED] wrote: Hi, i have this script wich basically connects to a database and delete a record according to the Id parameter given. The problem is that when i test it i get this error: *Parse error*: syntax error, unexpected T_ELSE in * /var/www/biblio/scripts/delete.php* on line *31 Javier, This block: } else { $r_string = 'errorcode=4'; } is incorrect. You call an else condition on line 21, so PHP expects that block to be the last for that if() condition. Either remove the } else { and $r_string = 'errorcode=4'; lines or rewrite the condition. And if that's your real database login information, change it and update all of your scripts and systems ASAP. This is the script: *?php /* deletescore.php: deletes record for passed id from highscores table and returns status to Flash */ // fill with correct data for your server configuration $server = localhost; $username = root; $password = itsveryeasy; $database = biblioteca; //connect to database added by calm mysql_connect($server, $username, $password); if (!mysql_connect($server, $username, $password)) { $r_string = 'errorcode=1'; } elseif (!mysql_select_db($database)) { $r_string = 'errorcode=2'; } else { $del_str = DELETE FROM libros WHERE bnumero=.$_GET['Id']; if (!mysql_query ($del_str)) { $msg = mysql_error(); $r_string = 'errorcode=3msg='.$msg; } else { $r_string = 'errorcode=0'; } } else { $r_string = 'errorcode=4'; } echo $r_string; ? Wha am i doing wrong?? Thanks. Javier -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: php-db Digest 9 Apr 2008 13:17:18 -0000 Issue 4019
On Wed, Apr 9, 2008 at 5:09 PM, A. Joseph [EMAIL PROTECTED] wrote: The question is. Some nestled calculation. How did club freedom did the calculation, or how will the database structure looks like? *The example is -: * *Joseph* gave birth to *John*, *James,* and *Johnson* *John* gave birth to* Peter*, *Matter*, and *Potter* James gave birth to Juliana, Justin, and *Jane* Johnson gave birth to Jak, Jake and Jacob Using a parent-child relationship, exactly as in nature. MySQL: db_name.people id INT ( 8 ) AUTO_INCREMENT NOT NULL full_name VARCHAR ( 255 ) child_of INT ( 8 ) NOT NULL num_children INT ( 2 ) NOT NULL Then do some simple queries like this: ?php // First record $sql = INSERT INTO people(full_name,child_of,num_children) VALUES('.$fullName.','0','0'); // For each child // $parentID is the `id` column for the record of the parent of this child. $sql = INSERT INTO people(full_name,child_of,num_children) VALUES('.$fullName.','.$parentID.','0'); $sql = UPDATE people SET num_childen=(num_children + 1) WHERE id='.$parentID.'; ? And so forth. Code sanity and such are your responsibility, but that should kick-start the idea for you. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] joins issues again
On Tue, Apr 8, 2008 at 7:28 AM, Steven Macintyre [EMAIL PROTECTED] wrote: Hi all, I have the following SQL statement; SELECT count( salesID ) AS count, branch_name, company_name, branch.branchID FROM sales LEFT JOIN IGuser ON sales.IGuid = IGuser.IGuid LEFT JOIN branch ON IGuser.branchID = branch.branchID LEFT JOIN company ON branch.companyID = '{$companyID}' WHERE maincompanyid = '{$mcid}' GROUP BY branch.branchID ORDER BY branch_name ASC However, i do not want those join records to be appended, only to return the count of records from sales. Can someone assist me with this? I have tried differance variants of joins and none of the results are correct. Sales tbl doesnt have the companyID, nor does IGuser Steven, Since this isn't a PHP-specific question, you'll probably receive better responses on either the MySQL list (you didn't mention which database system you're using, but I'll blindly and ignorantly assume that's it), or at least the PHP-DB list. I'm CC'ing both of those for you. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] HTML CSS (Off Subject) 911 Help! :-)
On Tue, Mar 25, 2008 at 12:24 AM, Karl James [EMAIL PROTECTED] wrote: [snip!] I need some help on formatting issues. [snip!] Right now the page looks like this. [snip!] http://www.theufl.com/2003/reports/rosters/fantasyrosters.htm [snip!] It is almost, their. However, as you can tell the players name is not cooperating. I want the table to look similar to this one. http://www.webleaguemanager.com/demo/reports/FantasyRostersRpt.html [snip!] Karl, It looks like everything is as you described your vision now. Is that correct? For the future, your best bet when attempting to copy a design is to cheat and view the source of the design you want to mimic. -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Not updating certain fields in same row
On Tue, Mar 25, 2008 at 12:59 PM, Jason Pruim [EMAIL PROTECTED] wrote: Hi everyone, I am attempting to update a record for a login system while leaving certain fields untouched if they arn't changed, and am running into issues. [snip!] I have tried this code: $tab = \t; if (!isset($_POST['txtLoginName']) || empty($_POST['txtLoginName'])) { $loginName = mysqli_real_escape_string($chpwpostlink, $_POST['txtLoginName']); } else { $loginName = $tab; } Mmm-hmm and exactly how do that work to update the database? The SQL query you're probably looking for would be like this: $sql = UPDATE users SET Field1='.mysql_real_escape_string($field1).',Field3='.mysql_real_escape_string($field3).' WHERE id='.mysql_real_escape_string($id).' LIMIT 1; -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Not updating certain fields in same row
On Tue, Mar 25, 2008 at 1:14 PM, Jason Pruim [EMAIL PROTECTED] wrote: the actual query I'm using is this: $chpwsql = UPDATE current SET customerName='$customerName', loginName='$loginName', loginPassword='$PW', email='$email', adminLevel='$adminLevel' WHERE Record='$Record1'; What it is doing now is if I don't set a a field I am replacing the content of it with a tab, which isn't what I want. Basically what I'm looking for is if loginPassword hasn't changed... don't clear the contents of it. if it has changed, then update loginPassword Okay, since you won't only want to rely on isset() here (in case someone accidentally hits a key into the field), try this: // NOTE: This assumes prior sanity checks and cleansing // of variables, and is written like so to avoid breaking // of the query due to mail client-enforced line breaks. $chpwsql = UPDATE current SET ; $chpwsql .= customerName='.$customername.',; $chpwsql .= loginName='.$loginName.',; if(preg_match('/^[a-z0-9]{5,16}$/i',$PW)) { // If it's between 5-16 case-insensitive alphanumeric // characters, it's all good. If you want to allow symbols, // simply modify the regexp accordingly. $chpwsql .= loginPassword='.$PW.',; } $chpwsql .= email='.$email.',; $chpwsql .= adminLevel='.$adminLevel',; $chpwsql .= WHERE Record='.$Record1.'; $chpwsql .= LIMIT 1; -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ini_set ...
On Fri, Mar 21, 2008 at 10:20 AM, VanBuskirk, Patricia [EMAIL PROTECTED] wrote: I have the line ini_set('display_errors', 'on'); in my code, but it is not working. Does it need to be the first command on the page? [merge] I have full access to the php.ini file, which is what I do now to test... go there, change the file, restart the IIS service, etc. I read somewhere recently where they used this line in their code, and I thought how convenient that would be ... just haven't been able to get it to work. I will try true instead of on and see if that works. Does it go back to the default on it's own, or do I need to hard-code that in the page when I'm done? Trish, this is a general question rather than a database question, so it's being forwarded to the PHP-General list as well. It will not only get you some more detailed replies, but it helps keep the archives organized. If you're not already subscribed, please consider doing so: http://php.net/mailinglists Try something like this at the head of your code: ? error_reporting(E_ALL); ini_set('display_errors','On'); ? Keep in mind that it will only be executed in the same script as it's coded, and only if/when those lines are executed. It won't set the system-wide (or even same-session) display_errors, it only enables that option for that script at that time. -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Fastest way to get table records' number
On Tue, Mar 18, 2008 at 11:43 PM, Shelley [EMAIL PROTECTED] wrote: Hi all, What do you think is the FASTEST sql to get the total number of a table with millions of records? That question would be better on the PHP-DB list, so for archive's sake, I'm CC'ing that list. $sql = SELECT COUNT(*) FROM your_table; -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] question about php with sql database
Again, another question better-asked on the PHP-DB list, so it's being CC'd there. Responses in-line On Wed, Mar 19, 2008 at 1:08 AM, Sudhakar [EMAIL PROTECTED] wrote: instead of using mysql database which is conventionally used as database with php, if sql server database is used with php are there any major differences to keep in mind. There are going to be some SQL syntax differences, yes. Despite the name Standard Query Language, it's not really standard by anything but the most basic of queries. 1. are the connection statements ex = $conn = mysql_connect($hostname, $user, $dbpassword); etc does these remain the same or are they different. No, that's for MySQL, hence the name of the function, mysql_connect(). You'll want to use mssql_connect() and the mssql_() family of functions. RTFM: http://php.net/mssql If you're on a *NIX-like box, you'll also need to build and install FreeTDS. 2. unlike in mysql with phpmyadmin which is browser based to access databases and tables how to access sql server for the same functionality STFW before asking here: http://www.google.com/search?q=phpmyadmin+sql+server 3. can anyone provide a link about a manual for using sql database with php Again, STFW and RTFM. http://www.google.com/search?q=php+sql+server http://php.net/mysql http://php.net/mssql Also, keep in mind that you'll have to rewrite all parts of your code that currently utilize MySQL to convert it to MSSQL/SQL Server. -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Fastest way to get table records' number
On Wed, Mar 19, 2008 at 1:19 PM, Andrew Ballard [EMAIL PROTECTED] wrote: On Wed, Mar 19, 2008 at 1:04 PM, TG [EMAIL PROTECTED] wrote: It seems that count(*) pulls all the data from the row then performs a count increment whereas count(did) only pulls the 'did' column. Again, I don't believe COUNT(*) pulls any data. If there is a row, it simply counts it. The row could be full of NULLS (if allowed by your schema - yikes) and it will still be counted. I'd guess that COUNT(1) does the same thing. COUNT(did) does only examine the `did` column, but NULL values are excluded from the count. You are correct, sir! COUNT(*) doesn't look into the data at all, it just counts all rows. Keep in mind that COUNT(*) may very well return a different result than the cardinality of the table, since COUNT(*) couldn't care less if the row is unique or not. I wonder if count(did) is the same speed as count(1) or if it will depend on how much/what type of data is in 'did'. I also wonder why count() takes a parameter. Isn't it always going to count +1 for the row? I'll have to look that up sometime. It takes a parameter because it depends on what you want to count. COUNT(*) will return the number of rows matching the WHERE clause. COUNT(`column_name`) will return the number of non-NULL values in the column `column_name`. You could have a million rows in the table, but if every row has NULL in `column_name`, the COUNT() will return 0. There is also COUNT(DISTINCT `column_name`), which counts the number of distinct, non-NULL values in the column. You can extend a SELECT COUNT(*) query almost exactly like you would a basic SELECT query. Examples: SELECT COUNT(*) FROM users WHERE username LIKE '%dan%'; SELECT COUNT(DISTINCT color) FROM products; SELECT COUNT(*) FROM table LIMIT 0,1; Any limits or the like on the query (such as in the last example) will pretty much be ignored, though, because COUNT(*) only returns the number of matching rows, not any other data whatsoever. -- /Daniel P. Brown Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Query table / results to an array
On Fri, Feb 29, 2008 at 12:22 AM, Ron Piggott [EMAIL PROTECTED] wrote: $reference_number = mysql_result($search_result,$i,reference_number); $description = mysql_result($search_result,$i,description); ? $sql = SELECT reference_number FROM table WHERE this='whatever' OR that NOT LIKE '%whatever%' LIMIT 0,1; $result = mysql_query($sql); $row = mysql_fetch_array($result); ? Just mind the line-wrapping in this message. ;-P -- /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] str_replace removing unwanted characters...
On Fri, Feb 29, 2008 at 2:18 PM, VanBuskirk, Patricia [EMAIL PROTECTED] wrote: Someone from this list (sorry I cannot remember the name), a while back, gave me the following function to use to get rid of unwanted characters coming in on forms: function convert_smart_quotes($string) { $search = array(chr(145), chr(146), chr(147), chr(148), chr(151), #, ;, [, ], {, // Note the missing } closing curly bracket here , , =, URL=http://;); Above, there are only 14 search terms, but below, there are 15 replace terms. Below the line I commented, add: }, $replace = array(', ', '', '', -, number, ,, , , , , , , equals, ); return str_replace($search, $replace, $string); } [snip!] 2. New VM Tree Greeting 1- Need NEW DN for this!!! (Please coordinate with Suzanne for recordings). See the parentheses above? I'll bet dollars to donuts that's your killswitch. See my updated arrays at the end of this email. [snip!] Also, we are getting back for example I\'m hoping... Somehow the slashes are coming through in the field and in the emails. I am not even sure what is putting them in, as I don't see that in the replace function. There's either an addslashes() function somewhere or a missing stripslashes(). Prior to inserting the data into the database, you should sanitize it using mysql_real_escape_string(). So, for example, if your SQL query looks like this: $body = convert_smart_quotes($string); $sql = INSERT INTO email(body) VALUES($body); It should be changed to: $body = mysql_real_escape_string(stripslashes(convert_smart_quotes($string))); $sql = INSERT INTO email(body) VALUES($body); And if that's not fixing the error for emails being sent, then find where the mail() function resides and replace the message body variable with something similar to: $message = stripslashes($message); Finally, the new arrays (rewritten function) I promised. function convert_smart_quotes($string) { $search = array(chr(145), chr(146), chr(147), chr(148), chr(151), #, ;, [, ], {, }, (, ), !, , , =, URL=http://;); $replace = array(', ', '', '', -, number, ,, , , , , , , ., , , , equals, ); return str_replace($search,$replace,$string); } -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP Database Mailing List (http://www.php.net
Re: [PHP-DB] Password Reset
On Wed, Feb 27, 2008 at 1:52 AM, Nasreen Laghari [EMAIL PROTECTED] wrote: Hi, I have encrypted password in database and I encrypted using MD5(). As it is a one-way Hash so I cant get password back to original text !!! What encrypting technique I used to encrypt password so if user forget, I can decrypt password and email it. There are a bunch you could use, from the sickeningly simple (ROT-13) to a key-based reversible algorithm (Blowfish/Twofish). However, your best bet would just be to generate a new, random password, and email it to the user. Then, when they successfully retrieve the new password and log in, require them to change their password. This will also allow them to go back to the password they were using, should they choose to do so. ADDED BONUS! Lesson in Terminology: ;-P Encryption: CAN be decrypted. Blowfish, Twofish, DES, et cetera. Hash:CAN NOT be de-hashed. MD5, SHA1, *nix salts, et cetera. -- /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
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] SELECT query with multiple WHERE Clause
On Wed, Feb 27, 2008 at 6:44 PM, Nasreen Laghari [EMAIL PROTECTED] wrote: I am creating a SEARCH, by only using one table. The search form is same as Inserting item (search has form of all fields in table ), difference is SEARCH page doesnt have validation . Therefore user can enter information in any of field. I would like to know how to write a SELECT query which has multiple where clause with OR operator. SELECT * FROM tableName WHERE (colA LIKE '%value%' OR colB='1'); --- more --- SELECT fieldA,fieldR,fieldT,fieldX FROM tableName WHERE (colA='value' OR colB LIKE 'Hello%') AND colC='Active'; -- /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
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
Re: [PHP-DB] INSERT query with Primary and foreign key
On Mon, Feb 25, 2008 at 8:15 PM, Nasreen Laghari [EMAIL PROTECTED] wrote: Hi, I need help to insert date into two tables when tables have primary and foreign key relationship using php. I tried simple INSERT query but foreign key colum is storing NULL. What's your SQL query string, Nasreen? -- /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] MySQL replication delaying issue
On Tue, Feb 26, 2008 at 10:49 AM, Lasitha Alawatta [EMAIL PROTECTED] wrote: Hello Everybody, We have 6 multi-master MySql instances within a LAN , that are replicating is a sequential manner. Server Environment : Six identical Linux Enterprise version 4 running, servers with having MySQL version 6. we are using MySQL multi-master replication method for database replication. There is a delay (5-7 minutes) of that data replication process. We notice that it's because of MySQL table locking. Your comments are highly appreciated. Ask on a MySQL list. It has nothing to do with PHP. http://lists.mysql.com/ Specifically: Replication - http://lists.mysql.com/replication -- /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] How to recognize which 'case' is being echoed by switch statement
On Fri, Feb 22, 2008 at 6:01 AM, Tim Daff [EMAIL PROTECTED] wrote: Hi, This is my first time using php in my site navigation, I have the code for all the pages in one file and I am using the switch statement to change between them. [snip!] None of your code included a case/switch piece. This is probably what you mean: ? $page = basename($_SERVER['PHP_SELF']); switch($page) { case contact.php: $css = li id=\contact-active\/li; break; case portfolio.php: $css = li id=\portfolio-active\/li; break; case whoweare.php: $css = li id=\whoweare-active\/li; break; default: $css = li id=\home-active\/li; break; } ? -- /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] Uploading Image using PHP and mySQL
On Feb 18, 2008 6:56 PM, Chris [EMAIL PROTECTED] wrote: Which bit breaks exactly? Nobody's going to read through 200 lines of code.. Normally, you're right but today I did just to be a jerk and prove you wrong. ;-P Nasreen Laghari wrote: Hi All, First of all A very big thank you to all of you for solving my Password() encryption problem. Now I'm stuck on new problem which is image not uploading. I'm using the following code. [snip!] $allowedImageTypes = array(gif,jpg,png); if(empty($_FILES['image_file']['tmp_name'])){ echo File not uploaded; } else { $fileType = $_FILES['file']['name']; if(in_array(getfileType($fileType), $allowedImageTypes)){ [snip!] Nasreen, The above code depends on two things: a.) The getfiletype() response exactly matches at least one of the entries in the array $allowedImageTypes b.) The response and array entry are matched cAsE-sEnSiTiVeLy If you're uploading an image that was created in Windows Paint, for example, the extension will be CAPITALIZED (imagename.JPG) by default. Try using a strtolower() in your getfiletype() function to see if it clears things up. $query = INSERT INTO artist (name,about_u,imgdata, profile_url) VALUES('$aname','$aboutu','$uploadedImage','$url_provided'); You have an sql injection problem here. Read up about that on the phpsec.org site: http://phpsec.org/projects/guide/3.html#3.2 and a really good basic guide here: http://unixwiz.net/techtips/sql-injection.html -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- /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] Uploading Image using PHP and mySQL
On Feb 18, 2008 6:56 PM, Chris [EMAIL PROTECTED] wrote: $query = INSERT INTO artist (name,about_u,imgdata, profile_url) VALUES('$aname','$aboutu','$uploadedImage','$url_provided'); You have an sql injection problem here. Read up about that on the phpsec.org site: http://phpsec.org/projects/guide/3.html#3.2 and a really good basic guide here: http://unixwiz.net/techtips/sql-injection.html And in addition to the links Chris suggested, also RTFM on mysql_real_escape_string(). It'll be your new best friend (unless you're already using mysqli). -- /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] Best ORM?
On Feb 19, 2008 5:46 PM, D Unit [EMAIL PROTECTED] wrote: Hi, I have an existing database and an existing set of classes. As my code base is growing, manually writing SQL to map between the two is getting old. My classes/database do not match up ActiveRecord style. Which is the best ORM for mapping between the two? You were on Nabble, you should've searched the archives. If you check in the archives, you'll see we had a discussion on this just a few days ago. You should get some pretty good answers on there, and if not, come back and ask any questions you need to clarify. -- /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] Password decryption
On Feb 16, 2008 10:17 PM, Nasreen Laghari [EMAIL PROTECTED] wrote: Hi, I'm junior in PHP and stuck on Encryption. I have encrypted password using SQL : $query = insert into user (userid,password,) values ('$username',Password('$pass'));; It's a one-way encryption method, so you won't be able to see the plain-text equivalent of the password again, but you can use this when testing a login: SELECT * FROM user WHERE userid='.$username.' AND password=PASSWORD('.$pass.'); Also, to correct your $query above, some things to note: PASSWORD is a reserved word in MySQL, so you shouldn't name any columns or databases as such. You have a comma after `userid,password,` in your column bracket. With PHP, you shouldn't end your MySQL query with a semicolon. The code needs it to terminate the line, the query doesn't. -- /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] Help with MySql float
On Feb 17, 2008 10:59 AM, Velen [EMAIL PROTECTED] wrote: Hi Guys, When inserting a value like 123567.8956 in my table it is rounding it to 2 decimal place. The field type is set as float. Can anyone tell me why it's not taking all the decimals? and How to insert the number with all the decimals? That's a MySQL question, not a PHP question, but my guess is that the column is set as FLOAT(x,2) (where x is any real number). Try changing that to FLOAT(10,4). The first number is everything to the left of the decimal, while the second is the number of places to count after the decimal. -- /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