[PHP-DB] Partial solution to: Installing IBM DB2 drivers onto an Apache Server under Fedora 16 x64 to access IBM POWER7 DB2 via PHP....
All - After working with this problem for a while, I am now making progress. I've seen this problem that people have been coming across throughout the Internet and since I now have a solution, I wanted to share it with everyone else out there. I had a problem where I was unable to install the Zend PHP server under Fedora (16 or 17, 32-bit or 64-bit). Each time, I would get a 'cyclic' error that kept coming back to 'zend-base' and couldn't move past that. Well, after bouncing some e-mails with Zend Support, here's what I got. I needed to manually install 'zend-base' with rpm and, after that, I was able to get the Zend PHP server to install. Here's the sequence of steps I performed: yum install httpd rpm -Uvh http://repos-source.zend.com/zend-server/5.6/rpm/x86_64/zend-base-5.6.0-276.x86_64.rpm yum install zend-server-php-5.3 The 'rpm' install required that httpd be in place already, so that's why I had to do that first. Afterwards, the installation of the Zend PHP trial server (or the CE edition - I tried both) worked perfectly fine. I now need to proceed on with the testing of the DB2 stuff (thanks again, Daniel, for the great step-by-step!!) and once I get it working, I'll share it. Charles _ Charles Buege | The Morey Corporation | Research and Development/IT Special Projects 100 Morey Drive | Woodridge, IL 60517 Phone: 630-754-2181 | Fax: 630-754-2581 | Cell: 630-605-2077 cbu...@moreycorp.com | www.moreycorp.com Follow us on Twitter! http://twitter.com/Moreycorp This e-mail, including attachments, may contain information that is confidential and/or proprietary, and may only be used by the person to whom this email is addressed. If the recipient of this e-mail is not the intended recipient or an authorized agent, the reader is hereby notified that any dissemination, distribution, or copying of this e-mail is prohibited. If this e-mail has been delivered to you in error, please notify the sender by replying to this message and deleting this e-mail immediately.
Re: [PHP-DB] Installing IBM DB2 drivers onto an Apache Server under Fedora 16 x64 to access IBM POWER7 DB2 via PHP....
Dan (and others) - I know this isn't a 'database' question, but I thought I'd start my replying to this message before I went elsewhere. I've also posted this to the Zend Community Edition forums and am still waiting to hear back there too. I've done most of this and I've added the Zend repository into my yum to install the Zend Server, but each time I try to install using 'yum install zend-server-php-5.3' (or 5.2) I get this at the end of the install command: Finished Dependency Resolution Error: Package: php-5.3-dev-zend-server-5.3.9-277.x86_64 (Zend) Requires: zend-base Error: Package: jq-daemon-zend-server-5.6.0-287.x86_64 (Zend) Requires: zend-base Error: Package: lighttpd-zend-server-1.4.26-13.x86_64 (Zend) Requires: zend-base Error: Package: php-5.3-page-cache-zend-server-6:5.6.0-284.x86_64 (Zend) Requires: zend-base Error: Package: php-5.3-code-tracing-zend-server-5.6.0-278.x86_64 (Zend) Requires: zend-base Error: Package: zend-server-php-5.3-5.6.0-341.noarch (Zend_noarch) Requires: zend-base Error: Package: php-5.3-jobqueue-zend-server-5.6.0-298.x86_64 (Zend) Requires: zend-base Error: Package: deployment-daemon-zend-server-5.6.0-277.x86_64 (Zend) Requires: zend-base Error: Package: php-5.3-data-cache-zend-server-5.6.0-273.x86_64 (Zend) Requires: zend-base You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest I also get this if I download the Zend setup script and try to do it that way too. Anyone have any suggestions as to how I can get the 'zend-base' package installed? I've tried doing 'yum install zend-base' and just get this: # yum install zend-base Loaded plugins: langpacks, presto, refresh-packagekit Resolving Dependencies -- Running transaction check --- Package zend-base.x86_64 0:5.6.0-276 will be installed -- Restarting Dependency Resolution with new changes. -- Running transaction check --- Package zend-base.x86_64 0:5.6.0-276 will be installed -- Finished Dependency Resolution # Thanks, all! Charles _ Charles Buege | The Morey Corporation | Research and Development/IT Special Projects 100 Morey Drive | Woodridge, IL 60517 Phone: 630-754-2181 | Fax: 630-754-2581 | Cell: 630-605-2077 cbu...@moreycorp.com | www.moreycorp.com Follow us on Twitter! http://twitter.com/Moreycorp From: Daniel Krook kr...@us.ibm.com To: php-db@lists.php.net, Cc: Charles W Buege cbu...@moreycorp.com Date: 05/11/2012 09:35 AM Subject: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
[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 and installed the ksh package. Now, at this point, I will freely admit that I am not 100% sure what is meant by step #3 on this page: For the Java and ODBC/CLI drivers (which it says are needed for the PHP drivers), uncompress the driver file into your chosen install directory on the target machine. It's the verbage of 'chosen install directory' that is throwing me. So, in an effort to move ahead and get the ODBC/CLI drivers loaded, I went on to this page: Installing the IBM Data Server Driver for ODBC and CLI - http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.cli.doc%2Fdoc%2Ft0023864.html At this point, I read these instructions which seemed to confuse me even more since I wasn't working with a DB2 Version 9 cd at all and thought I'd post to this list to see if anyone has any suggestions/recommendations. In an effort to answer some questions in advance, here's some things that I can offer: Why am I using Fedora 16? We are an electronics manufacturing company and that is what my Engineering department uses for their development purposes. I am not married to using Fedora 16 - I have been working with Engineering a lot in the last several months performing virtualizations of several Linux boxes so in an effort to be of better assistance to them, I decided to start this project using Fedora and have learned a lot. Am I open to other linux distros? Sure. You've got another suggestion, please throw it my way. I'm MORE than willing to listen What are the specs of the Fedora box I'm using? It's a Dell desktop, x64 with 8 Gig of RAM and a 2.8 (I'm pretty sure) GHz processor. It's got a 2TB hard drive, but I doubt that'll matter If anyone would like any additional clarification/details or does have any recommendations, please feel free to e-mail me directly as I do only get this list in its digest form. Thanks in advance, Charles Buege _ Charles Buege | The Morey Corporation | Research and Development/IT Special Projects 100 Morey Drive | Woodridge, IL 60517 Phone: 630-754-2181 | Fax: 630-754-2581 | Cell: 630-605-2077 cbu...@moreycorp.com | www.moreycorp.com Follow us on Twitter! http://twitter.com/Moreycorp This e-mail, including attachments, may contain information that is confidential and/or proprietary, and may only be used by the person to whom this email is addressed. If the recipient of this e-mail is not the intended recipient or an authorized agent, the reader is hereby notified that any dissemination, distribution, or copying of this e-mail is prohibited. If this e-mail has been delivered to you in error, please notify the sender by replying to this message and deleting this e-mail immediately.
Re: [PHP-DB] ? SELECT TABLE Command
Chris wrote (in news:[EMAIL PROTECTED]): It is an SQL query (probably MySQL, but perhaps SQLite or possibly even PGSQL or mSQL): The line after $query should tell you what uses it ;) Sorry, I meant the book may have been about any of those; I was skimming through a bunch of SQL books at that time and dont know which one I got it from. $query=SELECT TABLE $tablename;; if (mysql_query($query, $link)) { echo($indent.The table, '$tablename', was successfully opened.br /\n); } To make things even stranger, it works fine in the original program that I put it in (although what, if anything, it does is beyond me), but fails when I try it in another program (yes, I took care of $tablename). What's the exact query that's run? Maybe $tablename contains more than just a table name. Nope, its just SELECT TABLE lyrics; Different mysql version? Maybe it was in an older version of mysql but they removed it. It doesn't work in mysql5 or mysql4.0, maybe it does in an older version though. Looks like you're trying to check that the mysql user you connected as has access to that table. It really feels like a command I may have used in the SQLite analyzer or something. However, Im sure I copied it from an example script in a book. I ve put holds on all the books on PHP and (My)SQL at the library and will check them all. -- Mike W. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sorting Multidimensional Array
You should be able to use usort() On 10/31/06, Keith Spiller [EMAIL PROTECTED] wrote: Hi, RE: Sorting Multidimensional Array I'm trying to sort a multidimensional array. The data was taken from a mysql query: $myrow = mysql_fetch_row($result) { query[] = $myrow; } The purpose is to retrieve the table data and manually add a record, then sort ASC by the startdate which is the forth field... Something like: $test = array_multisort($query, $key = '$query[4]'); Any help would be greatly appreciated. Thanks, Larentium -- Dave W
Re: [PHP-DB] mysql databases
He means that he wants to use REPLACE and take out the old entry and update it with a new one. Although, you would probably use UPDATE instead. -- Dave W
Re: [PHP-DB] Php 5 and Mysql on Windows
You might want to try php.ini-recommended instead of php.ini-dist. On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey I did that already. Step (8) of setting up php. Do I need to move any files around or add anything else to the path? -Original Message- From: Stut [EMAIL PROTECTED] Sent: Tue, October 3, 2006 14:12 To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Php 5 and Mysql on Windows [EMAIL PROTECTED] wrote: I setup Mysql as follows: 1. Download the 5.x installer 2. Run the installer 3. Run the configuration tool ater the installer When I run the following script, the error Fatal error: Call to undefined function mysql_connect() in Test.php on line 3 is returned. $conn = mysql_connect('localhost', 'root', 'password') Installing MySQL is not enough - you need to enable the mysql extension in your php.ini. -Stut -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
[PHP-DB] Re: Turning result into array from columns
Yea, thanks. I forgot to hit reply to all. I usually use sprintf for mysql injection stuff. I use that function from php.net for mysql_real_escape_string. On 9/23/06, Matthias Willerich [EMAIL PROTECTED] wrote: Hello, $q = sprintf(SELECT id FROM content); This has nothing to do with your problem, but why don't you just do the following? $q = 'SELECT id FROM content'; But here's your problem. Change $realones = $row['id']; into $realones[] = $row['id']; And you get your desired result. Matthias -- Dave W
[PHP-DB] Turning result into array from columns
So I'm trying to pull id's and put them into an array. I know I need to iterate through them, but it doesn't seem to turn into an array. Here's the function that I'm trying: function checkID($id) { $q = sprintf(SELECT id FROM content); $result = $this-query($q); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $realones = $row['id']; } if(in_array($id,array($realones))) { return true; } else { return false; } } It's only grabbing the first row id and putting it into the array. It won't put any of the other ones in. If I just echo $row['id'], it will show both of them, just not put both of them into an array. -- Dave W
Re: [PHP-DB] Forms with letter verification
You mean a CAPTCHA script? On 7/29/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote: You know forms which have a security field where the user reads back the letters that are displayed? I am wondering if someone has the time to coach me in writing this --- or if you know of a web page that shows how to create this feature. I have already created a set of graphical letters. Ron -- Dave W
[PHP-DB] pulling numbers from a column and getting a total
Hi, I was just wondering on how I could get a whole column full of integers and added them up and display that total? I currently use a for loop to display the whole column in a table, but I wanted to add all those numbers up. Thanks. -- Dave W
Re: [PHP-DB] pulling numbers from a column and getting a total
Thanks Natalie and Miles! The loop thing worked. What I had tried before was put the echo inside the loop and it wasn't working, but now it does, w00t! Thanks! On 7/26/06, Miles Thompson [EMAIL PROTECTED] wrote: At 10:27 AM 7/26/2006, Dave W wrote: Hi, I was just wondering on how I could get a whole column full of integers and added them up and display that total? I currently use a for loop to display the whole column in a table, but I wanted to add all those numbers up. Thanks. -- Dave W Dave, You're v. close to an answer. Think about it a bit. Initialize a variable before your loop, setting it to zero. $tot = 0; In the loop, add the amount to that variable, $tot += $num_to_add; OR $tot = $tot + $num_to_add; After the loop, echo $tot. HTH - Miles -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.394 / Virus Database: 268.10.4/399 - Release Date: 7/25/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
[PHP-DB] Re: Subject: making an array from data in textfile
Thanks for all the suggestions. On 7/24/06, Neil Smith [MVP, Digital media] [EMAIL PROTECTED] wrote: Message-ID: [EMAIL PROTECTED] Date: Sat, 22 Jul 2006 21:31:35 -0400 From: Dave W [EMAIL PROTECTED] To: Php-Db php-db@lists.php.net MIME-Version: 1.0 Content-Type: multipart/alternative; boundary==_Part_157142_2227727.1153618295222 Subject: making an array from data in textfile OK, so I have this text file that holds a list of ip addresses like this: 127.0.0.1,127.0.0.1,127.0.0.1,127.0.0.1,127.0.0.1 Which are strings... You with me OK so far ? Numeric [float] values only have 1 period. There's no numeric datatype which has 3. Currently, here is my code: $file = 'ip.txt'; $fh = fopen($file, 'r'); $theData = fread($fh, filesize($file)); fclose($fh); $ips = array($theData); Since it's a numeric array, No, it isn't. It's an array of strings which has numeric indices (or keys depends what you call em) I shouldn't need quotes around the ip octets. Yes, you should : They're strings unless you use inet_pton to convert them to numeric values. When I try to echo certain parts of the array like: echo $ips[0]; It's returning the whole array. If you print_r($ips) you'll see the array structure (View - Source if you're looking at it in a browser). My guess is your lines aren't terminated in \r\n, which PHP uses to split the lines to array values. You'll probably have to use some other method such as explode(',', $ips) to break the individual comma separated entries into a set of values. Other methods such as file_get_csv are generally more efficient than reading line by line : http://uk.php.net/manual/en/function.fgetcsv.php The text file is exactly like an array so it shouldn't be a problem. It's exactly like a CSV, from the example data you provided. PS, please don't feel the need to prove it by posting the entire log file ;-) Cheers - Neil -- Dave W
Re: [PHP-DB] Re: making an array from data in textfile
I figured it out before, but I didn't hit reply all. I used files() and newlines to create it. Would using explode be a more reliable way? On 7/23/06, Stut [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave W wrote: Currently, here is my code: $file = 'ip.txt'; $fh = fopen($file, 'r'); $theData = fread($fh, filesize($file)); fclose($fh); $ips = array($theData); ... Since it's a numeric array, I shouldn't need quotes around the ip octets. OK, well I did a debug and this is whats coming out: Array ( [0] = 127.0.0.1,127.0.0.1,127.0.0.1 ) PHP doesn't know what separates each element of the array, so you need to tell it... $ips = explode(',', $theData); - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEw2cA2WdB7L+YMm4RAlmaAJ4+cRJulnESdiZMZ5XtGWZ6Su5TzQCguSSY fAqVdvlg4xX+RgrMepUJbc0= =jI3V -END PGP SIGNATURE- -- Dave W
Re: [PHP-DB] Re: making an array from data in textfile
Well, its what I want so I could do a foreach array like this and print out the ips in a table: foreach($ips as $value) { $value = trim($value); $domain = gethostbyaddr($value); echo tr class=\alternate\ th scope=\row\3/th td$value/td td$domain/td/tr ;} echo ' /tbody/table/div'; It works! On 7/23/06, Stut [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave W wrote: I figured it out before, but I didn't hit reply all. I used files() and newlines to create it. Would using explode be a more reliable way? I assume you mean the file() function, not files(). The only problem with doing it that way is that each element of the array will have a newline on the end. Maybe this is what you want, but I doubt it. - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEw3tl2WdB7L+YMm4RAg3xAJ0SPUPR+00PXVIfJhDfg4WrBWVi/ACgsFOu 9usmbLbhNrXUCef+uCyzAY4= =RXbe -END PGP SIGNATURE- -- Dave W
Re: [PHP-DB] Using MAX with COUNT?
Why don't you use a where instead of a group function? On 7/22/06, Skip Evans [EMAIL PROTECTED] wrote: Hey all, I have a table like this: boroughID Area = 1 Chelsea 1 East Village 1 West Village 1 So Ho 2 Prospect Park 2 Brooklyn Heights 3 Prospect Heights What I want to know is which boroughID has the most area's assocated with it, and how many. So I tried this: SELECT max(count(*)) FROM `bsp_area` GROUP BY boroughID ...and got an Invalid use of group function error. Anyone think of another way to do this in a single SQL statement, or some other simple method? -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
[PHP-DB] making an array from data in textfile
OK, so I have this text file that holds a list of ip addresses like this: 127.0.0.1,127.0.0.1,127.0.0.1,127.0.0.1,127.0.0.1 Currently, here is my code: $file = 'ip.txt'; $fh = fopen($file, 'r'); $theData = fread($fh, filesize($file)); fclose($fh); $ips = array($theData); Since it's a numeric array, I shouldn't need quotes around the ip octets. When I try to echo certain parts of the array like: echo $ips[0]; It's returning the whole array. The text file is exactly like an array so it shouldn't be a problem. -- Dave W
[PHP-DB] Re: making an array from data in textfile
OK, well I did a debug and this is whats coming out: Array ( [0] = 127.0.0.1,127.0.0.1,127.0.0.1 ) Should I use fgets? On 7/22/06, Dave W [EMAIL PROTECTED] wrote: OK, so I have this text file that holds a list of ip addresses like this: 127.0.0.1,127.0.0.1,127.0.0.1, 127.0.0.1,127.0.0.1 Currently, here is my code: $file = 'ip.txt'; $fh = fopen($file, 'r'); $theData = fread($fh, filesize($file)); fclose($fh); $ips = array($theData); Since it's a numeric array, I shouldn't need quotes around the ip octets. When I try to echo certain parts of the array like: echo $ips[0]; It's returning the whole array. The text file is exactly like an array so it shouldn't be a problem. -- Dave W -- Dave W
Re: [PHP-DB] Discussion board integration
Yea, phpBB2 is tough to integrate. I've been working with MyBB and I think it's great! The templating is very simple (By bb standards). It's less mature than phpBB, but they fix bugs faster and is quickly becoming very stable. It works a lot like vBulletin except it's free and open source. I know there is SMF too, but I don't use it, so I really can't tell you anything about it. On 7/19/06, Skip Evans [EMAIL PROTECTED] wrote: Hey all, I've got a requirement for a discussion board on a new site we are building for a client. I've integrated phpBB2 for discussion onto existing sites before, but was wondering if anyone had any experience with other PHP discussion boards they favored over phpBB2. I found the login integration of BB2 especially troublesome, though I did get it to work in the end. -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
Re: [PHP-DB] Submitting form from a href
The problem with GET is that a user that looks at the source code of the html can easily just input what they want for the argument. Can you say SQL injection? On 7/17/06, Sean Mumford [EMAIL PROTECTED] wrote: Couldn't you achieve the same effect without javascript by simply using GET values instead of post? As in each hyperlink would say something like a href=search.php?letter=aA/a a href=search.php?letter=bB/a, although perhaps you're trying to intentionally avoid using GET as to not clutter up their browser history. .. -Original Message- From: Andrew Kreps [mailto:[EMAIL PROTECTED] Sent: Friday, July 14, 2006 7:15 PM To: Skip Evans Cc: Php-Db Subject: Re: [PHP-DB] Submitting form from a href Skip, Just so you know, there is a general PHP user's list available for just such a request. It's rather high-traffic, so be warned. Now then, on to the problem. I believe I've figured out a way to make this happen. I've only tested it on IE 6 and Firefox 1.5.0.4, so your browser compatibility may vary. I'll just post the scripts I used to test it here and you can take what you need and run with it. Here is the script that my form is built in: -- html head script language=Javascript function submitForm (letter) { document.search.letter.value = letter;// Here's where we're setting the form value 'letter' to the letter the user clicked on. document.search.submit(); // Then, submit the form. } /script /head body form name=search method=POST action=testingLinkSubmit.php input type=hidden name=letter value= !-- If this isn't here, the Javascript letter.value code won't work, since form.letter doesn't exist. -- input type=checkbox name=checky/ Search all campuses br ? for ($i = 65; $i = 90; $i++) { $letter = chr($i); print a href=\javascript:submitForm('$letter')\$letter/a ; } ? /form /body /html - The receiving end of the form looks much as you might expect, it just parses the form values: -- html body ? if (isset($_POST[checky])) { print Checkbox value is: Truebr\n; } else { print Checkbox value is: Falsebr\n; } print Letter: . $_POST[letter]; ? /body /html And there you go! Let me know if you have any problems. On 7/14/06, Skip Evans [EMAIL PROTECTED] wrote: Hey all, This is not database related, but I get the impression this list entertains general PHP questions? If I'm mistaken, flame away. I need submit a form when a hyper link is pressed, and have been trying all manner of onlicks, etc, but have been unable to hit the right combination. Here's the scenario: I have the alphabet in hyper links with a check box below: form... A B C D E F G H I J K. [] check for all campuses /form What needs to happen is that when they click a letter, which is a a href=... now, it submits the check box value as well, to be read through $_POST on the receiving end. And of course I need to know what letter was click, this I was trying to get through a $_REQUEST var, but was not able to do so. Any tips would be monstrously appreciated. -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
[PHP-DB] detecting negative numbers
Currently I have this: if($quant $amount) {echo You don't have that many!; } $quant is the user inputted amount and $amount is the amount that they actually have. Is there any way of checking if the result is negative rather than doing what I have above? -- Dave W
Re: [PHP-DB] detecting negative numbers
They are both positive numbers. I want to see if, when subtract, do they equal a negative number? On 7/16/06, Peter Beckman [EMAIL PROTECTED] wrote: On Sun, 16 Jul 2006, Dave W wrote: Currently I have this: if($quant $amount) {echo You don't have that many!; } $quant is the user inputted amount and $amount is the amount that they actually have. Is there any way of checking if the result is negative rather than doing what I have above? I'm not sure which result you are refering to, but this echo's if: $quant is greater than $amount $amount is less than 0 $quant is less than 0 if ($quant $amount or $amount 0 or $quant 0) { echo You don't have that many!; } --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- Dave W
Re: [PHP-DB] detecting negative numbers
No, I get it. I just thought that there might have been some built in function like if(neg_num($quant - $amount)) or something like that. I know how to do it, but I thought that there might have been an alternate method. Just because I asked a simple question doesn't mean I'm stupid, I'm just curious if there is a simpler way to do an already simple task. On 7/16/06, Stut [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave W wrote: Currently I have this: if($quant $amount) {echo You don't have that many!; } $quant is the user inputted amount and $amount is the amount that they actually have. Is there any way of checking if the result is negative rather than doing what I have above? Not sure which way around you want it, but I think this is what you are after... if (($quant - $amount) 0) { echo You don't have that many!; } I don't mean any offense, but the possibility that someone who couldn't figure that out is writing PHP code scares me. You might want to think about Googling for an absolute beginners guide to programming before continuing. - -Stut -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEusYz2WdB7L+YMm4RAqGPAJ0QqkgfApO6h0GR9lXa47WyAhSsugCfaymW Ba+bqZRbrcv6CuZ6g7FJJjw= =ktnc -END PGP SIGNATURE- -- Dave W
Re: [PHP-DB] Re: posting information from a textarea
Ha! I figured the damn thing out! Using the full text type created a bunch of overhead and it wasn't storing it into the table. I realized that I was unsetting the post array before I was doing the print_r so that is why the variables weren't showing up. Then, I finally realized that for some reason, I had to convert the textarea to a utf encoding before I entered it into the database! That was annoying. On 7/6/06, Dave W [EMAIL PROTECTED] wrote: I think I might have found the problem, but I'm not sure how to fix it. I'm just going to rebuild the form and it make it seperate (with all the database calls in one page). For some reason, if I add another field before the motto and i change it, it changes motto too...w/e I'll just make a new one. On 7/6/06, Dave W [EMAIL PROTECTED] wrote: hmm..interesting. Neither the motto or desc is showing up in the array. I made a simple form and the echo 'post vars: ' . print_r($_POST, true) . 'br/'; works fine. I'm just perplexed on why the motto is still working and not the desc. Maybe it's because I'm using a fieldset, but then why wouldn't just one not work? On 7/6/06, Chris [EMAIL PROTECTED] wrote: Dave W wrote: I'll show you all the steps it passes through. Here's the form: form action=proc.php method=post fieldset label for=MottoMotto:/label input class=text type=text size=25 name=motto value=?php if($form-value(motto) == ){ echo $session-nationinfo['motto']; }else{ echo $form-value(motto); } ? / label for=descNation Description:/label textarea name=desc cols=50 rows=5?php if($form-value(desc) == ){ echo $session-nationinfo['desc']; }else{ echo $form-value(desc); } ?/textarea input type=submit value= Edit Nation / /fieldset /form It's echoing the nationinfo right, but its not posting it. The motto also works too. When it's submitted, it goes through the function procEditNation(). $session-editNation($_POST['motto'], $_POST['desc']); The editNation function: function editNation($motto, $desc){ global $database, $form; if($motto){ $field = motto; $motto = htmlspecialchars($motto); $database-updateNationField($this-username,motto,$motto); } if($desc){ $field = desc; $desc = htmlspecialchars($desc); $database-updateNationField($this-username,desc,$desc); } return true; } Then finally the updateNationField function: function updateNationField($username, $field, $value){ $q = UPDATE nations SET .$field. = '$value' WHERE username = '$username'; return mysql_query($q, $this-connection); } I just don't know what's wrong since it's posting the motto (which is just a text-type input) and not the description (which is a textarea). I echo'd out the mysql queries and excuted them myself from what echo'd out and it's selecting the desc column just fine. That definitely all looks fine. If you do: echo 'post vars: ' . print_r($_POST, true) . 'br/'; does it show up in post at all? -- Postgresql php tutorials http://www.designmagick.com/ -- Dave W -- Dave W -- Dave W
[PHP-DB] Re: posting information from a textarea
O, I also tried to change it to a $_FILES array, but that didn't work either. On 7/6/06, Dave W [EMAIL PROTECTED] wrote: I seem to be having a problem posting text from a text area. I have a form that posts data into a database and there are input fields which seem to post the data fine. I know this because the entry is changing in the database, but the text area text doesn't seem to be posting. I double checked to make sure i got the names right, but it still doesn't seem to be working. Before I put it into the database I'm using stripslashes. I thought that might of been the problem and I changed it to trim, but that didn't work. In the database, the field that I'm putting it into is a longtext type with fulltext. -- Dave W
[PHP-DB] posting information from a textarea
I seem to be having a problem posting text from a text area. I have a form that posts data into a database and there are input fields which seem to post the data fine. I know this because the entry is changing in the database, but the text area text doesn't seem to be posting. I double checked to make sure i got the names right, but it still doesn't seem to be working. Before I put it into the database I'm using stripslashes. I thought that might of been the problem and I changed it to trim, but that didn't work. In the database, the field that I'm putting it into is a longtext type with fulltext. -- Dave W
Re: [PHP-DB] posting information from a textarea
The inputs are posting, but the textarea still isn't. Argh! On 7/6/06, Brad Bonkoski [EMAIL PROTECTED] wrote: stripslashes should not be needed... if anything addslashes() may be needed if you have single quotes in the text area. I would say step 1 is to echo out your insert query to the page before you even excute the insert, to verify the query, and that you are getting the proper information from the form. -B Dave W wrote: I seem to be having a problem posting text from a text area. I have a form that posts data into a database and there are input fields which seem to post the data fine. I know this because the entry is changing in the database, but the text area text doesn't seem to be posting. I double checked to make sure i got the names right, but it still doesn't seem to be working. Before I put it into the database I'm using stripslashes. I thought that might of been the problem and I changed it to trim, but that didn't work. In the database, the field that I'm putting it into is a longtext type with fulltext. -- Dave W
Re: [PHP-DB] Re: posting information from a textarea
I'll show you all the steps it passes through. Here's the form: form action=proc.php method=post fieldset label for=MottoMotto:/label input class=text type=text size=25 name=motto value=?php if($form-value(motto) == ){ echo $session-nationinfo['motto']; }else{ echo $form-value(motto); } ? / label for=descNation Description:/label textarea name=desc cols=50 rows=5?php if($form-value(desc) == ){ echo $session-nationinfo['desc']; }else{ echo $form-value(desc); } ?/textarea input type=submit value= Edit Nation / /fieldset /form It's echoing the nationinfo right, but its not posting it. The motto also works too. When it's submitted, it goes through the function procEditNation(). $session-editNation($_POST['motto'], $_POST['desc']); The editNation function: function editNation($motto, $desc){ global $database, $form; if($motto){ $field = motto; $motto = htmlspecialchars($motto); $database-updateNationField($this-username,motto,$motto); } if($desc){ $field = desc; $desc = htmlspecialchars($desc); $database-updateNationField($this-username,desc,$desc); } return true; } Then finally the updateNationField function: function updateNationField($username, $field, $value){ $q = UPDATE nations SET .$field. = '$value' WHERE username = '$username'; return mysql_query($q, $this-connection); } I just don't know what's wrong since it's posting the motto (which is just a text-type input) and not the description (which is a textarea). I echo'd out the mysql queries and excuted them myself from what echo'd out and it's selecting the desc column just fine. On 7/6/06, Chris [EMAIL PROTECTED] wrote: Dave W wrote: I saw this bug: http://bugs.php.net/bug.php?id=22427. Could this be related to problem I'm having? Actually, show us the form you're trying to submit before doing anything else. Since we haven't seen any html or php code, guessing it's a bug is a bit of a stretch. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
Re: [PHP-DB] Re: posting information from a textarea
hmm..interesting. Neither the motto or desc is showing up in the array. I made a simple form and the echo 'post vars: ' . print_r($_POST, true) . 'br/'; works fine. I'm just perplexed on why the motto is still working and not the desc. Maybe it's because I'm using a fieldset, but then why wouldn't just one not work? On 7/6/06, Chris [EMAIL PROTECTED] wrote: Dave W wrote: I'll show you all the steps it passes through. Here's the form: form action=proc.php method=post fieldset label for=MottoMotto:/label input class=text type=text size=25 name=motto value=?php if($form-value(motto) == ){ echo $session-nationinfo['motto']; }else{ echo $form-value(motto); } ? / label for=descNation Description:/label textarea name=desc cols=50 rows=5?php if($form-value(desc) == ){ echo $session-nationinfo['desc']; }else{ echo $form-value(desc); } ?/textarea input type=submit value= Edit Nation / /fieldset /form It's echoing the nationinfo right, but its not posting it. The motto also works too. When it's submitted, it goes through the function procEditNation(). $session-editNation($_POST['motto'], $_POST['desc']); The editNation function: function editNation($motto, $desc){ global $database, $form; if($motto){ $field = motto; $motto = htmlspecialchars($motto); $database-updateNationField($this-username,motto,$motto); } if($desc){ $field = desc; $desc = htmlspecialchars($desc); $database-updateNationField($this-username,desc,$desc); } return true; } Then finally the updateNationField function: function updateNationField($username, $field, $value){ $q = UPDATE nations SET .$field. = '$value' WHERE username = '$username'; return mysql_query($q, $this-connection); } I just don't know what's wrong since it's posting the motto (which is just a text-type input) and not the description (which is a textarea). I echo'd out the mysql queries and excuted them myself from what echo'd out and it's selecting the desc column just fine. That definitely all looks fine. If you do: echo 'post vars: ' . print_r($_POST, true) . 'br/'; does it show up in post at all? -- Postgresql php tutorials http://www.designmagick.com/ -- Dave W
Re: [PHP-DB] Re: posting information from a textarea
I think I might have found the problem, but I'm not sure how to fix it. I'm just going to rebuild the form and it make it seperate (with all the database calls in one page). For some reason, if I add another field before the motto and i change it, it changes motto too...w/e I'll just make a new one. On 7/6/06, Dave W [EMAIL PROTECTED] wrote: hmm..interesting. Neither the motto or desc is showing up in the array. I made a simple form and the echo 'post vars: ' . print_r($_POST, true) . 'br/'; works fine. I'm just perplexed on why the motto is still working and not the desc. Maybe it's because I'm using a fieldset, but then why wouldn't just one not work? On 7/6/06, Chris [EMAIL PROTECTED] wrote: Dave W wrote: I'll show you all the steps it passes through. Here's the form: form action=proc.php method=post fieldset label for=MottoMotto:/label input class=text type=text size=25 name=motto value=?php if($form-value(motto) == ){ echo $session-nationinfo['motto']; }else{ echo $form-value(motto); } ? / label for=descNation Description:/label textarea name=desc cols=50 rows=5?php if($form-value(desc) == ){ echo $session-nationinfo['desc']; }else{ echo $form-value(desc); } ?/textarea input type=submit value= Edit Nation / /fieldset /form It's echoing the nationinfo right, but its not posting it. The motto also works too. When it's submitted, it goes through the function procEditNation(). $session-editNation($_POST['motto'], $_POST['desc']); The editNation function: function editNation($motto, $desc){ global $database, $form; if($motto){ $field = motto; $motto = htmlspecialchars($motto); $database-updateNationField($this-username,motto,$motto); } if($desc){ $field = desc; $desc = htmlspecialchars($desc); $database-updateNationField($this-username,desc,$desc); } return true; } Then finally the updateNationField function: function updateNationField($username, $field, $value){ $q = UPDATE nations SET .$field. = '$value' WHERE username = '$username'; return mysql_query($q, $this-connection); } I just don't know what's wrong since it's posting the motto (which is just a text-type input) and not the description (which is a textarea). I echo'd out the mysql queries and excuted them myself from what echo'd out and it's selecting the desc column just fine. That definitely all looks fine. If you do: echo 'post vars: ' . print_r($_POST, true) . 'br/'; does it show up in post at all? -- Postgresql php tutorials http://www.designmagick.com/ -- Dave W -- Dave W
[PHP-DB] splitting string from database
Hi, I am trying to take a number from a MySQL database and then split it into different strings using a comma. It's for display a cash amount into a table. It's stored in the database as something like 100 and I want for it to display as 1,000,000 on the table. This is what I got so far: ?php echo table align=\left\ border=\1\ cellspacing=\0\ cellpadding=\3\\n; echo trtdbCash/b/td/tr\n; for($i=0; $i$num_rows; $i++){ $cash = mysql_result($result,$i,cash); echo trtd$cash/td/tr\n; } echo /tablebr\n; ? All this does is return the number. I tried using explode and split, but I couldn't get either to work...It just kept saying Array in the cell. I also tried strtok. -- Dave W
Re: [PHP-DB] Cron unlink
You have to use the absolute (or server, whatever you want to call it) path. So like/home/www/sessions/files/ or whatever it is. On 7/2/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote: Does anyone have experience in getting unlink to work within the context of a cron? I created my own garbage collection function and I am trying to delete some session files through a cron that runs every 10 minutes. The session files are owned by 'www' The cron is ran by 'actsmin' The 'unlink' command works within the context of a php script when activated by a user on the web site. Is there another file deletion command within PHP other than unlink? Here is the error message I am e-mailed by the cron when it doesn't successfully delete a session file: Warning: unlink(/path/to/sessions/files/): Is a directory in /path/to/php/script/cron/calls/script.php on line 47 Any suggestions? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
Re: [PHP-DB] Cron unlink
oops. yea, chris is right. I thought you were trying to delete files. On 7/2/06, Dave W [EMAIL PROTECTED] wrote: You have to use the absolute (or server, whatever you want to call it) path. So like/home/www/sessions/files/ or whatever it is. On 7/2/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote: Does anyone have experience in getting unlink to work within the context of a cron? I created my own garbage collection function and I am trying to delete some session files through a cron that runs every 10 minutes. The session files are owned by 'www' The cron is ran by 'actsmin' The 'unlink' command works within the context of a php script when activated by a user on the web site. Is there another file deletion command within PHP other than unlink? Here is the error message I am e-mailed by the cron when it doesn't successfully delete a session file: Warning: unlink(/path/to/sessions/files/): Is a directory in /path/to/php/script/cron/calls/script.php on line 47 Any suggestions? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W -- Dave W
Re: [PHP-DB] ftp_connect($ftp_server);
Use the unlink function: $myFile = testFile.txt; unlink($myFile); On 7/1/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote: Every now and then the following command fails --- the FTP connection is refused by the server: $conn_id = ftp_connect($ftp_server); Is there a way to delete a file within PHP without having to FTP to the server? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dave W
[PHP-DB] mysql ORDER BY problems
Ok, here's what i got in my mysql db. I got a table listed with numbers as follows 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 25 These numbers I can display fine. I'm using .. $query=SELECT * FROM db ORDER BY numbers ASC; Right now it displays it as 1 10 11 12 . 2 22 23 25 3 4 5 6 7 Is there a way with my mysql query so that I can list the numbers in correct order? Any help is appricated. - Rob
Re: [PHP-DB] 時間の価値
argh! Whatever jap is being stupid and spamming the list, please stop! On 6/12/06, sakie [EMAIL PROTECTED] wrote: 1年の価値を知るには 卒業試験に落ちた学生に 聞いてみなさい 1ヶ月の価値を知るには 未熟児を産んだお母さんに 聞いてみなさい 1週間の価値を知るには 週刊誌の編集者に 聞いてみなさい 1時間の価値を知るには 会うのが待ちきれない恋人達に 聞いてみなさい 1分の価値を知るには 電車やバス、飛行機に乗り遅れた人に 聞いてみなさい 1秒の価値を知るには 事故で生き残った人に 聞いてみなさい 千分の1秒の価値を知るには オリンピックで銀メダルを獲った人に 聞いてみなさい 時間は待ってくれません あなたの持っている全ての時間を大切にしなさい そしてここで全てを発散しなさい http://vqlh.com/?jy111 拒否 [EMAIL PROTECTED] -- Dave W
[PHP-DB] Finding a process in *nix
Heres what i'm trying to do. $proc=exec('ps aux | grep proc'); if ($proc != ) { echo True; } if ($proc == ) { echo False; } but some time's it show's the ps aux so I dont get a true reading. Anybody have a way that I might be able to extract this out of there to get a true reading to find out if the process is running?
Re: [PHP-DB] Text file (rw) question...
Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
That works, but it just throws it in to a big loop and fills up the file, any suggestions? - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Yeah, but will that just replace the data that is present already there? I dont wanna have duplicate entries in there or i'm affraid it wont read it. The origional code you gave worked but it just ran in a big loop. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:42 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. In the simplest form: $new_textcontent = 'post_field=' . $_POST['post_field'] . \n; $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); I'd suggest cleaning up $_POST['post_field'] before just writing it (eg making sure it is only numbers, whatever data you actually want to keep in it). - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
So how do I make it so it just set's the variable's that are sent in the $_POST because i wanna write it so that if the value isnt changed, it wont send the $_POST and wont update the config file.. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 7:02 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Yeah, but will that just replace the data that is present already there? I dont wanna have duplicate entries in there or i'm affraid it wont read it. The origional code you gave worked but it just ran in a big loop. That particular example will replace the whole file. If you only want to replace a particular option then that's different - but we don't know what you are trying to do. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:42 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. In the simplest form: $new_textcontent = 'post_field=' . $_POST['post_field'] . \n; $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); I'd suggest cleaning up $_POST['post_field'] before just writing it (eg making sure it is only numbers, whatever data you actually want to keep in it). - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Text file (rw) question...
It's all fixed and works. If anybody is wondering how this turned out, here's the begining of the results. index.php ?php if (!($f=fopen(sc_serv.conf,r))) exit(Unable to open file.); while (!feof($f)) { $x=fgets($f, 100); list($variable, $data) = explode(=, $x); echo form method=\POST\ action=\update.php\; if ($variable == MaxUser) { echo Max Users: input type=\text\ value=\$data\ name=\MaxUser\ size=\3\br /; } if ($variable == Password) { echo Password: input type=\text\ value=\$data\ name=\Password\ size=\15\br /; } // echo $variable $databr /; } fclose($f); echo p /input type=\SUBMIT\ value=\Submit\ //form; ? update.php ? $newconfig = ; $maxuser=$_POST['maxuser']; $password=$_POST['password']; foreach($_POST as $area = $value) { $newconfig .= $area . = . $value . \n; } $fp = fopen('sc_serv.conf', 'w'); fputs($fp, $newconfig); fclose($fp); exit(); ? Thankyou to everyone who helped. Special thanks to Chris.
Re: [PHP-DB] Text file (rw) question...
Ah yes, that's true. I didnt realize that. Thanks for pointing that out. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:02 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: It's all fixed and works. If anybody is wondering how this turned out, here's the begining of the results. index.php ?php if (!($f=fopen(sc_serv.conf,r))) exit(Unable to open file.); while (!feof($f)) { $x=fgets($f, 100); list($variable, $data) = explode(=, $x); echo form method=\POST\ action=\update.php\; if ($variable == MaxUser) { echo Max Users: input type=\text\ value=\$data\ name=\MaxUser\ size=\3\br /; } if ($variable == Password) { echo Password: input type=\text\ value=\$data\ name=\Password\ size=\15\br /; } // echo $variable $databr /; } fclose($f); echo p /input type=\SUBMIT\ value=\Submit\ //form; ? update.php ? $newconfig = ; $maxuser=$_POST['maxuser']; $password=$_POST['password']; You're not using these variables anywhere so it'd be best to remove them (might be confusing later on if you need to come back to it). or you can leave them there and do: $newconfig = ''; $newconfig .= MaxUser= . $maxuser . \n; $newconfig .= Password= . $password . \n; instead of the foreach($_POST... loop. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Text file (rw) question...
I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated.
[PHP-DB] retreiving encrypted password
Dear all, When adding a new record to my db using '...password('password')...', it ads a ' * ' with the encrypted number when I work on Apache / MySQL, but not on IS. When trying to validate if the user has been registered, it does not validate and request the user to register even though already registered. Also tried 'encode(password, salt)' with the same result. Regards, W
[PHP-DB] Remove MySQL Server
Dear All, Anyone knows how to remove the MySQL server from XP under 'Services'? No option to delete or uninstall. R's, Will
[PHP-DB] MySQL Connect using Dreamweaver
Dear All, I have installed MySQL 5 with PHP 4.3.3. When trying to connect to a database form the 'Database' tab in Dreamweaver, I now get the following error when trying to select a DB: '1251 Client does not support authentication protocol requested by server; consider upgrading MySQL client' Regards, Will
[PHP-DB] NOT NULL - newbie
Dear All, When declaring values for an identifier with unsigned auto_increment, is it necessary to include NOT NULL? my_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, or my_id INT NOT NULL UNSIGNED AUTO_INCREMENT PRIMARY KEY, Regards, Will
Re: [PHP-DB] regex question
At 11:04 3/7/2005, Chip Wiegand wrote: I am writing some regex on a php form to validate input and have come up with this, for example - if (empty($first) || !eregi(^[A-Za-z]+[- ]?[A-Za-z]+$, $first)) for checking a persons name. This allows a single name, or a hyphenated double name, or a non-hyphenated double name, and it works. My question is this - why is the third set followed by a '+' optional? I thought the + meant the preceding group is present 1 or more times. The ? means the preceding group is present 0 or more times. Why is it that when I put a ? in the place of the + after the last ] if (empty($first) || !eregi(^[A-Za-z]+[- ]?[A-Za-z]?$, $first)) the regex is broken? Regards, Chip If you want to add the capability for those weird, foreign names [ ;^) ], take a look at the RegEx on this page: http://www.RegExLib.com/UserPatterns.aspx?authorId=45511 Start Here to Find It Fast! - http://www.US-Webmasters.com/best-start-page/ $8.77 Domain Names - http://domains.us-webmasters.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: password in md5 to connect to mysql instead of clear password
Gael Lams, The problem is, MD5 is non-reversible. Any encryption you use that is non reversible... obviously cannot be reversed, right? If it can't be reversed, that's what you have to send for the connection - and anyone sending that will get through just fine. Here, let me explain. If you were to store the password MD5'd, say in $password, you would have to pass that (the md5'd version) to mysql_connect(). If you can pass it to that function, anyone can... and so the encryption doesn't help anyone (except that the password is longer.) Generally, the solution would be a challenge login, but even then the client needs to know the clear text password, and so it needs to be saved somewhere. There is one solution to this: certificates, but that's still by machine. See the documentatation for more information: http://www.php.net/ref.mysql -[Unknown] Original Message Hi all I use the classic following rows to connect to a mysql database. I always put $passsword in clear in the php connection file and I wonder whether there is a way to have it in md5 so that someone reading the file could not use it to connect to the db. I googled a bit but find only threads explaining how to have password saved in md5 inside a mysql table which is not I would like to do Regards, Gaël function SQLConnect() { $server_name = 'localhost'; $db_name = 'cmsdb'; $user_name = 'user'; $password = 'clearpassword'; if (!$dbconnect = mysql_connect($server_name, $user_name, $password)) { echo Connection failed to the host 'localhost'.; exit; } if (!mysql_select_db($db_name)) { echo Cannot connect to database '.$db_name.'; exit; } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sending mail through localhost
Dear All, Do I need to install a mail server, such as ArGoSoft Mail Server, on my computer (MS XP) in order to prevent this error when sending mail through a form (ref: N: Mail functions, PHP manual): Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for [EMAIL PROTECTED] in c:\inetpub\wwwroot\..sendfeeback.php on line 22 php.ini is set to: [mail function] ; For Win32 only. SMTP = localhost ; for Win32 only ; For Win32 only. sendmail_from = [EMAIL PROTECTED] ; for Win32 only Thanks regards, Will
[PHP-DB] Newby variable error
Wizards, I am VERY new to PHP, paging through Meloni's 'PHP Essentials' I get the following error which I assume is very simple to solve, but for me. I have tried different approaches in identifying the 'price' variable with no luck: error: Notice: Undefined variable: price in c:\inetpub\wwwroot\php exercises\do_calculate.php on line 20 Notice: Undefined variable: price in c:\inetpub\wwwroot\php exercises\do_calculate.php on line 24 You ordered 1 bags of Ethopian Harrar. Bags of Ethopian Harrar are R0.00 each. Your subtotal is R0.00. Sales tax is 14% in this location. R0.00 has been added to your order. You owe R0.00 for your coffee. code: show_calculate_b.php !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML HEAD TITLEBean Counter Form/TITLE /HEAD BODY FORM method=POST action=do_calculate.php PSelect a bean type:/P SELECT name=beans size=1 OPTION value=Ethiopian HarrarEthiopian Harrar - $14.25/OPTION OPTION value=KonaKona - $16.25/OPTION OPTION value=SumatraSumatra - $13.00/OPTION /SELECT PHow many bags would you like?/P SELECT name=quantity size=1 OPTION value=11/OPTION OPTION value=22/OPTION OPTION value=33/OPTION OPTION value=44/OPTION OPTION value=55/OPTION /SELECT INPUT type=submit value=Submit /FORM /BODY /HTML do_calculate_b.php !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML HEAD TITLEBean Counter Results/TITLE /HEAD BODY ?php // set up the pricing assignments if ($_POST[beans] == Ethiopian Harrar) { $price = 14.25; } else if ($_POST[beans] == Kona) { $price = 16.25; } else if ($_POST[beans] == Sumatra) { $price = 13.00; } $sales_tax = .0825; $sub_total = $price * $_POST[quantity]; $sales_tax_amount = $sub_total * $sales_tax; $sales_tax_pct = $sales_tax * 100; $grand_total = $sub_total + $sales_tax_amount; $fmt_price = sprintf(%0.2f,$price); $fmt_sub_total = sprintf(%0.2f,$sub_total); $fmt_sales_tax_amount = sprintf(%0.2f,$sales_tax_amount); $fmt_grand_total = sprintf(%0.2f,$grand_total); echo PYou ordered $_POST[quantity] bags of $_POST[beans]./p; echo PBags of $_POST[beans] are \$$fmt_price each./p; echo PYour subtotal is \$$fmt_sub_total./p; echo PSales tax is $sales_tax_pct% in this location./p; echo P\$$fmt_sales_tax_amount has been added to your order./p; echo PYou owe \$$fmt_grand_total for your coffee./p; ? /BODY /HTML Regards and many thanks, Will
Re: [PHP-DB] SQL Insert problem
From: Vincent Jordan [EMAIL PROTECTED] $sql = INSERT INTO rmarequest (firstname, lastname, address, address2, city, state, zip, phone, email, serial, product, reason, rmanumber)VALUES ('$firstname', '$lastname', '$address', '$city', '$state', '$zip', '$phone', '$email', '$serial', '$product', '$reason', '$rmanumber') or die (mysql_error()); Uhhh. where's mysql_query()??? $sql = INSERT ...; $result = mysql_query($sql) or die(mysql_error()); ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: LAMP
From: Lester Caine [EMAIL PROTECTED] I'd really like to find a Linux distro that is a LAMP system right out of the box. (Linux, Apache, MySQL, PHP) Are there any out there? Thankfully not ;) I want LAFP but LAPP seems still to be more popular on Linux. WHY does everybody run lemming like after MySQL. It STILL has to catch up with the better FREE database engines ;) Right... I find a great need for triggers and stored procedures in my guestbooks and shoutboxes. Come on people, the right tool for the right job. MySQL is supported on more hosts and fills the needs of most web developers. This is like arguing over which editor to use! ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wait Statement... ?
..: GamCo :.. wrote: ok, i added the sleep() function in my page. what i'm basically doing is :- i have a .php page where people log-in from. from there i send the form to another .php page that actually checks the login and registers a session with the username and password as session variables. then on the page that actually does the validation, i have something that says : validating login... sleep 1 funtion. then, i have another line that says validation successfull... sleep 1 function and then i have another line that says redirecting... with sleep 1 function and then header redirects to the actual logged-in.php file. the redirect and validation works perfectly as well as the sleep functions, but it now doesn't display the validating login... blah blah blah stuff which is done in normal html code... You are very confused. Read the manual page on header(). You can't have any output before you try to redirect with a header(). If you're trying to implement some sort of brute force protection by using sleep(), you're using it in the wrong method, anyhow. Your login processing script should sleep for a second or two whether the login is correct or not and it should be the first thing that it does (i.e. before any output or redirection). If you only sleep() on failures and redirect on good logins, brute force methods can pick up on that and adjust their methods to get around the wait time. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] howto get PK id after INSERT??
Vincent Jordan wrote: I think I got it correct got the most part. I am having a problem with the urlencode function I believe. On page CustomerAddNew1.php ( page than handles form data ) im using: $last_id = mysql_query(SELECT LAST_INSERT_ID() from customerinfo); $last_id is now a Result Resource, not the value you're after. You must use mysql_result() or any of the mysql_fetch_*() functions to retrieve the value... $lastid = mysql_result($last_id,0); $last_id = urlencode ($last_id); No need to urlencode an integer. header(Location: UserMain.php?custid='$last_id'); You don't put quotes around values in the URL. and on the UserMain.php page I am using this to return the data: $cid = $last_id; You called it custid in the URL, not last_id. All you need here is $cid = $cust_id although that's a waste of code. What you really want is $cid = (int)$_GET['cust_id']; so that now you know $cid is an integer and you're not opening yourself wide open to SQL injection attacks later. ini_set('display_errors', 1); error_reporting(E_ALL ~ E_NOTICE); $connect = mysql_connect() or die (unable to connect to database . mysql_error() . ); $select = mysql_select_db() or die (unable to connect to database . mysql_error() . SPDATA); $result = mysql_query(select * from customerinfo where custid='$cid') or die The custid column is an integer, right? Why are you passing it a string by putting quotes around $cid? (mysql_error(Unable to query database)); while ($row = mysql_fetch_array($result)) { $firstname = $row['firstname']; $lastname = $row['lastname']; snip This whole process of $var = $row['var'], $var2 = $row['var2'] is a waste of resources. Why do you need to rename the variable? You already have $row['firstname'] as a variable, just use it. If you don't understand how to use an array when printing a string, then check the manual. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wait Statement... ?
Daevid Vincent wrote: Similarly, I could adjust my brute force attack to sleep() a pre-determined amount of time too ;-) Uhmmm.. how effective is a brute force attack where you can only try one combination per second? It's going to take you a while to get through that dictionary. The whole 'sleep()' idea just seems silly. I agree with Jason. Just validate and be done. A better way to stop attacks is to have a tally of failed logins if you really are that worried someone is going to brute-force you. Then after 3 fails, just don't let that IP connect or add other intelligent handling. Maybe add them to a 'ban list' after x amount of failed tries. You can get the $_SERVER['REMOTE_ADDR'] or use the session id or whatever. You can still do this on top of the sleep() method. A one second wait is n't going to affect you when you log in to an application. The problem with reacting after three failed logins is that it can then be easy to lock other people out of their account. You just have to figure out their username, which usually isn't that hard. Since IP addresses can be spoofed or shared among users of certain ISPs, relying on them isn't adequate, either. I'm not saying using sleep is the solution to security problems, but it can be one layer of your defense. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Wait Statement... ?
Tim Van Wassenhove wrote: In article [EMAIL PROTECTED], John W. Holmes wrote: Daevid Vincent wrote: Similarly, I could adjust my brute force attack to sleep() a pre-determined amount of time too ;-) Uhmmm.. how effective is a brute force attack where you can only try one combination per second? It's going to take you a while to get through that dictionary. You're mistaken here. Every kiddie knows he has to fork 50 concurrent threads that try to authenticate... That's still only 50 guesses a second compared to thousands when your server gives an immediate good or bad response. Like I said, this is just another layer you can add in addition to what you have below. It doesn't hurt anything if implemented correctly and it only serves to hassle those abusing the system. Defense in depth. :) I'd suggest to have 2 queues for failed authentication attempts. One containing (ip - timestamp) pairs, the other containing (username - timestamp) pairs. Every time someone tries to authenticate, you count the number of failures in both queues. The larger the number, the longer the sleep will take. (removing old entries once in a while might speed up things) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysqli/Statement isn't valid anymore in x.php line #
Gilmore, Corey (DPC) wrote: Is anyone familiar with what would cause an error like this: Warning: Statement isn't valid anymore in includes\import.inc.php on line 810 1. Which line is 810? That's going to really help someone determine why you may be getting this warning. 2. This is a warning, not an error. While annoying, it really can be ignored if the program actually works correctly. The warning can be hidden by using an appropriate error_reporing() level. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Case sensitive search
Rui Cunha wrote: i suggest you to use the LIKE operator instead of the relational operator. You should try your suggestions before you.. er, suggest them: mysql select 'a' like 'a'; +--+ | 'a' like 'a' | +--+ |1 | +--+ 1 row in set (0.00 sec) mysql select 'a' like 'A'; +--+ | 'a' like 'A' | +--+ |1 | +--+ 1 row in set (0.00 sec) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Not Like
Cole S. Ashcraft wrote: I am trying to figure out how to display something where the condition is not like im a MySQL query. The query is select * from class where classID like '_00'order by classID; How would I make the like into a not like (aka negating it. The ! does not work)? I couldn't find anything in the MySQL manual. SELECT * FROM class WHERE classID NOT LIKE '_00' ORDER BY classID Do I get a doh! that was obvious prize?? ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP use in Federal Govt
Galbreath, Mark A wrote: My division at State is trying to get PHP 5.0 approved for use by developers in the Department, and the Powers That Be are requesting evidence that other Federal agencies/military are using PHP, and the extent of it's use. Anybody have a clue about this? I sure would appreciate some help! I use it extensively in my unit and know of others that are using it, too. I've made several PHP based programs (see http://www.bigredspark.com/survey) that are being used by the powers that be here. If you have any military that can get me on AKO, I can give more details. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Temporary table name
Rosen wrote: I need to create temporary table in mysql. And I generate random name - i.e. TMP21567. How can I check is this name already exist in database ? If you're creating a true temporary table, then you don't need to worry about the name being unique. CREATE TEMPORARY TABLE tmp21567 ... Even if two PHP scripts run at the same time and issue this query, the temporary table is created on a per-connection basis and will not conflict with each other. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Temporary table name
Rosen wrote: Yes, I'm creating temporary table to store temporary data and after thath I delete this temporary table. What is the longest table name (in chars) fo MySQL table name ? How long does it exist for? If it's only used during the life of the script, then use TEMPORARY when you create it and you can use anything for the name. You don't have to worry about it being unique. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Temporary table name
Rosen wrote: No, I don't use it only in range of one script - it must be as normal table - several scripts to work with this table and after the last script finish - it delete the table. This may take a time about 20-30 minutes ( until user enter data ) Okay. Use uniqid() to create a string for the table name. The only way you're going to know if it's duplicate is to either catch the error when you create the table or attempt to select something from it or show columns from it... If you're using uniqid(), though, you shouldn't run into duplicates very often. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session_start
Jason Wong wrote: On Friday 16 July 2004 08:15, Steve Butzel wrote: It appears that Apache/PHP still thinks the session.save_path is /tmp, even though I changed this in php.ini-recommended and php.ini-dist. **What am I doing wrong?** Firstly, to see what your settings really are, use phpinfo(). Secondly, when you use phpinfo() you will see that the ini file you need to edit is called php.ini. Note the path and edit that file, if it's not there then copy one of php.ini-* there. and actually rename it to php.ini, please. :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Getting a result from MAX() query
[EMAIL PROTECTED] wrote: Would somebody be kind enough to explain why this query produces a false result $latest=mysql_query(SELECT MAX(fee_recd) FROM members,$connectup)or die (Query failed:br$latestbrError: . mysql_error()); Would you be kind enough to tell us what text mysql_error() shows? You probably just need to use an alias in your query: SELECT MAX(fee_recd) AS max_fee_recd FROM members and then you'll have $row['max_fee_recd'] when you fetch the value from your result set. Other wise you need to use $row['MAX(fee_recd)']... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mysql and rollbacks
Peter Westergaard wrote: I'm developing a site where I anticipate the need to make several updates to several forms, and I'll want to commit them all at once (i.e. if there's a failure with any of the transactions, I'd like to be able to back out to before I started). Is there a decent way to do this with PHP and Mysql? Use InnoDB tables which have transaction support. Or use a database abstraction layer that simulates transactions such as ADOdb: http://phplens.com/adodb/tutorial.smart.transactions.html -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Mysql and rollbacks
Peter Westergaard wrote: ... or, am I barking up the wrong tree with Mysql, and should I change database platforms? (You'll never convince me to give up PHP though. muahaha. Except for sql-level stored procedures where necessary, that is). Maybe? :) PostgreSQL and Firebird are two other open source free databases that have transaction support and stored procedures, IIRC. Check them out. If you run your own server, it's easy to get these. You may have trouble finding a hosting company consistently offering them, though. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Security Issues
Jonathan Haddad wrote: so I've been doing a little thinking about web server security.. #1. Since all files on the web are 644, what is to stop someone on the same server from copying your files to their own directory? (specifically your database connection info) #2. if a folder if 777, what's to stop someone from writing to that folder? Answer to both questions is a combination of SAFE_MODE and open_basedir restrictions among other things discussed on the manual pages for those functions / features. If those restrictions are not in place, then nothing is stopping someone on the same server to read/write in your filespace with PHP. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PHP] Grab a range of rows from a mysql result
[EMAIL PROTECTED] wrote: The resource is made up of 1000+ records from a mysql table that I am breaking up to make my PHP application run faster. I have figured out how to compute the range but I dont know how to pull out a group of rows within a range from a mysql result resource. $query = SELECT * FROM yourtable WHERE range BETWEEN 400 AND 500; -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql auto increment
Michael Gale wrote: I know this is more of a mysql question then php with mysql but I can not find the answer. I have a primary key in a table the is setup and working with auto increment. Now I want to change it so it will start auto incrementing from 1000. So each entry will be: First of all, why? There's no reason to do this. Second, this link was just posted an hour ago or so. Check it out. http://dev.mysql.com/doc/mysql/en/example-AUTO_INCREMENT.html -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Table locking
Rosen wrote: I have the following situation: I have to prevent users to write at the same time in one table in PHP script. Is there a way the PHP to understand, thath another user is filling table, and to wait before begin to fill data? Most databases have a LOCK command that you can issue. The other scripts that end up running at the same time will wait until the lock is released. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB connections ?
Michael Gale wrote: I am designing a web that will require access to a specific database. I am also using sessions and am storing the session data in the database. So on every page that loads there will be a connection to the mysql server (local) to access the session db and tables and the web app database and tables. My question is this would make two db connections per page right ? one after another ? -- which would not be optimized Would it be better to but the session tables in with the web app tables under a common database ?? At first I thought that it would be more secure if the two where separate. So long as you don't close the connection after you get your session data, the next call to mysql_connect() with the same parameters will realize there's already a connection open and use that. Why not have a single include file that connects to your database, though? Then include your custom session hanlder which selects its database and retrieves the data. Then your main script selects it's database and does what it needs to do. Still one connection with less confusion. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL variable question
Chris Payne wrote: I'm using MySQL 4's built-in Boolean handling abilities with PHP 4 which works wonderfully, but I need to change: ft_min_word_len See here: http://dev.mysql.com/doc/mysql/en/Option_files.html -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT problem between MySQL 3.23 and MySQL 4
Chris Payne wrote: I'm using Booleans in my searches (New to it) but it works perfectly on my local 3.23 version of MySQL, but on the main server which uses version 4 of MySQL I get an error so there's an error in my Syntax. Here's what I currently use: [snip] LENGTH(REPLACE(LOWER(def),LOWER('as'),''))) [snip] And here's the error I receive on the remote MySQL 4 server: Warning: Bad arguments to implode() in /var/www/html/www.planetoxygene.com/htdocs/funcs_mysql_boolean.php on line 45 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 ') - LENGTH(REPLACE(LOWER(),LOWER('as'),''))) /LENGTH('as' This is not a MySQL 3 vs. MySQL4 issue. If it was, this is the wrong list, anyhow. Take a look at the line of the query you _say_ you're running that I've included above and take a look at the last line of the error that you're getting from MySQL. See the difference? Good... now troubleshoot. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] new row object
Bob Lockie wrote: I use $row = fetch_row_object, array_push($row) and I want to manually insert a row at the end of my array to indicate if there are more rows. Is there a way to create a row object? class row { var $morerows = 'Yes'; } $more = new row; array_push($more); about all there is too it, although I'm sure there is a better way to do whatever you're doing if you explained it more. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Query for Most Recent Entry
Thompson, Jimi wrote: I'm trying to figure out how to write a MySQL query that will return the highest primary key a table. 1) Why? 2) SELECT MAX(id) FROM table 3) If you're trying to find the key of the last row inserted to an auto_increment column, use mysql_insert_id() or LAST_INSERT_ID() in PHP and MySQL, respectively. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql limit
Bob Lockie wrote: If I select rows with a limit clause I need to know if there are more rows than the limit. Either do a SELECT COUNT(*) prior to your LIMIT query to see how many total rows there are, or use SQL_CALC_FOUND_ROWS and FOUND_ROWS() (more info here: http://dev.mysql.com/doc/mysql/en/Information_functions.html) oh, and echo something about php; -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] $cookie error
Sukanto Kho wrote: I'm using $_session to store user name and status and the session is used as key to access some pages and I set the cookie variables like this : setcookie (name,$user_name, $time+3600); setcookie (status,$status, $time+3600); and the authentication of the session variable like this : if(!isset($_COOKIE['name']) or !isset($_COOKIE['status']) or $_COOKIE['status']!='user') {header(location:sign_in.php);exit;} else {$user_active=$_COOKIE['name'];$status=$_COOKIE['status'];} But the problem is that sometimes when I link to (eg : product_add.php require $_session) it success but in the other time it's fail ..(although I do it continuous ...I mean after the 1st time success and 2nd times fail)... it couldn't be the problem of $_session lifetime ... I think. I can't find why such problem occurs $_SESSION and $_COOKIE are not the same thing. You seem to have them confused or are not explaining things very well. on product_add.php print out the contents of $_COOKIE and $_SESSION using print_r() so you can track what's in them and how they are changing. Cookies are tied to a domain, too. If you set a cookie on domain.com/product.php and then link to www.domain.com/product.php the cookie will not exist (unless you use the right parameters in setcookie()). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple word queries
Shiloh Madsen wrote: say someone enters a search string of cat dog mouse rabbit (without the qoutes) into my search box. What I need for the results page to do is to construct a query that will search through my keywords table for every instance of ANY of those words. How would you suggest I handle this? For that simple example, you can just explode the string on the space and create a WHERE clause entry for each word. For example: $words = explode(' ',$_GET['search_text']); foreach($words as $word) { $query .= AND column LIKE '%$word%' ; } Gets more complicated the more you want to parse the search text and is dependant upon what database you're using. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] $cookie error
Sukanto Kho wrote: sorry, I was wrong ... all the $session in my previous post should be $cookie... (I typed the wrong word) I think the domain is not the one that cause the problem... remember that I refer to the same page (but sometimes success and the other time it's fail) What did u mean by unless you use the right parameters in setcookie() Please more detail (I want to know if I miss something in setcookie parameter).. You can set the domain in setcookie() so that www.domain.com and domain.com will have the same cookies. Note that if you use setcookie(), the cookie value isn't actually available until the next request. You should be using setcookie() before any output, also, but you'll get an error (or should) if you're not doing that right. With some browsers, setting a cookie and then redirecting with header() will not make the cookies available on the next page. Maybe that's your issue? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] perfornance with POST or db check ??
Michael Gale wrote: The question I have it .. on three of the select boxes .. if the data is changed I require a extra function to get run. So for example if the owner value is changed I want to send a e-mail to the new owner. For performance should I just pass a hidden value with the original owner and compare that with the owner value of the select box OR should I do another db select to see if the field changed ??? I was thinking that passing a string would have less of a performance impact ? then db activity. ? It would, but the solution depends upon your users. Remember that a hidden field's value can be modified. So, if a user wanted to be malicious, they could set the hidden field to the new value matching what they select and your program would think that no change took effect. Now, you could outsmart them and not actually update that column if the two values match. Then it wouldn't really do them any good to change the values because the database won't be updated anyhow. The safest way is to just select the data before you make any changes and then compare it to what was submitted. The best way to do this, though, is to store the original values in the session when you first populate the form and then compare the submitted values to the session values. This way you're not actually adding a query (so long as you're using sessions already or aren't against adding them). The user can't modify the session values, so this method is safe. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Outlook Express
Rinku, I know this is not PHP DB question, But if you answer for this then I wd be thankful to you. You shoud add OT to your subject line. The question is How to configure Outlook Express for yahoo ID ? This is not a direct answer to your question but try this application: http://yahoopops.sourceforge.net/ I used to use it (v 0.4) and it worked well... Hope this helps... -- Thank You, Clifford W. Hansen Operations Support Developer Aspivia (Pty) Ltd. +27 (0) 11 259-1150 (Switchboard) +27 (0) 11 259-1019 (Fax) +27 (0) 83 761-0240 (Mobile) [EMAIL PROTECTED] (EMail) http://chansen.aspivia.com (Web) We have seen strange things today! Luke 5:26 This message contains information intended for the perusal, and/or use (if so stated), of the stated addressee(s) only. The information is confidential and privileged. If you are not an intended recipient, do not peruse, use, disseminate, distribute, copy or in any manner rely upon the information contained in this message (directly or indirectly). The sender and/or the entity represented by the sender shall not be held accountable in the event that this prohibition is disregarded. If you receive this message in error, notify the sender immediately by e-mail, fax or telephone and return and/or destroy the original message. The views or representations contained in this message, whether express or implied, are those of the sender only, unless that sender expressly states them to be the views or representations of an entity or person, who shall be named by the sender and who the sender shall state to represent. No liability shall otherwise attach to any other entity or person. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] strange query
From: pete M [EMAIL PROTECTED] I'm running this query agains a mysql database, its a list of statuses with a joined table that shows the number of job in that status with more than 2. However I get the error Unknown column 'c' in 'where clause' select job_stats.job_stat_id, job_stat, job_stat_code, count(works.job_stat_id) as c from job_stats inner join works on job_stats.job_stat_id = works.job_stat_id where c 2 group by job_stats.job_stat_id, job_stat, job_stat_code order by job_stats.job_stat_order asc Any idead anyone please Try having c 2 instead of where c 2 ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function
From: Miguel Guirao [EMAIL PROTECTED] BTW, I have four different PHP.ini files in my system, where I can see which one is using it? I added it to all of them!! phpinfo() will product a page that shows you what php.ini file PHP is using. It's in the first block. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to reuse DB results
Aaron Wolski wrote: Is there any way I can make a call to the DB for some records. Display some info from a column or two say at the top of the page and then display the full result set in a while() loop? Look for the seek() function of whatever database you're using, i.e. mysql_data_seek() to reset the results set. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Statement
Thompson, Jimi wrote: So then I try do this ?php if ($fk_phone != NULL) { $sqlwrk = SELECT `pk_phone_reports`, SUM(`calls`) AS `total_calls`, `date`, `calls` , `fk_ph_num` FROM `phone_reports`; $sqlwrk .= WHERE `pk_phone_number` = . $fk_phone; $rswrk = mysql_query($sqlwrk); if ($rswrk $rowwrk = mysql_fetch_array($rswrk)) { echo $rowwrk[number]; } @mysql_free_result($rswrk); } ? Note that this shouldnt work since it isnt a valid SQL statement. I'm not sure why PHP doesn't return some kind of an error message. PHP does return an error message, you're just not displaying it. $rswrk = mysql_query($sqlwrk) or die(mysql_error()); $sqlwrk .= WHERE (`pk_phone_number` = . $fk_phone) AND (`date` BETWEEN '$my_startdate' AND '$my_enddate'); Which brings me to my lovely parse error Parse error: You're not concatinating your string correctly. $sqlwrk .= WHERE (`pk_phone_number` = . $fk_phone . ) AND (`date` BETWEEN ' . $my_startdate . ' AND ' . $my_enddate . '); or $sqlwrk .= WHERE (`pk_phone_number` = $fk_phone) AND (`date` BETWEEN '$my_startdate' AND '$my_enddate'); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Select news based on dates
From: T. H. Grejc [EMAIL PROTECTED] I would like to display my news like this: *10.04.2004.* - news 1 - news 2 - news 3 *14.04.2004.* - news 4 *15.04.2004.* - news 5 ... I'm thinking of some while loop but I'm not sure that it will work nor I know how to create that query. SELECT your data with the date and only display the date if it changes. $query = SELECT * FROM table ORDER BY datecolumn ASC; $result = mysql_query($query) or die(mysql_error()); $prevdate = ''; while($row = mysql_fetch_assoc($result)) { if($row['datecolumn'] != $prevdate) { echo '*' . $row['datecolumn'] . '*br /'; $prevdate = $row['datecolumn']; } echo '- ' . $row['news'] . 'br /'; } ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] upload files into MySQL database
From: PHPDiscuss - PHP Newsgroups and mailing lists [EMAIL PROTECTED] I have problem for downloading files from MySQL database. Although I store and I see the filename and the extension in the database, when I try to download it, if there are blank spaces inside the filename, like my book store.doc I cannot open it and see it. You shouldn't use spaces in file names. Use urlencode() on the filename before you create a link to it. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] no temp var for mysql_fetch_array results
From: David T-G [EMAIL PROTECTED] $r = mysql_query($q,$dbro) ; $row = mysql_fetch_array($r) ; $i = $row[0] ; $r = mysql_query($q,$dbro) ; $i = mysql_result($r,0); ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Security Issues
From: Galbreath, Mark A [EMAIL PROTECTED] Does anybody know if the security issues outlined in http://www.securereality.com.au/archives/studyinscarlet.txt are still salient or not? My boss wants a technical document outlining the security risks of using PHP in an attempt to get it approved for general use by Security. I just bought Mohammed Kabir's Secure PHP Development (Wiley 2003) but would like some background white papers before delving into it. To that end, I'm using Google, but would appreciate references to any recent documents covering the subject. Yes, they are still relevant for the most part. There have been actions taken to reduce some of them, though, like having register_globals OFF by default, the move_uploaded_file() function, etc. I would contend that these security issues are the fault of bad programming, though, not the language. Some could argue that the langauge should do more to get rid of these issues by default, though. I can't say that I'd disagree with that, but I'd still hold the programmers responsible instead of the language. Bottom line, if you've actually read that page and implement what it says, then you'll be fine. You can write completely safe programs without taking any of the protective measures outlined on the site, though. You just have to know what you're doing. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dynamic Email Address in an HTML table
PHPDiscuss - PHP Newsgroups and mailing lists wrote: How can I create the email address in the field as a hyperlink to the email address? How would you create the link normally? a href=mailto:[EMAIL PROTECTED][EMAIL PROTECTED]/a right? Now if $row['email'] is equal to [EMAIL PROTECTED] or whatever you pull from the database, how would you do it? The same way... echo a href=\mailto:{$row['email']}\{$row['email']}/a; or a href=mailto?=$row['email']??=$row['email']?/a or echo 'a href=mailto:'.$row['email'].''.$row['email'].'/a'; or ... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] another strange MYSQL problem
[EMAIL PROTECTED] wrote: First, I use this, and all is ok: SELECT * FROM modele WHERE marca='Aprilia' ORDER BY tip ASC. Then, I use this: SELECT * FROM modele WHERE marca='Cagiva' ORDER BY tip ASC and the records are not ordered ascending by the field tip. In the first case, the records were ordered. Anyone knows what is wrong? Thank you! The first query works perfectly. The second returns no results. The data type for 'tip' is text. Then you have no rows where marca is equal to 'Cagiva'... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Insterting date in an MySQL table
From: charalambos nicolaou [EMAIL PROTECTED] I want to created a MYSQL table which will get the date in the form (-MM-DD) automatically. I have created the table below but it doesn't get the form of date that I want. It has the form (MMDDHHMMSS) CREATE TABLE questions1 (ID INT NOT NULL AUTO_INCREMENT,name VARCHAR(30),day TIMESTAMP,question TEXT,email VARCHAR(30),answer TEXT, PRIMARY KEY(ID)); Is there any other date field that gets the date form as I want? TIMESTAMP and DATETIME columns are MMDDHHMMSS. DATE columns are MMDD and TIME columns are HHMMSS. Now, if you're looking for the features of a TIMESTAMP column (auto set to current date/time upon insert/update), then you have two options. You can make the column a TIMESTAMP(8) which will only store MMDD. You can also use DATE_FORMAT() when selecting your data to select the date formatted however you want or use date() and strtotime() in PHP to format the date from MMDDHHMMSS to whatever you want. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] looking for a variable
From: Robbie Staufer [EMAIL PROTECTED] $result = mysql_query (SELECT * FROM testdb WHERE Code_Name IN ('CLM', 'CAM', 'CSIM', 'cpl5', 'POP'),$connection) is there a php variable that holds the number of elements in the () after IN? I'm formatting the display in a browser window. I need the second and consecutive elements to be indented below the first one. Something like this: echo element 0 foreach additional element echo tab,element Where are CLM, CAM, etc coming from? You're not going to get it from the query, plain and simple. You're writing the query, though, so those values have to come from somewhere. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] looking for a variable
From: Robbie Staufer I supply those values. Data associated with them gets pulled out of the database and I need to format them so that the first one is displayed differently than the following ones. Oh... echo strongCLM/strong, CAM, CSIM, cpl5, POP; ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Password() PHP encryption?
Theisen, Gary wrote: I've recently upgraded my mysql to v 4.1.1 (on win nt 4.0) and set the Passwords in the user table to the mysql Password() function. Now, this doesn't work anymore when call from a php web script (which is a good thing, cause it's plain text): mysql_connect (localhost, theID, thePassord); gives me this error: Client does not support authentication protocol requested by server ... Since my mysql.mysql user table now has the 41 bit encrypted passwords stored...how to I connect with my php scripts? I've tried md5(), sha1()...but they don't generate the same 41 bit encrypted password. Anyone have a suggestion? You need to use the mysqli extension with MySQL 4.1+ -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php