[PHP-DB] oci function
Hi everybody What should I do for useing OCI functions of oracle 9i in PHP4. I think I should recompile PHP with somthing but I don't know with what and how should I do this. I installed oracle 9i on SUSE linux 8.0. Best Regards Maizar -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] sort by date
There is a difference between a general, "how do I do this" question and a specific "here's my code, I can't find the bug" question. Sometimes people just need a quick answer specific to their code. Also, unfortunately, many times when people want to point to a resource they give the standard "RTFM". Believe it or not, many newbies don't always know how to do this!! A polite "it's too long to go into on the list, but you can read more about this here" with a link is much more helpful. -Lisi At 04:22 PM 11/6/02 +0100, Snijders, Mark wrote: why does everybody always gives the answers?? why not a hint, or where to search that they can learn something about it??? -Original Message- From: Marco Tabini [mailto:marcot@;inicode.com] Sent: woensdag 6 november 2002 16:08 To: Terry Romine Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] sort by date Ok, going out on a limb here... have you tried something like select e.id, title, location, address, contact, category, event_time, urllink, descript, min(event_date) from eventTable e inner join dateTable d on e.id = d.id group by e.id ? Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.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] Select Fields
Thank you putting '%case%' instead of case worked! - Original Message - From: "David Smith" <[EMAIL PROTECTED]> To: "Tyler Whitesides" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 10:47 PM Subject: Re: [PHP-DB] Select Fields > Tyler, > > You probably need one or two of the following: > > 1. Put single-quotes around case in your SQL (where type like 'case') > 2. Use wild-cards in your where statement (where type like '%case%') > > Good luck! > > --Dave > > On Wed, 2002-11-06 at 23:31, Tyler Whitesides wrote: > > Hi, > > Sorry if this is ametuer, but I have been staring at this code for so long, trying to find out why my selection fields are gathering values, and I cant find the problem. > > Thanks, > > Tyler > > -- > > > include './include/vars.php'; > > include './include/dbconnect.php'; > > ?> > > > > > > > > > > function totalCost() > > { > > var form = document.system; > > var casing = form.casing.value; > > var processor = form.processor.value; > > var ram = form.ram.value; > > var hdd = form.hdd.value; > > var video = form.video.value; > > var sound = form.sound.value; > > var nic = form.nic.value; > > var monitor = form.monitor.value; > > var speakers = form.speakers.value; > > var interfaces = form.interfaces.value; > > var total = casing + processor + ram + hdd + video + sound + nic + monitor + speakers + interfaces; > > form.price.value = total; > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Services > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Build Your Custom System > > > > > > > > Case: > > > > > while($item = mysql_fetch_array($parts)) > > { > > echo "$item[part]"; > > } > > ?> > > > > > > > > Total Cost Of Parts: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > 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] Select Fields
Tyler, You probably need one or two of the following: 1. Put single-quotes around case in your SQL (where type like 'case') 2. Use wild-cards in your where statement (where type like '%case%') Good luck! --Dave On Wed, 2002-11-06 at 23:31, Tyler Whitesides wrote: > Hi, > Sorry if this is ametuer, but I have been staring at this code for so long, trying >to find out why my selection fields are gathering values, and I cant find the problem. > Thanks, > Tyler > -- > include './include/vars.php'; > include './include/dbconnect.php'; > ?> > > > > > function totalCost() > { > var form = document.system; > var casing = form.casing.value; > var processor = form.processor.value; > var ram = form.ram.value; > var hdd = form.hdd.value; > var video = form.video.value; > var sound = form.sound.value; > var nic = form.nic.value; > var monitor = form.monitor.value; > var speakers = form.speakers.value; > var interfaces = form.interfaces.value; > var total = casing + processor + ram + hdd + video + sound + nic + monitor + >speakers + interfaces; > form.price.value = total; > } > > > > > > > > height="15"> > height="1"> > height="15"> > > > height="1"> > > > > > src="images/clear.gif" width="10" height="1"> > > > > > > > > Services > > > > > > > > > > > > > > > Build Your Custom System > > > > Case: > > while($item = mysql_fetch_array($parts)) > { > echo "$item[part]"; > } > ?> > > > > Total Cost Of Parts: size="6"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > src="images/corner_bl.gif" width="15" height="15"> > > src="images/corner_br.gif" width="15" height="15"> > > > > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Select Fields
Hi, Sorry if this is ametuer, but I have been staring at this code for so long, trying to find out why my selection fields are gathering values, and I cant find the problem. Thanks, Tyler -- function totalCost() { var form = document.system; var casing = form.casing.value; var processor = form.processor.value; var ram = form.ram.value; var hdd = form.hdd.value; var video = form.video.value; var sound = form.sound.value; var nic = form.nic.value; var monitor = form.monitor.value; var speakers = form.speakers.value; var interfaces = form.interfaces.value; var total = casing + processor + ram + hdd + video + sound + nic + monitor + speakers + interfaces; form.price.value = total; } Services Build Your Custom System Case: $item[part]"; } ?> Total Cost Of Parts:
Re: [PHP-DB] Archiving A Database
Do you need to archive it forever? Do you need live access to it? If you just need to archive it, read the man page for mysqldump. You can dump specific rows to a file, rename that file dump.2002.05.24, compress it with gzip, and voila, you have all of your data readily available, easily reinserted into your existing live DB. After the dump is complete, just delete those rows out of the DB. Now you have to be sure that the file contains 100% of the data and is accurate. You'll have to figure out how to do that yourself! One way I did it with WWW log files was to make a tmp copy, run a program on it, see if the output had the same number of lines in it, and if it did, delete the tmp copy and replace the original copy with the new copy (IP->DNS translation). In this case you could write a script that parses the newly created dump file in the standard format and, heck, using perl or PHP parse the thing for ),( and see how many you get. If the mysql select gets X rows, and the "),(" or ");" occurs X-1 times, then you know you got all the rows. (OK, it will be more complex than this, but you get the idea.) One record per file could get ugly real quick, both on the filesystem side and the maintenance side. Doing it by day will allow you to repopulate an entire day back into the DB as needed for billing questions or what not. MySQL will keep the unique ID (assuming it is a number auto_incremented) unique and only use ever higher IDs, not use old ones that no longer exist in the DB at the moment. Once you are done with that Day (or days) of data, you just delete it from the DB, knowing you have a copy of that day on file. I would also advise you to have 2-4 copies of all your backups on both physically different computers as well as physically different locations. I kept a copy of my live DB, backed up every 6 hours, at the data center on other computer, on my computer file server at home, and another one 7 states over. Sure, it's a bit of a pain in the ass, but if the data center goes up in smoke and my file server is hacked on the same day, I still have a copy 7 states over. I just used scp (secure-shell copy) and/or rsync + ssh to keep copies current and up to date on remote machines. Peter On Tue, 29 Oct 2002, Josh Johnson wrote: > Does anyone know of speedy methods of periodically archiving and > retrieving a database table? I've got a table I'm using to log > statistical data, and it's getting 10k+ entries per day. Entries are > only logged in the database if the user is authenticated for access, and > only once per access session (the user is authenticated, a cookie is > set, and the entry is logged. From that point the user is authenticated > by verifying the cookie, which expires when the user's browser closes) > > The data is critical (used for billing and such), but the log viewing > script I've written runs slower and slower with each passing day, and at > one point the entire table was corrupted due to neglect on our system > admin's part (I warned them about the default setting of > mysql_max_connections being too low for a site that relied on the DB so > heavily and had so much traffic.). The script is a simple front end to > several MySQL queries, that retrieve totals for the past hour, day, > week, month and grand totals for all clients or a given client. The rest > of the site has been unaffected by the log issues. > > My current approach is to log the data as XML, one record per file, and > create a log file that is an index of refrences to each record. I then > empty previous data n the database. This works, but is very hard/slow to > retrieve specific groups of information, and dumping the database takes > a long time as well, which adds the difficulty of ensuring no records > are lost. I also haven't yet tackled the issue of combining data from > the XML seamlessly with live data from the database. > > I'm opening the floor to other potential solutions, or war stories from > anyone else who's been in this situation before. If there's another > approach aside from writing individual flat files, please let me know. I > haven't tested it yet, but I think maybe logging all entries/data for a > given log period into one file would speed things up, but I worry about > the 40 megabyte files that could be potentially created. I'm also open > to complete alternatives, since the main use for this data is to > generate total accesses per a given factor (client, ip, referrer, etc). > > Any help is greatly appreciated. I can give any information needed, just > ask! > > Thanks, > -- Josh > > P.S. I did suggest that this issue be tackled when I first installed the > system that creates the log, but management didn't think it was worth > bothering with at the time. > > P.P.S. I did look through the archives before I posted, and didn't find > anything. Please flame in private if I missed something! > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://
RE: [PHP-DB] Warning - newby question -- $_GET
Make sure DNS is working and mysql.db.*.net.au resolves. Better yet, use the IP address unless absolutely necessary to use the hostname. Peter On Thu, 7 Nov 2002, Gavin Amm wrote: > Hi, > > For some reason the page worked the 1st few times, now I get the error > message (after making no changes to the code from when it worked...): > (line 5 references the "$db = mysql_co..." line of code) > > Warning: Unknown MySQL Server Host 'mysql.db.*.net.au' (2) in > /home/.../public_html/public/index2.php on line 5 > > I've got the following code at the start of my script: > (i've replaced "username" and "**" with the appropriate username & > password...) > > $db = mysql_connect("mysql.db.*.net.au", "username", "**"); > mysql_select_db("kandtsg",$db); > ... > > > cheers, > Gav > > > This e-mail and any attachments are intended solely for the named addressee, > are confidential and may contain legally privileged information. > > The copying or distribution of them or of any information they contain, by > anyone other than the addressee, is prohibited. If you received this e-mail > in error, please notify us immediately by return e-mail or telephone +61 2 > 9413 2944 and destroy the original message. Thank you. > > As Email is subject to viruses we advise that all Emails and any attachments > should be scanned by an up to-date Anti Virus programme automatically by > your system. It is the responsibility of the recipient to ensure that all > Emails and any attachments are cleared of Viruses before opening. KSG can > not accept any responsibility for viruses that maybe contained here in. > Please advise KSG by return Email if you believe any Email sent by our > system may contain a virus. It should be noted that most Anti Virus > programmes can not scan encrypted file attachments (example - documents > saved with a password). Thus extra care should be taken when opening these > files. > > Liability limited by the Accountants Scheme, approved under the Professional > Standards Act 1994 (NSW). > > > > Level 4 > 54 Neridah StreetPO Box 1290 > CHATSWOOD NSW 2067 CHATSWOOD NSW 2057 > > > Ph: +61 2 9413 2944 Fax: +61 2 9413 9901 > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] FW: php J2EE .NET
Well, I know from experience this: PHP 3 and 4.various, sessions enabled on every page (using DB to store) MySQL 3.23.various Apache 1.2.various 300,000 users in the DB 2600 dynamic pages No images or static multimedia content (on this server) PC, Dual 800Mhz 1GB Ram 4 18GB drives, 7200RPM, raided 0/1 (Mirrored) FreeBSD 4.various ~150 queries per second on mysql 1,233,771 page views in 24 hours, all served without issue. Each page ~100K Averaged 424,192 page views per day. That's just my experience. It was adcritic.com at its peak. Peter On Thu, 7 Nov 2002, Peter Lovatt wrote: > Hi > > There is an article on sitepoint.com about benchmarking J2EE and .NET and > some controversy over the result > http://www.sitepoint.com/newsletters/viewissue.php?fid=3&id=3&issue=52 > > Does anybody have experience of php/MySql in comparison with either of the > above in terms of efficiency or ultimate performance? > > Is anybody interested in putting a php/MySql setup through the same > benchmarks? > > Mostly for fun, but might be useful for the 'but Open Source is not up to > Enterprise Applications' augment. > > Peter > > Mysql query blah.. > --- > Excellence in internet and open source software > --- > Sunmaia > Birmingham > UK > www.sunmaia.net > tel. 0121-242-1473 > International +44-121-242-1473 > --- > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Warning - newby question -- $_GET
Hi, For some reason the page worked the 1st few times, now I get the error message (after making no changes to the code from when it worked...): (line 5 references the "$db = mysql_co..." line of code) Warning: Unknown MySQL Server Host 'mysql.db.*.net.au' (2) in /home/.../public_html/public/index2.php on line 5 I've got the following code at the start of my script: (i've replaced "username" and "**" with the appropriate username & password...) http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Warning - newby question -- $_GET
Well, first of all, you have to connect to the database. And, its not always nesecary to have to type in $_GET['id'] to declare a GET variable. Some server software requires it, I think IIS is the only one, its what I use. And its not required for you to use the 2nd prefex for mysql_query() Just as long as you connected to the DB at the beginning of the script, all you need is mysql_query($sql). That should clear up the error. As for you want to with the $result array, ask if needing help.
RE: [PHP-DB] Warning - newby question -- $_GET
i wrote a really basic script sucessfully to echo the url variable to the screen... will go from there. thanks beau. EXCELLENT :) The single quotes around the $id variable in the select statement worked wonderfully. thanks John. Gav -Original Message- From: John W. Holmes [mailto:holmes072000@;charter.net] Sent: Thursday, 7 November 2002 1:20 PM To: 'Gavin Amm'; 'Php-Db (E-mail)' Subject: RE: [PHP-DB] Warning - newby question -- $_GET > I'm trying to call a script with the "?=" after the php script name in the > URL, but can't seem to pick up the variable to use in my script... > any help would be greatly appreciated :) > > I'm calling the script with this url: > http://localhost/Data/test/dbconnect2c.php?id=TestPage > > The section of the script i'm using is: > $id = $_GET['id']; > $sql="SELECT * FROM content where title=$id"; > $result=mysql_query($sql,$db); Well, for your example, $id is going to equal "TestPage", so you are making an invalid query: where title=TestPage. If you echo mysql_error(), it'll probably say something about unknown column TestPage. At the very least, use quotes: where title='$id' > Error message returned: > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL > result > resource in... This means your query failed. Echo mysql_error() to determine why. Get used to using mysql_error for good debugging. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This e-mail and any attachments are intended solely for the named addressee, are confidential and may contain legally privileged information. The copying or distribution of them or of any information they contain, by anyone other than the addressee, is prohibited. If you received this e-mail in error, please notify us immediately by return e-mail or telephone +61 2 9413 2944 and destroy the original message. Thank you. As Email is subject to viruses we advise that all Emails and any attachments should be scanned by an up to-date Anti Virus programme automatically by your system. It is the responsibility of the recipient to ensure that all Emails and any attachments are cleared of Viruses before opening. KSG can not accept any responsibility for viruses that maybe contained here in. Please advise KSG by return Email if you believe any Email sent by our system may contain a virus. It should be noted that most Anti Virus programmes can not scan encrypted file attachments (example - documents saved with a password). Thus extra care should be taken when opening these files. Liability limited by the Accountants Scheme, approved under the Professional Standards Act 1994 (NSW). Level 4 54 Neridah StreetPO Box 1290 CHATSWOOD NSW 2067 CHATSWOOD NSW 2057 Ph: +61 2 9413 2944 Fax: +61 2 9413 9901 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Warning - newby question -- $_GET
> I'm trying to call a script with the "?=" after the php script name in the > URL, but can't seem to pick up the variable to use in my script... > any help would be greatly appreciated :) > > I'm calling the script with this url: > http://localhost/Data/test/dbconnect2c.php?id=TestPage > > The section of the script i'm using is: > $id = $_GET['id']; > $sql="SELECT * FROM content where title=$id"; > $result=mysql_query($sql,$db); Well, for your example, $id is going to equal "TestPage", so you are making an invalid query: where title=TestPage. If you echo mysql_error(), it'll probably say something about unknown column TestPage. At the very least, use quotes: where title='$id' > Error message returned: > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL > result > resource in... This means your query failed. Echo mysql_error() to determine why. Get used to using mysql_error for good debugging. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Warning - newby question -- $_GET
did you try echoing the value of $id after you have assigned it? you may find it's because you aren't connected to your database or something and also, i am assuming that you are using a recent install/verison of PHP, because $_GET wasn't available until the last few releases. beau // -Original Message- // From: Gavin Amm [mailto:gavin@;ksg.com.au] // Sent: Thursday, 7 November 2002 9:55 AM // To: Php-Db (E-mail) // Subject: [PHP-DB] Warning - newby question -- $_GET // // // Hi, // // I'm trying to call a script with the "?=" after the php // script name in the // URL, but can't seem to pick up the variable to use in my script... // any help would be greatly appreciated :) // // I'm calling the script with this url: // http://localhost/Data/test/dbconnect2c.php?id=TestPage // // The section of the script i'm using is: // $id = $_GET['id']; // $sql="SELECT * FROM content where title=$id"; // $result=mysql_query($sql,$db); // // Error message returned: // Warning: mysql_fetch_array(): supplied argument is not a // valid MySQL result // resource in... // // // Thanks, // Gav // // // This e-mail and any attachments are intended solely for the // named addressee, // are confidential and may contain legally privileged information. // // The copying or distribution of them or of any information // they contain, by // anyone other than the addressee, is prohibited. If you // received this e-mail // in error, please notify us immediately by return e-mail or // telephone +61 2 // 9413 2944 and destroy the original message. Thank you. // // As Email is subject to viruses we advise that all Emails and // any attachments // should be scanned by an up to-date Anti Virus programme // automatically by // your system. It is the responsibility of the recipient to // ensure that all // Emails and any attachments are cleared of Viruses before // opening. KSG can // not accept any responsibility for viruses that maybe // contained here in. // Please advise KSG by return Email if you believe any Email // sent by our // system may contain a virus. It should be noted that most Anti Virus // programmes can not scan encrypted file attachments (example // - documents // saved with a password). Thus extra care should be taken when // opening these // files. // // Liability limited by the Accountants Scheme, approved under // the Professional // Standards Act 1994 (NSW). // // // // Level 4 // 54 Neridah StreetPO Box 1290 // CHATSWOOD NSW 2067 CHATSWOOD NSW 2057 // // // Ph: +61 2 9413 2944 Fax: +61 2 9413 9901 // // -- // 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] Warning - newby question -- $_GET
Hi, I'm trying to call a script with the "?=" after the php script name in the URL, but can't seem to pick up the variable to use in my script... any help would be greatly appreciated :) I'm calling the script with this url: http://localhost/Data/test/dbconnect2c.php?id=TestPage The section of the script i'm using is: $id = $_GET['id']; $sql="SELECT * FROM content where title=$id"; $result=mysql_query($sql,$db); Error message returned: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... Thanks, Gav This e-mail and any attachments are intended solely for the named addressee, are confidential and may contain legally privileged information. The copying or distribution of them or of any information they contain, by anyone other than the addressee, is prohibited. If you received this e-mail in error, please notify us immediately by return e-mail or telephone +61 2 9413 2944 and destroy the original message. Thank you. As Email is subject to viruses we advise that all Emails and any attachments should be scanned by an up to-date Anti Virus programme automatically by your system. It is the responsibility of the recipient to ensure that all Emails and any attachments are cleared of Viruses before opening. KSG can not accept any responsibility for viruses that maybe contained here in. Please advise KSG by return Email if you believe any Email sent by our system may contain a virus. It should be noted that most Anti Virus programmes can not scan encrypted file attachments (example - documents saved with a password). Thus extra care should be taken when opening these files. Liability limited by the Accountants Scheme, approved under the Professional Standards Act 1994 (NSW). Level 4 54 Neridah StreetPO Box 1290 CHATSWOOD NSW 2067 CHATSWOOD NSW 2057 Ph: +61 2 9413 2944 Fax: +61 2 9413 9901 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] FW: php J2EE .NET
Hi There is an article on sitepoint.com about benchmarking J2EE and .NET and some controversy over the result http://www.sitepoint.com/newsletters/viewissue.php?fid=3&id=3&issue=52 Does anybody have experience of php/MySql in comparison with either of the above in terms of efficiency or ultimate performance? Is anybody interested in putting a php/MySql setup through the same benchmarks? Mostly for fun, but might be useful for the 'but Open Source is not up to Enterprise Applications' augment. Peter Mysql query blah.. --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel. 0121-242-1473 International +44-121-242-1473 --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL password protection?
One thing I do with Postgres that I'm not sure MySQL supports is Kerberos5 authentication. This way, a user logs in (and they have a user account on the DB) and I use their remote user name and their Kerberos ticket to authenticate them to the DB. That works without having to store a password anywhere on the filesystem. --Dave William Trappeniers wrote: Hi all I was wondering if it is possible to protect my password to the MySQL-server from being in a PHP-script. Now I can't do that, so everybody who gets to see my php-sourcecode also can see my (not protected/not encrypted) password. How can I change this? Thanks, William --- William Trappeniers mail at: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forum test
Seabird wrote: I'll look into it, thanx, can you access the jump-menu?? Forum should be all the way in the bottom. The jump menu doesn't work. I think you nad a 'name' field for each Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching "Mignon Hunter" <[EMAIL PROTECTED]> wrote in message news:1036610707.1915.12.camel@;joboo.tic.toshiba.com... I'm using Mozilla. I dont see the word 'forum' I guess your onChange="loadIframeJumpMenu doesnt work ? Or the type of javascript your using isnt supported by Mozilla. BTW the nedstat failed to connect on first try. On Wed, 2002-11-06 at 12:25, Seabird wrote: Hi everyone, I just uploaded my forum and would like to have it field tested by everyone. It'll prob still have some bugs in there. http://seabird.jmtech.ca go to website and then click on forum. please ignore the login in the left top for now, Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- From Mozilla and GNU/Linux -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL password protection?
Also, you can limit access to a specific table in a specific database for a specific user, if it makes sense in your application. -- Josh -Original Message- From: Peter Beckman [mailto:beckman@;purplecow.com] Sent: Wednesday, November 06, 2002 6:41 PM To: William Trappeniers Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL password protection? Create a user "nobody" with no password and give that user select, update, delete and insert capabilities in your DB and can only connect from localhost (or a certain host). This way they have to be on localhost in order to gain access to your tables, and only then be able to do what your nobody user can do. Then you need to make sure nobody can gain access to localhost without express permission (i.e. plug all security holes). Why are you showing people your source-code that has your password in it? Peter On Wed, 6 Nov 2002, William Trappeniers wrote: > Hi all > > I was wondering if it is possible to protect my password to the MySQL-server > from being in a PHP-script. Now I can't do that, so everybody who gets to > see my php-sourcecode also can see my (not protected/not encrypted) > password. > How can I change this? > > Thanks, > > William > > --- > William Trappeniers > mail at: [EMAIL PROTECTED] > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.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] MySQL password protection?
The standard apache install filters anything named .ht*. on the web tree. -- Josh -Original Message- From: Peter Beckman [mailto:beckman@;purplecow.com] Sent: Wednesday, November 06, 2002 6:44 PM To: Steve Cayford Cc: [EMAIL PROTECTED]; William Trappeniers Subject: Re: [PHP-DB] MySQL password protection? And make sure you make sure the webserver will not SERVE that file!!! You see the source, see that you are fopening the file, I'll find it on your system and get it from the web server and I have your password! Make sure the file is NOT in the document root that the web server serves from. You could also just use the file ".htpasswd", usually by default web servers will NOT serve any file named that. However, much safer to put it somewhere that the web server cannot see (but your PHP script can). Also, this is just as insecure as the other way to any person with a login on the box your PHP script is in. Usually the script is owned by nobody:nobody or read-write all, in which case all local users can get your password. The nobody method at least keeps no password. Peter On Wed, 6 Nov 2002, Steve Cayford wrote: > You could put it anywhere. Stick it in a text file somewhere, fopen() > and read the file for the password. Or keep it in a php script outside > of the web root if that's the issue, then just include() it when you > need to. > > Of course any file you put it in will have to be readable by whatever > user the webserver is running as. > > -Steve > > On Wednesday, November 6, 2002, at 04:16 PM, 1LT John W. Holmes wrote: > > >> I was wondering if it is possible to protect my password to the > > MySQL-server > >> from being in a PHP-script. Now I can't do that, so everybody who > >> gets to > >> see my php-sourcecode also can see my (not protected/not encrypted) > >> password. > >> How can I change this? > > > > You can't, unless you want to put it in php.ini or a my.conf file... > > > > ---John Holmes... > > > > > > -- > > 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 > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.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] Record IDs: Numeric or String??
Always use ints. Also, make sure you actually need an INT before using it: Max Value Unsigned Integer: 4.3 billion or so Unsigned MediumInt: 16.7 million unsigned SmallInt: 65,535 unsigned TinyInt: 255 If you'll only ever have 300,000 rows in a table, use a mediumint. Saves space and sorting time. I use mediumint on almost all tables for primary keys and foreign keys. Peter On Wed, 6 Nov 2002, Monty wrote: > Is it more efficient to store record IDs in a MySQL database as an Integer > or a String? I like string IDs better because you can create meaningful > names, but, not sure if this means the DB has to work harder or not. > > Thanks! > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL password protection?
And make sure you make sure the webserver will not SERVE that file!!! You see the source, see that you are fopening the file, I'll find it on your system and get it from the web server and I have your password! Make sure the file is NOT in the document root that the web server serves from. You could also just use the file ".htpasswd", usually by default web servers will NOT serve any file named that. However, much safer to put it somewhere that the web server cannot see (but your PHP script can). Also, this is just as insecure as the other way to any person with a login on the box your PHP script is in. Usually the script is owned by nobody:nobody or read-write all, in which case all local users can get your password. The nobody method at least keeps no password. Peter On Wed, 6 Nov 2002, Steve Cayford wrote: > You could put it anywhere. Stick it in a text file somewhere, fopen() > and read the file for the password. Or keep it in a php script outside > of the web root if that's the issue, then just include() it when you > need to. > > Of course any file you put it in will have to be readable by whatever > user the webserver is running as. > > -Steve > > On Wednesday, November 6, 2002, at 04:16 PM, 1LT John W. Holmes wrote: > > >> I was wondering if it is possible to protect my password to the > > MySQL-server > >> from being in a PHP-script. Now I can't do that, so everybody who > >> gets to > >> see my php-sourcecode also can see my (not protected/not encrypted) > >> password. > >> How can I change this? > > > > You can't, unless you want to put it in php.ini or a my.conf file... > > > > ---John Holmes... > > > > > > -- > > 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 > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL password protection?
Create a user "nobody" with no password and give that user select, update, delete and insert capabilities in your DB and can only connect from localhost (or a certain host). This way they have to be on localhost in order to gain access to your tables, and only then be able to do what your nobody user can do. Then you need to make sure nobody can gain access to localhost without express permission (i.e. plug all security holes). Why are you showing people your source-code that has your password in it? Peter On Wed, 6 Nov 2002, William Trappeniers wrote: > Hi all > > I was wondering if it is possible to protect my password to the MySQL-server > from being in a PHP-script. Now I can't do that, so everybody who gets to > see my php-sourcecode also can see my (not protected/not encrypted) > password. > How can I change this? > > Thanks, > > William > > --- > William Trappeniers > mail at: [EMAIL PROTECTED] > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Record IDs: Numeric or String??
Numeric IDs are probably a bit faster--although if properly indexed not by much--plus you can use self-numbering columns with them. Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! --- Begin Message --- Is it more efficient to store record IDs in a MySQL database as an Integer or a String? I like string IDs better because you can create meaningful names, but, not sure if this means the DB has to work harder or not. Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Record IDs: Numeric or String??
Is it more efficient to store record IDs in a MySQL database as an Integer or a String? I like string IDs better because you can create meaningful names, but, not sure if this means the DB has to work harder or not. Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL password protection?
Make sure that the encoder you use actually makes string unreadable. Otherwise, you can use a simple trick, like for example XORing the whole string with FF or something similar. -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! --- Begin Message --- actually you can make a .php file with your connection info, include it in your .php files at the top and encrypt that one file (they don't need to see it anyway). use a php encoder for the file with your login info in it. -Original Message- From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] Sent: Wednesday, November 06, 2002 4:16 PM To: William Trappeniers; [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL password protection? > I was wondering if it is possible to protect my password to the MySQL-server > from being in a PHP-script. Now I can't do that, so everybody who gets to > see my php-sourcecode also can see my (not protected/not encrypted) > password. > How can I change this? You can't, unless you want to put it in php.ini or a my.conf file... ---John Holmes... -- 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 --- End Message --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL password protection?
Are you sure you can include an encoded file into a non-encoded one? I had forgotten about this option, but if you can find a worthwhile compiler/encoder/etc, then that's a solution. ---John Holmes... - Original Message - From: "SELPH,JASON (HP-Richardson,ex1)" <[EMAIL PROTECTED]> To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>; "William Trappeniers" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 5:30 PM Subject: RE: [PHP-DB] MySQL password protection? > actually you can make a .php file with your connection info, include it in > your .php files at the top and encrypt that one file (they don't need to see > it anyway). use a php encoder for the file with your login info in it. > > -Original Message- > From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] > Sent: Wednesday, November 06, 2002 4:16 PM > To: William Trappeniers; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] MySQL password protection? > > > > I was wondering if it is possible to protect my password to the > MySQL-server > > from being in a PHP-script. Now I can't do that, so everybody who gets to > > see my php-sourcecode also can see my (not protected/not encrypted) > > password. > > How can I change this? > > You can't, unless you want to put it in php.ini or a my.conf file... > > ---John Holmes... > > > -- > 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] MySQL password protection?
You could put it anywhere. Stick it in a text file somewhere, fopen() and read the file for the password. Or keep it in a php script outside of the web root if that's the issue, then just include() it when you need to. Of course any file you put it in will have to be readable by whatever user the webserver is running as. -Steve On Wednesday, November 6, 2002, at 04:16 PM, 1LT John W. Holmes wrote: I was wondering if it is possible to protect my password to the MySQL-server from being in a PHP-script. Now I can't do that, so everybody who gets to see my php-sourcecode also can see my (not protected/not encrypted) password. How can I change this? You can't, unless you want to put it in php.ini or a my.conf file... ---John Holmes... -- 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] MySQL password protection?
actually you can make a .php file with your connection info, include it in your .php files at the top and encrypt that one file (they don't need to see it anyway). use a php encoder for the file with your login info in it. -Original Message- From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] Sent: Wednesday, November 06, 2002 4:16 PM To: William Trappeniers; [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL password protection? > I was wondering if it is possible to protect my password to the MySQL-server > from being in a PHP-script. Now I can't do that, so everybody who gets to > see my php-sourcecode also can see my (not protected/not encrypted) > password. > How can I change this? You can't, unless you want to put it in php.ini or a my.conf file... ---John Holmes... -- 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] MySQL password protection?
> I was wondering if it is possible to protect my password to the MySQL-server > from being in a PHP-script. Now I can't do that, so everybody who gets to > see my php-sourcecode also can see my (not protected/not encrypted) > password. > How can I change this? You can't, unless you want to put it in php.ini or a my.conf file... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL password protection?
Hi all I was wondering if it is possible to protect my password to the MySQL-server from being in a PHP-script. Now I can't do that, so everybody who gets to see my php-sourcecode also can see my (not protected/not encrypted) password. How can I change this? Thanks, William --- William Trappeniers mail at: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] forum test
I'll look into it, thanx, can you access the jump-menu?? Forum should be all the way in the bottom. Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching "Mignon Hunter" <[EMAIL PROTECTED]> wrote in message news:1036610707.1915.12.camel@;joboo.tic.toshiba.com... > I'm using Mozilla. I dont see the word 'forum' > > I guess your onChange="loadIframeJumpMenu doesnt work ? Or the type of > javascript your using isnt supported by Mozilla. > > BTW the nedstat failed to connect on first try. > > > > On Wed, 2002-11-06 at 12:25, Seabird wrote: > > Hi everyone, I just uploaded my forum and would like to have it field tested > > by everyone. It'll prob still have some bugs in there. > > http://seabird.jmtech.ca > > go to website and then click on forum. please ignore the login in the left > > top for now, > > > > Jacco > > > > > > -- > > http://seabird.jmtech.ca > > > > Attitude is Everything! > > But Remember, Attitudes are Contagious! > > Is Yours worth Catching > > > > > > > > -- > > 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] Imploding an array?
Well, your code will do this: if delete[7] == 1, you will print_r($order_index[7]) which contains ??? Now from what you say $order_index[7] == "2627"; That's just weird. Whatever it is you are doing is bad. Regardless, you could do this: $foo = preg_split("//",$order_index[7]); Now $foo is an array of [0]=>2, [1]=>6, [2]=>2, [3]=>7; Now you do a while loop: for ($x=0;$x<=count($foo);$x++) { if (is_odd($x)) { $next = 1; } else { $next = 0; } $str .= $foo[$x]; if ($next) $str .= ","; $x++; } Or something like that. is_odd may not be a function, but YOU figure out how to determine if a number is odd. Peter On Wed, 6 Nov 2002, Aaron Wolski wrote: > Ok... > > This is the code I have setup: > > for ($i=0;$i > if ($delete[$i] == 1) { > > print_r($order_index[$i]); > > > $str = implode(",",$order_index[$i]); > echo $str; > > } > > } > > Now..upon the print_r.. The values that ARE there look like 2627 > (which is order_index 26 and 27). > > Basically I am trying to get the 2627 into a string that looks like: > $str = "26,27"; so I can use it in something else. > > *shrugs* > > I think I wma way off base here *eyes blurry* heeh > > Aaron > > > -Original Message- > > From: Rasmus Lerdorf [mailto:rasmus@;php.net] > > Sent: Wednesday, November 06, 2002 2:16 PM > > To: Aaron Wolski > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] Imploding an array? > > > > > > You sure you want [$i] on that? Is it a 2-dimensional array? > > > > On Wed, 6 Nov 2002, Aaron Wolski wrote: > > > > > Hey all, > > > > > > Can't seem to figure out why this won't work: > > > > > > $test = implode(",", $order_index[$i]); > > > > > > When I print_r() the variable I have values so I know that works. > > > > > > Any thoughts on this? > > > > > > Thanks. > > > > > > Aaron > > > > > > > > > -- > > 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 > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Imploding an array?
Ok... This is the code I have setup: for ($i=0;$i -Original Message- > From: Rasmus Lerdorf [mailto:rasmus@;php.net] > Sent: Wednesday, November 06, 2002 2:16 PM > To: Aaron Wolski > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Imploding an array? > > > You sure you want [$i] on that? Is it a 2-dimensional array? > > On Wed, 6 Nov 2002, Aaron Wolski wrote: > > > Hey all, > > > > Can't seem to figure out why this won't work: > > > > $test = implode(",", $order_index[$i]); > > > > When I print_r() the variable I have values so I know that works. > > > > Any thoughts on this? > > > > Thanks. > > > > Aaron > > > > > -- > 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] forum test
I'm using Mozilla. I dont see the word 'forum' I guess your onChange="loadIframeJumpMenu doesnt work ? Or the type of javascript your using isnt supported by Mozilla. BTW the nedstat failed to connect on first try. On Wed, 2002-11-06 at 12:25, Seabird wrote: > Hi everyone, I just uploaded my forum and would like to have it field tested > by everyone. It'll prob still have some bugs in there. > http://seabird.jmtech.ca > go to website and then click on forum. please ignore the login in the left > top for now, > > Jacco > > > -- > http://seabird.jmtech.ca > > Attitude is Everything! > But Remember, Attitudes are Contagious! > Is Yours worth Catching > > > > -- > 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] Imploding an array?
Does $i have a value? -- Josh -Original Message- From: Rasmus Lerdorf [mailto:rasmus@;php.net] Sent: Wednesday, November 06, 2002 2:16 PM To: Aaron Wolski Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Imploding an array? You sure you want [$i] on that? Is it a 2-dimensional array? On Wed, 6 Nov 2002, Aaron Wolski wrote: > Hey all, > > Can't seem to figure out why this won't work: > > $test = implode(",", $order_index[$i]); > > When I print_r() the variable I have values so I know that works. > > Any thoughts on this? > > Thanks. > > Aaron > -- 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] Imploding an array?
isn't $order_index[$i] only one index? or is it multi dimensional? "Aaron Wolski" kbiz.com>cc: Subject: [PHP-DB] Imploding an array? 11/06/2002 02:04 PM Please respond to aaronjw Hey all, Can't seem to figure out why this won't work: $test = implode(",", $order_index[$i]); When I print_r() the variable I have values so I know that works. Any thoughts on this? Thanks. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Imploding an array?
You sure you want [$i] on that? Is it a 2-dimensional array? On Wed, 6 Nov 2002, Aaron Wolski wrote: > Hey all, > > Can't seem to figure out why this won't work: > > $test = implode(",", $order_index[$i]); > > When I print_r() the variable I have values so I know that works. > > Any thoughts on this? > > Thanks. > > Aaron > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Imploding an array?
Hey all, Can't seem to figure out why this won't work: $test = implode(",", $order_index[$i]); When I print_r() the variable I have values so I know that works. Any thoughts on this? Thanks. Aaron
RE: [PHP-DB] mysql_fetch_array() question
Of course, you can avoid that problem if you use a join, I guess it all comes down to code complexity vs SQL complexity. -- Josh -Original Message- From: Ignatius Reilly [mailto:ignatius.reilly@;free.fr] Sent: Wednesday, November 06, 2002 1:38 PM To: Josh Johnson; '1LT John W. Holmes'; 'Graeme McLaren'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] mysql_fetch_array() question John is right. In fact one routinely calls two different $result(s) when coding nested loops: while( $details = mysql_fetch_array( $result ) ) { while ( $Email = mysql_fetch_array( $result2 ) ) .. } } when executing the next instance of your loop: while( $details = mysql_fetch_array( $result ) and $Email = mysql_fetch_array( $result2 ) ), each mysql_fetch_array will push both pointers (on your two result resources) by one position. if your result sets do not have the same number of rows, the shorter one will choke before the longer one is finished. therefore you will finish the loop not having called all results from the "long" resource. My 0.02 Belgian francs Ignatius - Original Message - From: "Josh Johnson" <[EMAIL PROTECTED]> To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>; "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 7:24 PM Subject: RE: [PHP-DB] mysql_fetch_array() question > :) see why I love mailing lists! :) > > It must have been their logic then, I respectfully retract everything I > said, sorry Graeme! Why do I have to work, I could spend my days > researching this stuff before I post! > > Thanks John! > -- Josh > > -Original Message- > From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] > Sent: Wednesday, November 06, 2002 1:21 PM > To: Josh Johnson; 'Graeme McLaren'; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] mysql_fetch_array() question > > That's not true. You can assign them to different variables and it works > fine. > > $r1 = mysql_query("select * from main limit 1") or die(mysql_error()); > $r2 = mysql_query("select * from apft limit 1") or die(mysql_error()); > > $row1 = mysql_fetch_array($r1); > $row2 = mysql_fetch_array($r2); > > print_r($row1); > echo ""; > print_r($row2); > > ---John Holmes... > > - Original Message - > From: "Josh Johnson" <[EMAIL PROTECTED]> > To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, November 06, 2002 1:02 PM > Subject: RE: [PHP-DB] mysql_fetch_array() question > > > > In my experience, (I haven't checked the docs just yet to figure out > > exactly why), you can only work with one result id at a time. Every > time > > you call mysql_query, it resets the result id (I think it frees the > > result id automatically so you can send another query before getting > the > > new result id), so even if you store it in two separate variables, it > > will only refrence the last id (which sounds just like what happened > in > > your initial post). I think this is limited to a given connection, but > > I'm not sure. > > > > One of the, I guess you could say, "shortcomings" of the mysql > interface > > in php is that you can only execute one query at a time, and I think > > this odd result id overwrighting that happens is due to that fact (I > > might be wrong, but I think you can execute multiple queries at a time > > with perl's DBI module). > > > > I hope that makes more sense :) > > > > -- Josh > > > > -Original Message- > > From: Graeme McLaren [mailto:mickel@;ntlworld.com] > > Sent: Wednesday, November 06, 2002 12:17 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] mysql_fetch_array() question > > > > Josh, Thank you for reply. Thank you to everyone else who replied to > my > > email also. I solved the problem shortly after posting my question, > > I've > > now got a massive SQL query which does the trick. > > > > I was interested when you replied and part of it read: "Just > > remember that you can only work with one mysql result per connection > at > > a time". Can you explain a little more about that please? I don't > > think I > > fully understand what you mean. > > > > Cheers, > > > > Graeme :) > > > > - Original Message - > > From: "Josh Johnson" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, November 06, 2002 12:29 PM > > Subject: RE: [PHP-DB] mysql_fetch_array() question > > > > > > > I concur with Jason, but if restructuring is out of the question, > just > > > rearrange your queries like this: > > > > > > $query = "SELECT Name, Address FROM users"; > > > $result = mysql_query($query); > > > while($details = mysql_fetch_array($result)){ > > > echo "Name: $details[Name]"; > > > echo "Address: $details[Address]"; > > > } > > > $query2 = "SELECT EmailAddress From Members"; > > > $result2 = mysql_query($query2); > > > while($details = mysql_fetch_array($result2)){ > > > echo "Email: $Email[EmailAddress]"; > > > } > > > > > > The results won't come
Re: [PHP-DB] mysql_fetch_array() question
John is right. In fact one routinely calls two different $result(s) when coding nested loops: while( $details = mysql_fetch_array( $result ) ) { while ( $Email = mysql_fetch_array( $result2 ) ) .. } } when executing the next instance of your loop: while( $details = mysql_fetch_array( $result ) and $Email = mysql_fetch_array( $result2 ) ), each mysql_fetch_array will push both pointers (on your two result resources) by one position. if your result sets do not have the same number of rows, the shorter one will choke before the longer one is finished. therefore you will finish the loop not having called all results from the "long" resource. My 0.02 Belgian francs Ignatius - Original Message - From: "Josh Johnson" <[EMAIL PROTECTED]> To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>; "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 7:24 PM Subject: RE: [PHP-DB] mysql_fetch_array() question > :) see why I love mailing lists! :) > > It must have been their logic then, I respectfully retract everything I > said, sorry Graeme! Why do I have to work, I could spend my days > researching this stuff before I post! > > Thanks John! > -- Josh > > -Original Message- > From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] > Sent: Wednesday, November 06, 2002 1:21 PM > To: Josh Johnson; 'Graeme McLaren'; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] mysql_fetch_array() question > > That's not true. You can assign them to different variables and it works > fine. > > $r1 = mysql_query("select * from main limit 1") or die(mysql_error()); > $r2 = mysql_query("select * from apft limit 1") or die(mysql_error()); > > $row1 = mysql_fetch_array($r1); > $row2 = mysql_fetch_array($r2); > > print_r($row1); > echo ""; > print_r($row2); > > ---John Holmes... > > - Original Message - > From: "Josh Johnson" <[EMAIL PROTECTED]> > To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, November 06, 2002 1:02 PM > Subject: RE: [PHP-DB] mysql_fetch_array() question > > > > In my experience, (I haven't checked the docs just yet to figure out > > exactly why), you can only work with one result id at a time. Every > time > > you call mysql_query, it resets the result id (I think it frees the > > result id automatically so you can send another query before getting > the > > new result id), so even if you store it in two separate variables, it > > will only refrence the last id (which sounds just like what happened > in > > your initial post). I think this is limited to a given connection, but > > I'm not sure. > > > > One of the, I guess you could say, "shortcomings" of the mysql > interface > > in php is that you can only execute one query at a time, and I think > > this odd result id overwrighting that happens is due to that fact (I > > might be wrong, but I think you can execute multiple queries at a time > > with perl's DBI module). > > > > I hope that makes more sense :) > > > > -- Josh > > > > -Original Message- > > From: Graeme McLaren [mailto:mickel@;ntlworld.com] > > Sent: Wednesday, November 06, 2002 12:17 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] mysql_fetch_array() question > > > > Josh, Thank you for reply. Thank you to everyone else who replied to > my > > email also. I solved the problem shortly after posting my question, > > I've > > now got a massive SQL query which does the trick. > > > > I was interested when you replied and part of it read: "Just > > remember that you can only work with one mysql result per connection > at > > a time". Can you explain a little more about that please? I don't > > think I > > fully understand what you mean. > > > > Cheers, > > > > Graeme :) > > > > - Original Message - > > From: "Josh Johnson" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, November 06, 2002 12:29 PM > > Subject: RE: [PHP-DB] mysql_fetch_array() question > > > > > > > I concur with Jason, but if restructuring is out of the question, > just > > > rearrange your queries like this: > > > > > > $query = "SELECT Name, Address FROM users"; > > > $result = mysql_query($query); > > > while($details = mysql_fetch_array($result)){ > > > echo "Name: $details[Name]"; > > > echo "Address: $details[Address]"; > > > } > > > $query2 = "SELECT EmailAddress From Members"; > > > $result2 = mysql_query($query2); > > > while($details = mysql_fetch_array($result2)){ > > > echo "Email: $Email[EmailAddress]"; > > > } > > > > > > The results won't come out at the same time, but you could use some > > > logic to combine the results into an array by a common factor. Just > > > remember that you can only work with one mysql result per connection > > at > > > a time. You *may* (untested!) be able to accomplish what you want to > > do > > > with two separate connections, but again, this is seriously > overkill. > > :) > > > > > > I'd def
RE: [PHP-DB] mysql_fetch_array() question
:) see why I love mailing lists! :) It must have been their logic then, I respectfully retract everything I said, sorry Graeme! Why do I have to work, I could spend my days researching this stuff before I post! Thanks John! -- Josh -Original Message- From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] Sent: Wednesday, November 06, 2002 1:21 PM To: Josh Johnson; 'Graeme McLaren'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] mysql_fetch_array() question That's not true. You can assign them to different variables and it works fine. $r1 = mysql_query("select * from main limit 1") or die(mysql_error()); $r2 = mysql_query("select * from apft limit 1") or die(mysql_error()); $row1 = mysql_fetch_array($r1); $row2 = mysql_fetch_array($r2); print_r($row1); echo ""; print_r($row2); ---John Holmes... - Original Message - From: "Josh Johnson" <[EMAIL PROTECTED]> To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 1:02 PM Subject: RE: [PHP-DB] mysql_fetch_array() question > In my experience, (I haven't checked the docs just yet to figure out > exactly why), you can only work with one result id at a time. Every time > you call mysql_query, it resets the result id (I think it frees the > result id automatically so you can send another query before getting the > new result id), so even if you store it in two separate variables, it > will only refrence the last id (which sounds just like what happened in > your initial post). I think this is limited to a given connection, but > I'm not sure. > > One of the, I guess you could say, "shortcomings" of the mysql interface > in php is that you can only execute one query at a time, and I think > this odd result id overwrighting that happens is due to that fact (I > might be wrong, but I think you can execute multiple queries at a time > with perl's DBI module). > > I hope that makes more sense :) > > -- Josh > > -Original Message- > From: Graeme McLaren [mailto:mickel@;ntlworld.com] > Sent: Wednesday, November 06, 2002 12:17 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] mysql_fetch_array() question > > Josh, Thank you for reply. Thank you to everyone else who replied to my > email also. I solved the problem shortly after posting my question, > I've > now got a massive SQL query which does the trick. > > I was interested when you replied and part of it read: "Just > remember that you can only work with one mysql result per connection at > a time". Can you explain a little more about that please? I don't > think I > fully understand what you mean. > > Cheers, > > Graeme :) > > - Original Message - > From: "Josh Johnson" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, November 06, 2002 12:29 PM > Subject: RE: [PHP-DB] mysql_fetch_array() question > > > > I concur with Jason, but if restructuring is out of the question, just > > rearrange your queries like this: > > > > $query = "SELECT Name, Address FROM users"; > > $result = mysql_query($query); > > while($details = mysql_fetch_array($result)){ > > echo "Name: $details[Name]"; > > echo "Address: $details[Address]"; > > } > > $query2 = "SELECT EmailAddress From Members"; > > $result2 = mysql_query($query2); > > while($details = mysql_fetch_array($result2)){ > > echo "Email: $Email[EmailAddress]"; > > } > > > > The results won't come out at the same time, but you could use some > > logic to combine the results into an array by a common factor. Just > > remember that you can only work with one mysql result per connection > at > > a time. You *may* (untested!) be able to accomplish what you want to > do > > with two separate connections, but again, this is seriously overkill. > :) > > > > I'd definitely recommend restructuring your talbes as Jason suggested. > > -- Josh > > > > > > -Original Message- > > From: Jason Wong [mailto:phplist@;gremlins.com.hk] > > Sent: Wednesday, November 06, 2002 5:24 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] mysql_fetch_array() question > > > > On Tuesday 05 November 2002 05:47, Graeme McLaren wrote: > > > Hi, Anyone know how I can use two mysql_fetch_array() functions > > similar > > > to the code below? I've tried a few different ways but I keep > getting > > > Resource ID #4. I need to do this to retrieve an email address from > > one > > > table and retrieve details from another. > > > > > > Cheers for any tips - I'm stumped with this one, > > > > > > Graeme :) > > > > > > $query = "SELECT Name, Address FROM users"; > > > $query2 = "SELECT EmailAddress From Members"; > > > > > > $result = mysql_query($query); > > > $result2 = mysql_query($query2); > > > > > > while($details = mysql_fetch_array($result) and $Email = > > > mysql_fetch_array($result2)) > > > { > > > echo "Name: $details[Name]"; > > > echo "Address: $details[Address]"; > > > echo "Email: $Email[EmailAddress]"; > > > } > > > > Unless I've missed something you're going about
[PHP-DB] forum test
Hi everyone, I just uploaded my forum and would like to have it field tested by everyone. It'll prob still have some bugs in there. http://seabird.jmtech.ca go to website and then click on forum. please ignore the login in the left top for now, Jacco -- http://seabird.jmtech.ca Attitude is Everything! But Remember, Attitudes are Contagious! Is Yours worth Catching -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_fetch_array() question
That's not true. You can assign them to different variables and it works fine. $r1 = mysql_query("select * from main limit 1") or die(mysql_error()); $r2 = mysql_query("select * from apft limit 1") or die(mysql_error()); $row1 = mysql_fetch_array($r1); $row2 = mysql_fetch_array($r2); print_r($row1); echo ""; print_r($row2); ---John Holmes... - Original Message - From: "Josh Johnson" <[EMAIL PROTECTED]> To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 1:02 PM Subject: RE: [PHP-DB] mysql_fetch_array() question > In my experience, (I haven't checked the docs just yet to figure out > exactly why), you can only work with one result id at a time. Every time > you call mysql_query, it resets the result id (I think it frees the > result id automatically so you can send another query before getting the > new result id), so even if you store it in two separate variables, it > will only refrence the last id (which sounds just like what happened in > your initial post). I think this is limited to a given connection, but > I'm not sure. > > One of the, I guess you could say, "shortcomings" of the mysql interface > in php is that you can only execute one query at a time, and I think > this odd result id overwrighting that happens is due to that fact (I > might be wrong, but I think you can execute multiple queries at a time > with perl's DBI module). > > I hope that makes more sense :) > > -- Josh > > -Original Message- > From: Graeme McLaren [mailto:mickel@;ntlworld.com] > Sent: Wednesday, November 06, 2002 12:17 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] mysql_fetch_array() question > > Josh, Thank you for reply. Thank you to everyone else who replied to my > email also. I solved the problem shortly after posting my question, > I've > now got a massive SQL query which does the trick. > > I was interested when you replied and part of it read: "Just > remember that you can only work with one mysql result per connection at > a time". Can you explain a little more about that please? I don't > think I > fully understand what you mean. > > Cheers, > > Graeme :) > > - Original Message - > From: "Josh Johnson" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, November 06, 2002 12:29 PM > Subject: RE: [PHP-DB] mysql_fetch_array() question > > > > I concur with Jason, but if restructuring is out of the question, just > > rearrange your queries like this: > > > > $query = "SELECT Name, Address FROM users"; > > $result = mysql_query($query); > > while($details = mysql_fetch_array($result)){ > > echo "Name: $details[Name]"; > > echo "Address: $details[Address]"; > > } > > $query2 = "SELECT EmailAddress From Members"; > > $result2 = mysql_query($query2); > > while($details = mysql_fetch_array($result2)){ > > echo "Email: $Email[EmailAddress]"; > > } > > > > The results won't come out at the same time, but you could use some > > logic to combine the results into an array by a common factor. Just > > remember that you can only work with one mysql result per connection > at > > a time. You *may* (untested!) be able to accomplish what you want to > do > > with two separate connections, but again, this is seriously overkill. > :) > > > > I'd definitely recommend restructuring your talbes as Jason suggested. > > -- Josh > > > > > > -Original Message- > > From: Jason Wong [mailto:phplist@;gremlins.com.hk] > > Sent: Wednesday, November 06, 2002 5:24 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] mysql_fetch_array() question > > > > On Tuesday 05 November 2002 05:47, Graeme McLaren wrote: > > > Hi, Anyone know how I can use two mysql_fetch_array() functions > > similar > > > to the code below? I've tried a few different ways but I keep > getting > > > Resource ID #4. I need to do this to retrieve an email address from > > one > > > table and retrieve details from another. > > > > > > Cheers for any tips - I'm stumped with this one, > > > > > > Graeme :) > > > > > > $query = "SELECT Name, Address FROM users"; > > > $query2 = "SELECT EmailAddress From Members"; > > > > > > $result = mysql_query($query); > > > $result2 = mysql_query($query2); > > > > > > while($details = mysql_fetch_array($result) and $Email = > > > mysql_fetch_array($result2)) > > > { > > > echo "Name: $details[Name]"; > > > echo "Address: $details[Address]"; > > > echo "Email: $Email[EmailAddress]"; > > > } > > > > Unless I've missed something you're going about this the wrong way. > For > > what > > you want to do, you should (in general) be able to accomplish it using > > just a > > single query. > > > > What fields do the tables 'users' and 'Members' contain? There should > be > > a > > field there (like eg. userid) which links the two together. If there > > isn't > > one then you should seriously restructure your tables so that there is > > one. > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > Op
RE: [PHP-DB] mysql_fetch_array() question
In my experience, (I haven't checked the docs just yet to figure out exactly why), you can only work with one result id at a time. Every time you call mysql_query, it resets the result id (I think it frees the result id automatically so you can send another query before getting the new result id), so even if you store it in two separate variables, it will only refrence the last id (which sounds just like what happened in your initial post). I think this is limited to a given connection, but I'm not sure. One of the, I guess you could say, "shortcomings" of the mysql interface in php is that you can only execute one query at a time, and I think this odd result id overwrighting that happens is due to that fact (I might be wrong, but I think you can execute multiple queries at a time with perl's DBI module). I hope that makes more sense :) -- Josh -Original Message- From: Graeme McLaren [mailto:mickel@;ntlworld.com] Sent: Wednesday, November 06, 2002 12:17 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] mysql_fetch_array() question Josh, Thank you for reply. Thank you to everyone else who replied to my email also. I solved the problem shortly after posting my question, I've now got a massive SQL query which does the trick. I was interested when you replied and part of it read: "Just remember that you can only work with one mysql result per connection at a time". Can you explain a little more about that please? I don't think I fully understand what you mean. Cheers, Graeme :) - Original Message - From: "Josh Johnson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 12:29 PM Subject: RE: [PHP-DB] mysql_fetch_array() question > I concur with Jason, but if restructuring is out of the question, just > rearrange your queries like this: > > $query = "SELECT Name, Address FROM users"; > $result = mysql_query($query); > while($details = mysql_fetch_array($result)){ > echo "Name: $details[Name]"; > echo "Address: $details[Address]"; > } > $query2 = "SELECT EmailAddress From Members"; > $result2 = mysql_query($query2); > while($details = mysql_fetch_array($result2)){ > echo "Email: $Email[EmailAddress]"; > } > > The results won't come out at the same time, but you could use some > logic to combine the results into an array by a common factor. Just > remember that you can only work with one mysql result per connection at > a time. You *may* (untested!) be able to accomplish what you want to do > with two separate connections, but again, this is seriously overkill. :) > > I'd definitely recommend restructuring your talbes as Jason suggested. > -- Josh > > > -Original Message- > From: Jason Wong [mailto:phplist@;gremlins.com.hk] > Sent: Wednesday, November 06, 2002 5:24 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] mysql_fetch_array() question > > On Tuesday 05 November 2002 05:47, Graeme McLaren wrote: > > Hi, Anyone know how I can use two mysql_fetch_array() functions > similar > > to the code below? I've tried a few different ways but I keep getting > > Resource ID #4. I need to do this to retrieve an email address from > one > > table and retrieve details from another. > > > > Cheers for any tips - I'm stumped with this one, > > > > Graeme :) > > > > $query = "SELECT Name, Address FROM users"; > > $query2 = "SELECT EmailAddress From Members"; > > > > $result = mysql_query($query); > > $result2 = mysql_query($query2); > > > > while($details = mysql_fetch_array($result) and $Email = > > mysql_fetch_array($result2)) > > { > > echo "Name: $details[Name]"; > > echo "Address: $details[Address]"; > > echo "Email: $Email[EmailAddress]"; > > } > > Unless I've missed something you're going about this the wrong way. For > what > you want to do, you should (in general) be able to accomplish it using > just a > single query. > > What fields do the tables 'users' and 'Members' contain? There should be > a > field there (like eg. userid) which links the two together. If there > isn't > one then you should seriously restructure your tables so that there is > one. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > > /* > Cats are smarter than dogs. You can't make eight cats pull a sled > through > the snow. > */ > > > -- > 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Question - thanks
Hi there everyone, Thanks for the response to my question - both the attachments and PHP as a full blown dev language. I know the latter isn't really for this group, but this is the best PHP group I have found and the only one I write in regularly. Thanks again Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_fetch_array() question
Josh, Thank you for reply. Thank you to everyone else who replied to my email also. I solved the problem shortly after posting my question, I've now got a massive SQL query which does the trick. I was interested when you replied and part of it read: "Just remember that you can only work with one mysql result per connection at a time". Can you explain a little more about that please? I don't think I fully understand what you mean. Cheers, Graeme :) - Original Message - From: "Josh Johnson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 12:29 PM Subject: RE: [PHP-DB] mysql_fetch_array() question > I concur with Jason, but if restructuring is out of the question, just > rearrange your queries like this: > > $query = "SELECT Name, Address FROM users"; > $result = mysql_query($query); > while($details = mysql_fetch_array($result)){ > echo "Name: $details[Name]"; > echo "Address: $details[Address]"; > } > $query2 = "SELECT EmailAddress From Members"; > $result2 = mysql_query($query2); > while($details = mysql_fetch_array($result2)){ > echo "Email: $Email[EmailAddress]"; > } > > The results won't come out at the same time, but you could use some > logic to combine the results into an array by a common factor. Just > remember that you can only work with one mysql result per connection at > a time. You *may* (untested!) be able to accomplish what you want to do > with two separate connections, but again, this is seriously overkill. :) > > I'd definitely recommend restructuring your talbes as Jason suggested. > -- Josh > > > -Original Message- > From: Jason Wong [mailto:phplist@;gremlins.com.hk] > Sent: Wednesday, November 06, 2002 5:24 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] mysql_fetch_array() question > > On Tuesday 05 November 2002 05:47, Graeme McLaren wrote: > > Hi, Anyone know how I can use two mysql_fetch_array() functions > similar > > to the code below? I've tried a few different ways but I keep getting > > Resource ID #4. I need to do this to retrieve an email address from > one > > table and retrieve details from another. > > > > Cheers for any tips - I'm stumped with this one, > > > > Graeme :) > > > > $query = "SELECT Name, Address FROM users"; > > $query2 = "SELECT EmailAddress From Members"; > > > > $result = mysql_query($query); > > $result2 = mysql_query($query2); > > > > while($details = mysql_fetch_array($result) and $Email = > > mysql_fetch_array($result2)) > > { > > echo "Name: $details[Name]"; > > echo "Address: $details[Address]"; > > echo "Email: $Email[EmailAddress]"; > > } > > Unless I've missed something you're going about this the wrong way. For > what > you want to do, you should (in general) be able to accomplish it using > just a > single query. > > What fields do the tables 'users' and 'Members' contain? There should be > a > field there (like eg. userid) which links the two together. If there > isn't > one then you should seriously restructure your tables so that there is > one. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > > /* > Cats are smarter than dogs. You can't make eight cats pull a sled > through > the snow. > */ > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Question
This isn't the place for discussions of php development, I think php-dev is what you want... but ah, PHP is a full-blown programming language, even under widnows. http://www.php.net/manual/sv/features.commandline.php <-- check this page out You can write shell scripts with it, associate windows with php files so double-clicking on a php file will execute it, there's even wrappers for the windows API... http://www.php.net/manual/en/ref.w32api.php, not to mention the windows port of SDL *and* GTK... -- Josh -Original Message- From: Chris Payne [mailto:chris@;planetoxygene.com] Sent: Wednesday, November 06, 2002 11:28 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Question Hi there everyone, Why are so many attachments coming in to the list? Hopefully it's not because somebody has a virus and is infecting people who open them. So don't open attachments unless you are expecting something. Are there any plans to make PHP for windows a full blown programming language that doesn't need to be run through a web browser? That would be so nice in my opinion. Chris -- 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] Question
Well, you can already do that--just download and install the CGI version. Unless, of course, you meant that you want to write Windows GUI applications, in which case I think someone is working on something like that with PHP-GTK. Oh, the attachments are either quoted messages or patches, for the most part, so nothing particularly ominous. Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! --- Begin Message --- Hi there everyone, Why are so many attachments coming in to the list? Hopefully it's not because somebody has a virus and is infecting people who open them. So don't open attachments unless you are expecting something. Are there any plans to make PHP for windows a full blown programming language that doesn't need to be run through a web browser? That would be so nice in my opinion. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Peter Beckman <[EMAIL PROTECTED]> wrote... : > Besides, if they don't search the archives and newsgroups and Google > already, why would we believe they'd read the FAQ? There are already lots of FAQs, but even you who argue about that do not know much aboiut. So, an FAQ whether gets incorporated into this mailing list or we answer mostly with the links to FAQs. There is really no other way. -- Maxim Maletsky [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Question
Hi there everyone, Why are so many attachments coming in to the list? Hopefully it's not because somebody has a virus and is infecting people who open them. So don't open attachments unless you are expecting something. Are there any plans to make PHP for windows a full blown programming language that doesn't need to be run through a web browser? That would be so nice in my opinion. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Great! But, many people cannot *understand* the manuals for their own reasons, that is why they ask - they hope to get some sample code. Shall we? -- Maxim Maletsky [EMAIL PROTECTED] Peter Beckman <[EMAIL PROTECTED]> wrote... : > Hey, there are a lot of new people who are starting with PHP. We all are > here to help people learn how to use PHP because we are all PHP fans and > want the world to use PHP. register_globals is an issue that us more > advanced folk know about and deal with on a regular basis. There are lazy > people who don't know how to use a manual. However, we've got the ability > here to help people who don't know about or how to use the manual. And > honestly, some questions are more difficult than the manual provides, > especially if you aren't sure where to look. > > How's this? Anytime someone posts a potential answer, post the manual page > for the function, SQL reference or something related. That way it's in the > newsgroup and the archives. People DO search the archives, while some > people don't. > > We can't all expect everyone to be as smart and as knowledgable about PHP > as some of the people on this list are. So give them a chance and help > them learn how to learn instead of getting mad. And if you get mad, maybe > this isn't the right place for you to be! I mean that in the nicest > sense; the world is filled with idiots, and this list is here to help both > idiots and geniuses get through their stumbling blocks by being an > intelligent, helpful and friendly community. At least that's what I hope > this is. > > Peter > > On 6 Nov 2002, Marco Tabini wrote: > > > Well, excuse me for being a bit cynical, but it's hard to be > > philosophical with a deadline hanging over your head. It's true that > > most of the questions can be answered by looking at the manual, but you > > also have to assume the possibility that the person who's asking them > > has a real and immediate need for the answers--at least that's the way I > > try to think. > > > > One thing that would be great, IMHO, would be to start putting together > > a little FAQ, like many other mailing lists have, that gets updated and > > posted to the list once a month... it could contain answers to the most > > frequently asked questions--anybody who's tired of answering that > > register_globals has been turned off in recent versions raise your hand! > > :-) > > > > > > Marco > > -- > > > > php|architect - The magazine for PHP Professionals > > The first monthly worldwide magazine dedicated to PHP programmer > > > > Come visit us at http://www.phparch.com! > > > > > > --- > Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation > [EMAIL PROTECTED] http://www.purplecow.com/ > --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
This is how you'd find it in the future. It's fairly simple. http://php.net/ --> Mailing Lists --> Databases and PHP archive link "YES" OR --> Databases and PHP Newsgroup link "Yes" Archives: http://marc.theaimsgroup.com/?l=php-db Newsgroup: news://news.php.net/php.db Peter On Wed, 6 Nov 2002, dwalker wrote: > What archive and how do I access it? --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] sort by date
Go here: http://www.php.net/mailing-lists.php and scroll down to find the archive for your type of question. Just click and search away - no subscription necessary. Lots of good help in there if you're diligent. > -Original Message- > From: dwalker [mailto:dwalker@;healthyproductsplus.com] > Sent: Wednesday, November 06, 2002 10:42 AM > To: Hutchins, Richard; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] sort by date > > > What archive and how do I access it? > > > -Original Message- > From: Hutchins, Richard <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> > Date: Wednesday, November 06, 2002 10:50 AM > Subject: RE: [PHP-DB] sort by date > > > >Just to weigh in on the tail end here, a FAQ of the top N > items would be > >nice. But I have to say, I use the archives a lot before I > post to the > list. > >The archives contain the answers to most questions out there. If > subscribers > >to this list checked the archives to see if their answer is > there, then > >questions like register_globals might decrease in frequency. > > > >The other side effect of researching answers for yourself > before posting is > >that you gain exposure to more of the language faster. How > many times do > you > >read about something that doesn't solve your immediate > problem, but puts an > >idea into your head as to how you might handle a future > situation? I know I > >benefit from it. > > > >Still, nothing better than being able to get help from some > of the seasoned > >pros on this list right away. > > > >-- > >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] sort by date
What archive and how do I access it? -Original Message- From: Hutchins, Richard <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Wednesday, November 06, 2002 10:50 AM Subject: RE: [PHP-DB] sort by date >Just to weigh in on the tail end here, a FAQ of the top N items would be >nice. But I have to say, I use the archives a lot before I post to the list. >The archives contain the answers to most questions out there. If subscribers >to this list checked the archives to see if their answer is there, then >questions like register_globals might decrease in frequency. > >The other side effect of researching answers for yourself before posting is >that you gain exposure to more of the language faster. How many times do you >read about something that doesn't solve your immediate problem, but puts an >idea into your head as to how you might handle a future situation? I know I >benefit from it. > >Still, nothing better than being able to get help from some of the seasoned >pros on this list right away. > >-- >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] sort by date
I have a manual and use it plus lots of sample code to work through, but there are times when we hit a wall and a simple "second set of eyes" to spot what should be obvious is helpful. I appreciate having a forum to throw out a question and get a rapid response. I could have rewritten this problem, taking the wrong way around and spending more time than my client would like. This way I not only have the solution, but the reason behind it, as well. Thanks again. Terry On Wednesday, November 6, 2002, at 09:35 AM, [EMAIL PROTECTED] wrote: Agreed. we prove day in and out that the answers are only an email away...why would anyone go a different route. manual? whats a manual? There are some brilliant people on this list, but some equally intelligent people wrote some fine documentation. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] sort by date
Besides, if they don't search the archives and newsgroups and Google already, why would we believe they'd read the FAQ? Peter On Wed, 6 Nov 2002, Hutchins, Richard wrote: > Just to weigh in on the tail end here, a FAQ of the top N items would be > nice. But I have to say, I use the archives a lot before I post to the list. > The archives contain the answers to most questions out there. If subscribers > to this list checked the archives to see if their answer is there, then > questions like register_globals might decrease in frequency. > > The other side effect of researching answers for yourself before posting is > that you gain exposure to more of the language faster. How many times do you > read about something that doesn't solve your immediate problem, but puts an > idea into your head as to how you might handle a future situation? I know I > benefit from it. > > Still, nothing better than being able to get help from some of the seasoned > pros on this list right away. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Hey, there are a lot of new people who are starting with PHP. We all are here to help people learn how to use PHP because we are all PHP fans and want the world to use PHP. register_globals is an issue that us more advanced folk know about and deal with on a regular basis. There are lazy people who don't know how to use a manual. However, we've got the ability here to help people who don't know about or how to use the manual. And honestly, some questions are more difficult than the manual provides, especially if you aren't sure where to look. How's this? Anytime someone posts a potential answer, post the manual page for the function, SQL reference or something related. That way it's in the newsgroup and the archives. People DO search the archives, while some people don't. We can't all expect everyone to be as smart and as knowledgable about PHP as some of the people on this list are. So give them a chance and help them learn how to learn instead of getting mad. And if you get mad, maybe this isn't the right place for you to be! I mean that in the nicest sense; the world is filled with idiots, and this list is here to help both idiots and geniuses get through their stumbling blocks by being an intelligent, helpful and friendly community. At least that's what I hope this is. Peter On 6 Nov 2002, Marco Tabini wrote: > Well, excuse me for being a bit cynical, but it's hard to be > philosophical with a deadline hanging over your head. It's true that > most of the questions can be answered by looking at the manual, but you > also have to assume the possibility that the person who's asking them > has a real and immediate need for the answers--at least that's the way I > try to think. > > One thing that would be great, IMHO, would be to start putting together > a little FAQ, like many other mailing lists have, that gets updated and > posted to the list once a month... it could contain answers to the most > frequently asked questions--anybody who's tired of answering that > register_globals has been turned off in recent versions raise your hand! > :-) > > > Marco > -- > > php|architect - The magazine for PHP Professionals > The first monthly worldwide magazine dedicated to PHP programmer > > Come visit us at http://www.phparch.com! > > --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- --- Begin Message --- Agreed. we prove day in and out that the answers are only an email away...why would anyone go a different route. manual? whats a manual? There are some brilliant people on this list, but some equally intelligent people wrote some fine documentation. "Ignatius Reilly" To: "Snijders, Mark" <[EMAIL PROTECTED]>, "'Marco Tabini'" , "Terry Romine" <[EMAIL PROTECTED]> [EMAIL PROTECTED]>cc: <[EMAIL PROTECTED]> Subject: Re: [PHP-DB] sort by date 11/06/2002 10:29 AM Good point. "Tell me and I forget, show me and I remember, involve me and I understand" Ignatius - Original Message - From: "Snijders, Mark" <[EMAIL PROTECTED]> To: "'Marco Tabini'" <[EMAIL PROTECTED]>; "Terry Romine" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 4:22 PM Subject: RE: [PHP-DB] sort by date > why does everybody always gives the answers?? why not a hint, or where to > search that they can learn something about it??? > > > > > > -Original Message- > From: Marco Tabini [mailto:marcot@;inicode.com] > Sent: woensdag 6 november 2002 16:08 > To: Terry Romine > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] sort by date > > > Ok, going out on a limb here... have you tried something like > > select e.id, title, location, address, contact, category, event_time, > urllink, descript, min(event_date) from eventTable e inner join > dateTable d on e.id = d.id group by e.i
RE: [PHP-DB] sort by date
I agree, but in regard to your last paragraph, you're assuming that they read your post and respond to it. Everybody's quick to answer simple redundant questions that every programmer *should* know the answer to, but higher level stuff seems to just get ignored. I'd hope in a high-frequency list like this the converse would be true. Where are the "seasoned pros" when somebody is asking a hard question, or asking for alternative approaches to a problem? -- Josh -Original Message- From: Hutchins, Richard [mailto:Richard.Hutchins@;GetingeCastle.com] Sent: Wednesday, November 06, 2002 10:48 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] sort by date Just to weigh in on the tail end here, a FAQ of the top N items would be nice. But I have to say, I use the archives a lot before I post to the list. The archives contain the answers to most questions out there. If subscribers to this list checked the archives to see if their answer is there, then questions like register_globals might decrease in frequency. The other side effect of researching answers for yourself before posting is that you gain exposure to more of the language faster. How many times do you read about something that doesn't solve your immediate problem, but puts an idea into your head as to how you might handle a future situation? I know I benefit from it. Still, nothing better than being able to get help from some of the seasoned pros on this list right away. -- 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] sort by date
Thanks. My error seemed to be just in the group declaration. Comparing yours and mine with slight modifications to yours that eventually worked as desired: yours: select e.id, title, min(event_date) as event_date from eventTable e, dateTable d where e.id = d.event_key group by e.id; mine: select e.*,min(d.event_date) as event_date from eventTable e,dateTable d where e.id = d.event_key group by d.event_date,d.event_key; As you see, I was already trying to do a join, but the group by was throwing me. Terry On Wednesday, November 6, 2002, at 09:15 AM, Marco Tabini wrote: My guess? Because we're all professionals at work and trying to solve a specific problem...since we're adults, I guess the learning part should be up to each of us--the information is certainly there even in the answer. :-) Marco -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] sort by date
Just to weigh in on the tail end here, a FAQ of the top N items would be nice. But I have to say, I use the archives a lot before I post to the list. The archives contain the answers to most questions out there. If subscribers to this list checked the archives to see if their answer is there, then questions like register_globals might decrease in frequency. The other side effect of researching answers for yourself before posting is that you gain exposure to more of the language faster. How many times do you read about something that doesn't solve your immediate problem, but puts an idea into your head as to how you might handle a future situation? I know I benefit from it. Still, nothing better than being able to get help from some of the seasoned pros on this list right away. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Well, excuse me for being a bit cynical, but it's hard to be philosophical with a deadline hanging over your head. It's true that most of the questions can be answered by looking at the manual, but you also have to assume the possibility that the person who's asking them has a real and immediate need for the answers--at least that's the way I try to think. One thing that would be great, IMHO, would be to start putting together a little FAQ, like many other mailing lists have, that gets updated and posted to the list once a month... it could contain answers to the most frequently asked questions--anybody who's tired of answering that register_globals has been turned off in recent versions raise your hand! :-) Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! --- Begin Message --- Agreed. we prove day in and out that the answers are only an email away...why would anyone go a different route. manual? whats a manual? There are some brilliant people on this list, but some equally intelligent people wrote some fine documentation. "Ignatius Reilly" To: "Snijders, Mark" <[EMAIL PROTECTED]>, "'Marco Tabini'" , "Terry Romine" <[EMAIL PROTECTED]> [EMAIL PROTECTED]>cc: <[EMAIL PROTECTED]> Subject: Re: [PHP-DB] sort by date 11/06/2002 10:29 AM Good point. "Tell me and I forget, show me and I remember, involve me and I understand" Ignatius - Original Message - From: "Snijders, Mark" <[EMAIL PROTECTED]> To: "'Marco Tabini'" <[EMAIL PROTECTED]>; "Terry Romine" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 4:22 PM Subject: RE: [PHP-DB] sort by date > why does everybody always gives the answers?? why not a hint, or where to > search that they can learn something about it??? > > > > > > -Original Message- > From: Marco Tabini [mailto:marcot@;inicode.com] > Sent: woensdag 6 november 2002 16:08 > To: Terry Romine > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] sort by date > > > Ok, going out on a limb here... have you tried something like > > select e.id, title, location, address, contact, category, event_time, > urllink, descript, min(event_date) from eventTable e inner join > dateTable d on e.id = d.id group by e.id > > ? > > > Marco > > -- > > php|architect - The magazine for PHP Professionals > The first monthly worldwide magazine dedicated to PHP programmer > > Come visit us at http://www.phparch.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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Agreed. we prove day in and out that the answers are only an email away...why would anyone go a different route. manual? whats a manual? There are some brilliant people on this list, but some equally intelligent people wrote some fine documentation. "Ignatius Reilly" To: "Snijders, Mark" <[EMAIL PROTECTED]>, "'Marco Tabini'" , "Terry Romine" <[EMAIL PROTECTED]> [EMAIL PROTECTED]>cc: <[EMAIL PROTECTED]> Subject: Re: [PHP-DB] sort by date 11/06/2002 10:29 AM Good point. "Tell me and I forget, show me and I remember, involve me and I understand" Ignatius - Original Message - From: "Snijders, Mark" <[EMAIL PROTECTED]> To: "'Marco Tabini'" <[EMAIL PROTECTED]>; "Terry Romine" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 4:22 PM Subject: RE: [PHP-DB] sort by date > why does everybody always gives the answers?? why not a hint, or where to > search that they can learn something about it??? > > > > > > -Original Message- > From: Marco Tabini [mailto:marcot@;inicode.com] > Sent: woensdag 6 november 2002 16:08 > To: Terry Romine > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] sort by date > > > Ok, going out on a limb here... have you tried something like > > select e.id, title, location, address, contact, category, event_time, > urllink, descript, min(event_date) from eventTable e inner join > dateTable d on e.id = d.id group by e.id > > ? > > > Marco > > -- > > php|architect - The magazine for PHP Professionals > The first monthly worldwide magazine dedicated to PHP programmer > > Come visit us at http://www.phparch.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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Good point. "Tell me and I forget, show me and I remember, involve me and I understand" Ignatius - Original Message - From: "Snijders, Mark" <[EMAIL PROTECTED]> To: "'Marco Tabini'" <[EMAIL PROTECTED]>; "Terry Romine" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 4:22 PM Subject: RE: [PHP-DB] sort by date > why does everybody always gives the answers?? why not a hint, or where to > search that they can learn something about it??? > > > > > > -Original Message- > From: Marco Tabini [mailto:marcot@;inicode.com] > Sent: woensdag 6 november 2002 16:08 > To: Terry Romine > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] sort by date > > > Ok, going out on a limb here... have you tried something like > > select e.id, title, location, address, contact, category, event_time, > urllink, descript, min(event_date) from eventTable e inner join > dateTable d on e.id = d.id group by e.id > > ? > > > Marco > > -- > > php|architect - The magazine for PHP Professionals > The first monthly worldwide magazine dedicated to PHP programmer > > Come visit us at http://www.phparch.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] sort by date
My guess? Because we're all professionals at work and trying to solve a specific problem...since we're adults, I guess the learning part should be up to each of us--the information is certainly there even in the answer. :-) Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! --- Begin Message --- why does everybody always gives the answers?? why not a hint, or where to search that they can learn something about it??? -Original Message- From: Marco Tabini [mailto:marcot@;inicode.com] Sent: woensdag 6 november 2002 16:08 To: Terry Romine Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] sort by date Ok, going out on a limb here... have you tried something like select e.id, title, location, address, contact, category, event_time, urllink, descript, min(event_date) from eventTable e inner join dateTable d on e.id = d.id group by e.id ? Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] sort by date
why does everybody always gives the answers?? why not a hint, or where to search that they can learn something about it??? -Original Message- From: Marco Tabini [mailto:marcot@;inicode.com] Sent: woensdag 6 november 2002 16:08 To: Terry Romine Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] sort by date Ok, going out on a limb here... have you tried something like select e.id, title, location, address, contact, category, event_time, urllink, descript, min(event_date) from eventTable e inner join dateTable d on e.id = d.id group by e.id ? Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Ok, going out on a limb here... have you tried something like select e.id, title, location, address, contact, category, event_time, urllink, descript, min(event_date) from eventTable e inner join dateTable d on e.id = d.id group by e.id ? Marco -- php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com! --- Begin Message --- I have two tables, one contains event information and the other dates that the event takes place: | id| int(11) | | PRI | 0 | auto_increment | | title | varchar(100) | YES | | NULL|| | location | varchar(100) | YES | | NULL|| | address | varchar(100) | YES | | NULL|| | contact | varchar(100) | YES | | NULL|| | category | varchar(100) | YES | | NULL|| | event_time| varchar(200) | YES | | NULL|| | urllink | varchar(100) | YES | | NULL|| | descript | text | YES | | NULL|| | id | int(11) | | PRI | 0 | auto_increment | | event_key | int(11) | YES | | NULL|| | event_date | date| YES | | NULL|| They are linked via dateTable.event_key=eventTable.id I want to be able to sort by the first date that the event takes place. I tried: $sql="select e.*,d.event_date from eventTable e,dateTable d where e.id=d.event_key order by d.event_date,d.event_key but it still shows each date that the event takes place. I tried doing a min(d.event_date) as event_date and then "group by" instead of "order by" but still get too many results. Any help to straighten this out? Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] sort by date
if i get your point: 1 event can have more dates.. and you wanna show for each event just the first date... so you wanna show more from one table as the other one in that case you should try to use the left join !! so check the manual on left join -Original Message- From: Terry Romine [mailto:eatrom@;blazing-trails.com] Sent: woensdag 6 november 2002 15:55 To: [EMAIL PROTECTED] Subject: [PHP-DB] sort by date I have two tables, one contains event information and the other dates that the event takes place: | id| int(11) | | PRI | 0 | auto_increment | | title | varchar(100) | YES | | NULL|| | location | varchar(100) | YES | | NULL|| | address | varchar(100) | YES | | NULL|| | contact | varchar(100) | YES | | NULL|| | category | varchar(100) | YES | | NULL|| | event_time| varchar(200) | YES | | NULL|| | urllink | varchar(100) | YES | | NULL|| | descript | text | YES | | NULL|| | id | int(11) | | PRI | 0 | auto_increment | | event_key | int(11) | YES | | NULL|| | event_date | date| YES | | NULL|| They are linked via dateTable.event_key=eventTable.id I want to be able to sort by the first date that the event takes place. I tried: $sql="select e.*,d.event_date from eventTable e,dateTable d where e.id=d.event_key order by d.event_date,d.event_key but it still shows each date that the event takes place. I tried doing a min(d.event_date) as event_date and then "group by" instead of "order by" but still get too many results. Any help to straighten this out? Terry -- 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] postgresql and php - my codes running twice?!?!?
Hi, Can anyone help I'm going mad with this... I'm using postgresql with php and writing a small login and sign-up system. Whena user wishes to sign-up Iwant to check there are not any other users with the same username, so I'm doing a select against the db with the requested username before allowing the insert to add the user to the db. For some reason the code I'm using seems to be running through the fucntion twice sometimes!!! and other times runs as it should!!! Thanks for any help or ideas. Zac The code in the top of the html page calling the function: The function it's self : function Mmbr_SgnUp($ChkVal, $Rdr){ /* Will check that each element in ChkVal array has a $_POST value not null Will check no duplicates of unique column Will redirect to success or fail with error message HTML Form Elements should be called Username, Password, Preffered, Reminder, Country, ChkVal array of element names to be checked Rdr page to redirect to if successful Standard begining to error message */ $GLOBALS[dbgPos] = 'Mmbr_SgnUp function'; if($GLOBALS[c01_debug]) echo ' Debugging from New Member Sign Up Function '; // - - - - - - - - define function vars // - - - - - - - - array for errors that occured $Err = array(); // - - - - - - - - array for noting missing elements in sign up $EmtErr = array(); // - - - - - - - - check that each form element has been completed ForEach($ChkVal as $val){ // - - - - - - - - if element is not set add element to error array if(!isset($_REQUEST[$val])){ array_push($EmtErr,$val); $Err[0] = $GLOBALS[c01_Err_21]; } } if($GLOBALS[c01_debug]){ // - - - - - - write ChkVal array to screen wrt_arr_scrn($ChkVal); echo 'Rdr = '.$Rdr.''; } // - - - - - - - - Check for duplicate values in db // - - - - - - - - create db connecion $Con = dbc(); $Qry = dbq('SELECT "UsrId" FROM "Usr" WHERE "UsrId" = '."'".$_REQUEST[Username]."'".';'); for($r = 0 ; $r < 1; $r++){ echo $r; } if($GLOBALS[c01_debug]) echo 'SELECT "UsrId" FROM "Usr" WHERE "UsrId" = '."'".$_REQUEST[Username]."'".';'; if(db_num_rows($Qry) > $GLOBALS[c01_0]){ $Row = db_fetch_row($Qry); echo $Row[0]; $Err[1] = $GLOBALS[c01_Err_20]; if($GLOBALS[c01_debug]) echo ' Check for more than one entry NumRows returned - '.db_num_rows($Qry).''; // - - - - - - - - log new member sign-up failure wrt_log($GLOBALS[c01_log_level_usr],$GLOBALS[c01_t],'New_Member','*** FAILED Sign-up at '.$GLOBALS[c05_DteTme].', Username = '.$_POST[Username].', Err[0] = '.$Err[0].', Err[1] = '.$Err[1]." \n"); if($GLOBALS[c01_debug]) echo ' End Debugging from New Member Sign Up Function '; // - - - - - - - - return errors $Err["missing"] = $EmtErr; return $Err; } else { // - - - - - - - - Check if signup was successful if($GLOBALS[c01_debug]) echo'No Errors In passed data Proceding to write to DB'; // - - - - - - - - insert record into db $cols = '"Sts","StsDtm","IniDtm","LgiDtm","Usr_MlcKey","UsrId","Pwd"'; $vals = '1,'."'".$GLOBALS[c05_Dte]."'".','."'".$GLOBALS[c05_DteTme]."'".','."'".$GLO BALS[c05_DteTme]."'".','."'".$_POST[Country]."'".','."'".$_POST[Username]."' ".','."'".$_POST[Password]."'"; if($_POST[Preffered] != ''){ echo 'pp'.$_POST[Preffered].'pp'; $cols.= ',"PrfNme"'; $vals.= ','."'".$_POST[Preffered]."'"; } $Qry = dbq('INSERT INTO "Usr" ('.$cols.') Values ('.$vals.');'); // - - - - - - - - get usrid $Uid = db_insert_id($Qry); if($GLOBALS[c01_debug]) echo 'Get DB OID - '.$Uid.''; if($_POST[Reminder]){ // - - - - - - - - add other details to Udt ~ password reminder $Qry = dbq('INSERT INTO "Udt" ("Udt_UsrKey", "PwdRmd") VALUES ('.$Uid.', '."'".$_POST[Reminder]."'".');'); } // - - - - - - - - log new member sign-up wrt_log($GLOBALS[c01_log_level_usr],$GLOBALS[c01_t],'New_Member','SUCCESSFUL Sign-up at '.$GLOBALS[c05_DteTme].', UserId = '.$Uid." \n "); // - - - - - - - - add freebies for becoming a new member $frb = add_frb('BNM001', $Uid); if($GLOBALS[c01_debug]) echo ' Add Freebies for Sign Up'; // - - - - - - - - login ~ which will result in redirect if($GLOBALS[c01_debug]) echo 'Now Goto Login Function to Log User in'; if($GLOBALS[c01_debug]) echo ' End Debugging from New Member Sign Up Function '; #Usr_Lgn($Rdr); } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] sort by date
I have two tables, one contains event information and the other dates that the event takes place: | id| int(11) | | PRI | 0 | auto_increment | | title | varchar(100) | YES | | NULL|| | location | varchar(100) | YES | | NULL|| | address | varchar(100) | YES | | NULL|| | contact | varchar(100) | YES | | NULL|| | category | varchar(100) | YES | | NULL|| | event_time| varchar(200) | YES | | NULL|| | urllink | varchar(100) | YES | | NULL|| | descript | text | YES | | NULL|| | id | int(11) | | PRI | 0 | auto_increment | | event_key | int(11) | YES | | NULL|| | event_date | date| YES | | NULL|| They are linked via dateTable.event_key=eventTable.id I want to be able to sort by the first date that the event takes place. I tried: $sql="select e.*,d.event_date from eventTable e,dateTable d where e.id=d.event_key order by d.event_date,d.event_key but it still shows each date that the event takes place. I tried doing a min(d.event_date) as event_date and then "group by" instead of "order by" but still get too many results. Any help to straighten this out? Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] default-character-set problem
You have to put the same under [server] Nikos wrote: Hello there... I have a problem with sort order. I use greek and english characters. The manual says to put the following lines to my.cnf: [client] character-sets-dir=/usr/local/mysql/share/mysql/charsets default-character-set=greek i restart the demon but the problem still exist. I have 3.23.49 ver on Red Hat Linux 7.2 Thanx list -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Abstraction layer or not?
> > I'm working on a new site, and I'm wondering whether to use an > > abstraction layer or not. I don't have any plans to switch DB system, > > but you never know what the future holds. I figure that there's no > > reason not to, but are there any down sides? Which abstraction layers > > are good? well, any down side ? may be slower for example. So, if you don't plan to switch db system, the speed of the layer could be your criteria. > ADOdb is a good one. PEAR also has an abstraction class. Once you get > used to using them, they make things easier over all. I've never > actually switched databases with them, so I don't know how much easier > it makes that. I find them ideal for error catching and reporting. I agreed. ADOdb (http://php.weblogs.com/ADODB) is quite nice, fast, (the fatest ?) and very helpful even if you don't change db. See benchmark at http://phplens.com/lens/adodb/. Well, it's from adodb, may be you would find an other one written by those using pear_db. Regards, Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mysql_fetch_array() question
I concur with Jason, but if restructuring is out of the question, just rearrange your queries like this: $query = "SELECT Name, Address FROM users"; $result = mysql_query($query); while($details = mysql_fetch_array($result)){ echo "Name: $details[Name]"; echo "Address: $details[Address]"; } $query2 = "SELECT EmailAddress From Members"; $result2 = mysql_query($query2); while($details = mysql_fetch_array($result2)){ echo "Email: $Email[EmailAddress]"; } The results won't come out at the same time, but you could use some logic to combine the results into an array by a common factor. Just remember that you can only work with one mysql result per connection at a time. You *may* (untested!) be able to accomplish what you want to do with two separate connections, but again, this is seriously overkill. :) I'd definitely recommend restructuring your talbes as Jason suggested. -- Josh -Original Message- From: Jason Wong [mailto:phplist@;gremlins.com.hk] Sent: Wednesday, November 06, 2002 5:24 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] mysql_fetch_array() question On Tuesday 05 November 2002 05:47, Graeme McLaren wrote: > Hi, Anyone know how I can use two mysql_fetch_array() functions similar > to the code below? I've tried a few different ways but I keep getting > Resource ID #4. I need to do this to retrieve an email address from one > table and retrieve details from another. > > Cheers for any tips - I'm stumped with this one, > > Graeme :) > > $query = "SELECT Name, Address FROM users"; > $query2 = "SELECT EmailAddress From Members"; > > $result = mysql_query($query); > $result2 = mysql_query($query2); > > while($details = mysql_fetch_array($result) and $Email = > mysql_fetch_array($result2)) > { > echo "Name: $details[Name]"; > echo "Address: $details[Address]"; > echo "Email: $Email[EmailAddress]"; > } Unless I've missed something you're going about this the wrong way. For what you want to do, you should (in general) be able to accomplish it using just a single query. What fields do the tables 'users' and 'Members' contain? There should be a field there (like eg. userid) which links the two together. If there isn't one then you should seriously restructure your tables so that there is one. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Cats are smarter than dogs. You can't make eight cats pull a sled through the snow. */ -- 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] mysql_fetch_array() question
On Tuesday 05 November 2002 05:47, Graeme McLaren wrote: > Hi, Anyone know how I can use two mysql_fetch_array() functions similar > to the code below? I've tried a few different ways but I keep getting > Resource ID #4. I need to do this to retrieve an email address from one > table and retrieve details from another. > > Cheers for any tips - I'm stumped with this one, > > Graeme :) > > $query = "SELECT Name, Address FROM users"; > $query2 = "SELECT EmailAddress From Members"; > > $result = mysql_query($query); > $result2 = mysql_query($query2); > > while($details = mysql_fetch_array($result) and $Email = > mysql_fetch_array($result2)) > { > echo "Name: $details[Name]"; > echo "Address: $details[Address]"; > echo "Email: $Email[EmailAddress]"; > } Unless I've missed something you're going about this the wrong way. For what you want to do, you should (in general) be able to accomplish it using just a single query. What fields do the tables 'users' and 'Members' contain? There should be a field there (like eg. userid) which links the two together. If there isn't one then you should seriously restructure your tables so that there is one. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Cats are smarter than dogs. You can't make eight cats pull a sled through the snow. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] default-character-set problem
Hello there... I have a problem with sort order. I use greek and english characters. The manual says to put the following lines to my.cnf: [client] character-sets-dir=/usr/local/mysql/share/mysql/charsets default-character-set=greek i restart the demon but the problem still exist. I have 3.23.49 ver on Red Hat Linux 7.2 Thanx list