Re: [PHP-DB] Access db
Thanks Michael. I'll check it out ;) - Luke Michael Mauch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Luke Van Blerk wrote: I'll probably just extract the data with an access to mysql script and run it on mysql. This is probably the best approach if you have access to Windows machine. If not, http://freshmeat.net/projects/mdbtools/ might help. Regards... Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Subject: Strange bahavior with mysql_fetch_array($result)
If $result is returning a resource ID, this is because you have also used $result in the mysql_connect call. You have probably also turned off error_reporting in your script, as it should throw an error for the 'if (! mysql_fetch_array...' line. The correct check is 'if (mysql_num_rows()==0)' which will catch any no-results set even if your query is broken and not returningn any resiults. What is the contents of your query - print it out into the page. Now, put it into phpMyAdmin as a query - does it return any results ? Hope that helps - Neil. At 01:57 21/11/2003 +, you wrote: Message-ID: [EMAIL PROTECTED] From: Evan Panagiotopoulos [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Thu, 20 Nov 2003 20:54:26 -0500 MIME-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Subject: Strange bahavior with mysql_fetch_array($result) I am searching a table and have the following php code with my comments: $result = mysql_query($query); print The result == $result; // it returns The result == Resource id #2 if (!mysql_fetch_array($result)) { ... } else { while ($row = mysql_fetch_array($result)) { ... } } Neither the if nor the while get executed. Can you make any suggestions? Obviously I'm new to this. Evan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] debugging / help required urgently.
Hi, I have a MAJOR problem with PHP mail() function, one that is odd and very frustrating as I have no idea what is causing it. I have used the one script to send emails out in the past and they have been sucessfully sent out, but as of a few days ago and now they are bouncing, some are actually being sent and some just simply won't go out. So let me explain. I have an admin area of my site where I have all users in a mysql database. Their email address, names, address, etc. The admin side allows me to do many tasks like send out text-based emails via PHP mail() function and HTML emails. What it does is I type in the field boxes and saves to a mysql table, than I run a cronjob to grab the email data and email addresses and send out using PHP mail(). The script worked fine in the past, no problems but now I get the following message when I attempt to send emails: --- This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: [EMAIL PROTECTED] unrouteable mail domain cashgrace.com --- But that's not all, it comes up as that for all domains, like yahoo.com, hotmail.com, bigpond.com etc... All of them, even though they are reachable via webmail. I can go into webmail via CPANEL and send emails and they actually go to the person, so does not seem like a mail server problem or does it? I beleive, but could be wrong, it is somewhere in the mail() function on the root part of the server. But of course I don't have access to it. But the weird thing is this... Some emails 1/10 do actually get sent and delivered, do not bounce, but the other 9 fail. Why? Well I did some more investigating... Well for what I have access to. The Server Load for the Server was flashing RED in the Server Status area. So I persume this is bad? Maybe due to this maybe it's attempting to send emails but looping and not got enough resources to actually do the job and in the end gives up and produces the bounced email? As I said before I could be way off track but worth suggesting and trying to figure it out. Is there a way to DEBUG my mail() function I call in the cronjob? The joy of the CRONJOB is that it's written in PHP also, so I can view it on a webpage. So if there is a way to DEBUG it I should see where the error is? Or won't I? Any suggestions? I've looked long and hard, emailed my admin and they are optimistic with the problem also so thought I'd post here and see what can be done and if we can get some outside help. As I said before the script for the mail() has NEVER been changed. So it can't be my code as it has worked in the past. Must be server side somewhere... Unless my admin has done an update and something has gone wrong. But I thought someone on here would know what could cause the error, at least we can investigate it instead of having no idea what is causing the problem. All the help is needed here if people can provide it. Thanks in advance, and sorry for the long email. But this problem is really giving me the 'you know what' now. Jerry http://personals.yahoo.com.au - Yahoo! Personals New people, new possibilities. FREE for a limited time. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: debugging / help required urgently.
Not exactly your answer, but I remember having same problems one time. I switched and started using phpmailer, http://phpmailer.sourceforge.net/ This has in the past never given me problems, 1 time I had problems on the server using the php functions, but phpmailer even has SMTP support. Just alter 1 line and everything is online again. mail() function may be more than good enough, but you might want to check out the phpmailer which is quite awesome! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Jerry [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have a MAJOR problem with PHP mail() function, one that is odd and very frustrating as I have no idea what is causing it. I have used the one script to send emails out in the past and they have been sucessfully sent out, but as of a few days ago and now they are bouncing, some are actually being sent and some just simply won't go out. So let me explain. I have an admin area of my site where I have all users in a mysql database. Their email address, names, address, etc. The admin side allows me to do many tasks like send out text-based emails via PHP mail() function and HTML emails. What it does is I type in the field boxes and saves to a mysql table, than I run a cronjob to grab the email data and email addresses and send out using PHP mail(). The script worked fine in the past, no problems but now I get the following message when I attempt to send emails: --- This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: [EMAIL PROTECTED] unrouteable mail domain cashgrace.com --- But that's not all, it comes up as that for all domains, like yahoo.com, hotmail.com, bigpond.com etc... All of them, even though they are reachable via webmail. I can go into webmail via CPANEL and send emails and they actually go to the person, so does not seem like a mail server problem or does it? I beleive, but could be wrong, it is somewhere in the mail() function on the root part of the server. But of course I don't have access to it. But the weird thing is this... Some emails 1/10 do actually get sent and delivered, do not bounce, but the other 9 fail. Why? Well I did some more investigating... Well for what I have access to. The Server Load for the Server was flashing RED in the Server Status area. So I persume this is bad? Maybe due to this maybe it's attempting to send emails but looping and not got enough resources to actually do the job and in the end gives up and produces the bounced email? As I said before I could be way off track but worth suggesting and trying to figure it out. Is there a way to DEBUG my mail() function I call in the cronjob? The joy of the CRONJOB is that it's written in PHP also, so I can view it on a webpage. So if there is a way to DEBUG it I should see where the error is? Or won't I? Any suggestions? I've looked long and hard, emailed my admin and they are optimistic with the problem also so thought I'd post here and see what can be done and if we can get some outside help. As I said before the script for the mail() has NEVER been changed. So it can't be my code as it has worked in the past. Must be server side somewhere... Unless my admin has done an update and something has gone wrong. But I thought someone on here would know what could cause the error, at least we can investigate it instead of having no idea what is causing the problem. All the help is needed here if people can provide it. Thanks in advance, and sorry for the long email. But this problem is really giving me the 'you know what' now. Jerry http://personals.yahoo.com.au - Yahoo! Personals New people, new possibilities. FREE for a limited time. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Unsure of how to perform query and results..
Hi John, Thanks for taking the time to respond. What am I trying to do? Well...I am trying to build a mailing list of previous customers WHO purchased product_id 1 but not product_id 14. I have the product items (id's) stored in the CartTable and I have customer info stored in the OrderTable. Using the same column of cart_id in both CartTable and OrderTable I am able to reference which cart items (id's) belong to each record in the OrderTable. What I did originally (that didn't work) was to select all records in the CartTable that matched product_id=1 and product_id!=14 then I used that information to reference against the OrderTable to grab the customer information I needed. The problem with my logic is that I did not take into account those who purchased one of the product_id's on ONE purchase and then came back the next day, week, year, etc and made another purchase for the other product_id which. I NEED to make sure that a customer HAS purchased product_id=1 and NOT product_id=14 at ANY time, regardless of a single or multiple orders. Does this make any sense? *sigh* Thanks again. Aaron -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: November 20, 2003 4:34 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Unsure of how to perform query and results.. From: Aaron Wolski [EMAIL PROTECTED] I have data in a Db that looks something like: 14,[EMAIL PROTECTED],Andrew,Smith 1,[EMAIL PROTECTED],Andrew,Smith 14,[EMAIL PROTECTED],Barbara,Richardson 1,[EMAIL PROTECTED],Barbara,Richardson The number represents a product_id that was purchased by the customer in question. As you can see from this example.. I have a two customers who purchased two different products. What I NEED to do is have one entry for each customer but with both their product_id in the same result. For example: 14,1,[EMAIL PROTECTED],Andrew,Smith ANY clue how I could go about getting this to work? I'm very desperate and running out of time :-( Sorry, it's not going to happen and besides, there isn't any reason you should need to return a row like that. How about you tell us what you're actually trying to do and someone can help you clean up your method... ---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] nested sets?
Chapter 28 (or 29) in Joe Celko's SQL for Smarites. The chapter on nested sets alone is worth the price of the book. At the very end of the chapter (after taking you through the details of a nested set) he gives a very simple and easy to implement solution for nested sets. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. ma wrote: hi everybody! i try to make a clickable menu. it should be outputed as XML. i found a solution to make it possible to decend only the selected menues. but is there a easier solution? my goal is to first show only the first (level=0) level. if the user clicks on the menu it should select the second (level=1) level, but only from the menu he clicked. (so HAVING level=1 doesn't help :( ) does anybody know a solution or a good reference for nested sets? (don't have the possibility to use pear - unfortunately cause there are some great tools) here's my db-structure: id (int) unsigned auto_increment left (int) unsigned right (int) unsigned level (int) unsigned (default: 0) title (varchar) link (varchar) menu (int) unsigned (default: 0) heres my solution (using singleton registry pattern and a sql-class working with adodb-functions): ### $reg = registry::instance(); $sql = $reg::getEntry('sql'); # $_GET['menu'] = 'About/Company/History' // - something like this $qry ='SELECT `first`.`left`, `first`.`id`, `first`.`link`, `first`.`title`, `first`.`level`, ROUND((`first`.`right`-`first`.`left`-1)/2) AS `children` FROM `'.$grz-cnf['tablePluginPrefix'].'menu` AS `first`, `'.$grz-cnf['tablePluginPrefix'].'menu` AS `second` '; $open = array(); if(isset($_GET['menu'])) { $open = explode(';', $_GET['menu']); $or = join(' OR `third`.`id`=', $open); $qry .=',`'.$grz-cnf['tablePluginPrefix'].'menu` AS `third` WHERE (`first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`left` BETWEEN `third`.`left` AND `third`.`right` AND `first`.`level`=`third`.`level`+1 AND (`third`.`id`='.$or.')) OR (`first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`level`=0) '; } else { $qry .='WHERE `first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`level`=0 '; } $qry .='AND `first`.`menu`='.$menuID.' GROUP BY `first`.`left` ORDER BY `first`.`left` '; $res = $sql-query($qry); ### thx a lot for taking your time, help would be warmly appretiated... -ma # life would be easier if i knew the source code... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] nested sets?
hi! thx for the answer! in fact i'm just searching for a query to desend a defined path in the structure, but left others alone. e.g. path: about/company structure: about company history today employees intern extern products ... should end in about company history today employees products i think of buying the book. its better to have a good reference. thx -ma # life would be easier if i knew the source code... Von: Cal Evans [EMAIL PROTECTED] Datum: Fri, 21 Nov 2003 11:24:52 -0600 An: ma [EMAIL PROTECTED] Cc: PHP-DB [EMAIL PROTECTED] Betreff: Re: [PHP-DB] nested sets? Chapter 28 (or 29) in Joe Celko's SQL for Smarites. The chapter on nested sets alone is worth the price of the book. At the very end of the chapter (after taking you through the details of a nested set) he gives a very simple and easy to implement solution for nested sets. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. ma wrote: hi everybody! i try to make a clickable menu. it should be outputed as XML. i found a solution to make it possible to decend only the selected menues. but is there a easier solution? my goal is to first show only the first (level=0) level. if the user clicks on the menu it should select the second (level=1) level, but only from the menu he clicked. (so HAVING level=1 doesn't help :( ) does anybody know a solution or a good reference for nested sets? (don't have the possibility to use pear - unfortunately cause there are some great tools) here's my db-structure: id (int) unsigned auto_increment left (int) unsigned right (int) unsigned level (int) unsigned (default: 0) title (varchar) link (varchar) menu (int) unsigned (default: 0) heres my solution (using singleton registry pattern and a sql-class working with adodb-functions): ### $reg = registry::instance(); $sql = $reg::getEntry('sql'); # $_GET['menu'] = 'About/Company/History' // - something like this $qry ='SELECT `first`.`left`, `first`.`id`, `first`.`link`, `first`.`title`, `first`.`level`, ROUND((`first`.`right`-`first`.`left`-1)/2) AS `children` FROM `'.$grz-cnf['tablePluginPrefix'].'menu` AS `first`, `'.$grz-cnf['tablePluginPrefix'].'menu` AS `second` '; $open = array(); if(isset($_GET['menu'])) { $open = explode(';', $_GET['menu']); $or = join(' OR `third`.`id`=', $open); $qry .=',`'.$grz-cnf['tablePluginPrefix'].'menu` AS `third` WHERE (`first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`left` BETWEEN `third`.`left` AND `third`.`right` AND `first`.`level`=`third`.`level`+1 AND (`third`.`id`='.$or.')) OR (`first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`level`=0) '; } else { $qry .='WHERE `first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`level`=0 '; } $qry .='AND `first`.`menu`='.$menuID.' GROUP BY `first`.`left` ORDER BY `first`.`left` '; $res = $sql-query($qry); ### thx a lot for taking your time, help would be warmly appretiated... -ma # life would be easier if i knew the source code... -- 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] Informix function
Hi, I have a problem with PHP ifx_num_rows function. Once is executed after a ifx_query function it always returns 0 value (even the ifx_query return a couple of rows). I know that is a PHP bug (I have a php4.1.1 version), but, how can I do to solve this bug in a standard way? Without use select count(*) query. Thanks in advance Juan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: nested sets?
Hello, On 11/20/2003 12:28 PM, Ma wrote: i try to make a clickable menu. it should be outputed as XML. i found a solution to make it possible to decend only the selected menues. but is there a easier solution? my goal is to first show only the first (level=0) level. if the user clicks on the menu it should select the second (level=1) level, but only from the menu he clicked. (so HAVING level=1 doesn't help :( ) does anybody know a solution or a good reference for nested sets? You may want to try the famous Joe Celko's approach that he described in this book: Book review: SQL for Smarties http://www.phpclasses.org/products.html/id/1558605762.html If you do not want to reinvent the wheel, you may want to try this implementation: Class: Joe Celko Nested Sets http://www.phpclasses.org/celkonestedset -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php apache freetds install difficulty
Wes Forster wrote: snip If I compile and install php without the freetds sybase support it all works fine. Its just when I introduce those variables that I run into trouble. /snip Wes, unfortunately I don't have an answer on your Apache problem because I'm still new at this too. I didn't think I needed to recompile Apache. Do I need to do this? You say you compiled PHP successfully. I have Red Hat 9 Linux and it comes with PHP 4.2.2. I want to learn how to recompile PHP with the mssql extension added in but I don't know how to properly do this. Can you share that information? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How To Recompile For FreeTDS + MS SQL Support?
I have RedHat 9 and FreeTDS. I used tsql to test FreeTDS and it works great, connecting to my remote SQL 6.5, 7, and 2K servers, accessing pubs.authors. Now I want to connect PHP to it. I seem to be doing something wrong. RH9 ships with 4.2.2, so I went hunting for the file and got php-4.2.2.tar.gz. I expanded this and then followed advice from aissam at yahoo dot com instructions for configuration... http://www.php.net/manual/en/function.mssql-connect.php ...but it wouldn't generate a make file and I got stuck. Do you have any idea where I should go from here? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: MSSQL, PHP, Linux, and FreeTDS???
Tim Nields wrote: Can someone please give me any kind of advice on what it is I need to do in order to configure a Linux box to talk to a MSSQL 2000 box. I have found various sets of directions, none of which resemble each other, and none of which work. I would greatly appreciate if any one could lend me a hand with configuration information in this regard. Thanks in advance, Tim Nields Tim, when you find out, let me know. I've been posting comp.lang.php under the pseudonym of [EMAIL PROTECTED] (see on groups.google.com) this very question, and I've posted all the knowledge that I have so far. Have you setup FreeTDS and tested out its tsql command yet? I've posted a howto on that on comp.lang.php. Now I'm stuck on the recompilation part, and I want to do it right, not screwing up my PHP 4.2.2 install that ships so nicely with Red Hat 9. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How To Recompile For FreeTDS + MS SQL Support?
Hi, When you have the PHP sources extracted from the tar-ball you can use configure --with-mssql,shared make Then you can copy the mssql.so file to your current php installations extension dir and either load the extension form php.ini or with the dl() function. This way tou don't have to recompile any of your existing modules or apache. - Frank I have RedHat 9 and FreeTDS. I used tsql to test FreeTDS and it works great, connecting to my remote SQL 6.5, 7, and 2K servers, accessing pubs.authors. Now I want to connect PHP to it. I seem to be doing something wrong. RH9 ships with 4.2.2, so I went hunting for the file and got php-4.2.2.tar.gz. I expanded this and then followed advice from aissam at yahoo dot com instructions for configuration... http://www.php.net/manual/en/function.mssql-connect.php ...but it wouldn't generate a make file and I got stuck. Do you have any idea where I should go from here? -- 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