Re: [PHP-DB] Email confirmation?
Keep the context of the email in a variable, add the details of the product in each loop. Then you can call mail() with the complete order information. PS. Don´t you think it´s better to query the db only once asking the details for all the products ordered? Bruno Pereti. - Original Message - From: Boa Constructor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 2:01 PM Subject: [PHP-DB] Email confirmation? Greetings every1 I'm wondering how I can send the details of an order to an email address. I have a foreach loop which loops through an array and each time round the loop it runs a query on the database to get product details. If for instance they ordered 5 different items then I would need to loop 5 times to get all the product information. The way I see it, I can't make a call to the mail() function within the foreach loop as that would send out an email for each product ordered. Any ideas how to send all the order information all in one email? Cheers for any ideas, Graeme :) -- 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] SQL question!
Hi, I need a sql query to join multiple lines into only one line. Ok, I wouldn´t understand this question so I´ll give an example (I´m doing it on mysql but I need it to mssql). Supose I have 3 tables: mysql select * from test1; ++---+ | id| nome | ++---+ | 1| Bruno | | 2| Jorge | ++---+ mysql select * from test2; ++-+---+ | id| request | value | ++-+---+ | 1| 1 | 100,00 | | 1| 2 | Mercedes | | 2| 1 | 50,00| | 2| 3 | Sparc Sun | ++-+---+ mysql select * from test3; ++--+ | id| value| ++--+ | 1| money | | 2| car | | 3| computer | ++--+ test1.id - test2.id test3.id - test2.request When I execute: select test1.nome, test3.value, test2.value from test1, test2, test3 where test1.id = test2.id AND test2.request = test3.id I get: +---+--+---+ | nome| value | value | +---+--+---+ | Bruno | money | 100,00 | | Bruno | car | Mercedes | | Jorge | money | 50,00| | Jorge | computer | Sparc Sun | +---+--+---+ But I need this result: +---+--+---++ | nome| money | car| computer| +---+--+---++ | Bruno | 100,00 | Mercedes | NULL| | Jorge | 50,00 | NULL | Sparc Sun | +---+--+---++ Is it possible in Microsoft SQL Server? I´d like to know if it can be executed on mysql and, if not, if there is some way to do it in mysql. Sorry for the big e-mail but it´s something I really need to know. Thank´s Bruno Gimenes Pereti. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Replacing * with %
Hi Markus, I think you forgot to assign the value of ereg_replace to a variable. I made this test and it worked: ? $t = 'abc*cde*'; printf(%s\n, ereg_replace(\*, \%, $t)); // or $result = ereg_replace(\*, \%, $t); ? Hope it helps, Bruno Pereti. - Original Message - From: Markus Lervik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 7:40 AM Subject: [PHP-DB] Replacing * with % Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE string% in MySQL. I've tried ereg_replace(*,%,$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace(*,%,$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Re: MySQL/PHP and the case of Good Lord, that's a lot of statements
Uoh, It's a big one... Some thougths I had while reading your e-mail: - There is an option in php.ini where you can disable error messages (someone wrote to the list, it might be in the archive). And I found in my php.ini now the error_reporting option, maybe you could set it to E_ALL to see if it show any error. - I had the same problem writing squid log to mysql. It always died when find a line with http://www...com/file.cgi?option=+'bust'+ because it breaks the SQL. Probably this is not problem because you are echoing the SQL but it's worth to look at the last statement. - Another thing that don't see to be the problem is the memory limit because my squid log is very bigger than that and my memory_limit is the default 8M. (I'm running this script in the shell, not in the browser). - Does it die always in the same statement? I think that if it's a system limitation and you have any other thing running in you machine it won't die always the same way. If it does, I think it's a script or SQL problem. Just some ideas to help... good luck, Bruno Pereti. - Original Message - From: Tobyn Baugher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 12:22 PM Subject: Re: [PHP-DB] Re: MySQL/PHP and the case of Good Lord, that's a lot of statements On 1/15/2002 9:17 AM -0500 Hugh Bothwell wrote: How long does this take to run? Could it be timing out? Well, it's echo-ing each statement it's executing (added later to help debug), so from a connection standpoint I don't think it's timing out. None of the browsers seem to think it is, at the very least. The process itself has a 30-second CPU time limit imposed on it by the OS, and that is not a factor (it's dying at about 5 seconds). Toby -- Tobyn Baugher [EMAIL PROTECTED] http://www.cartoonviolence.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySQL table recovery.
Hello, Is there a way to rollback a 'delete from table;' command in MySQL 3.23.36-1? Yes I did it... I pressed enter instead of backspace. Did I lost my table content? I have no backup of this especific database. PS: I didn't close the connection with the database yet. Thank for any help, even if it's forget it, no way... Bruno. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] MySQL table recovery.
Hi Jon, Thank you. I don't even know how to work with transaction in mysql. No problem, just more work. It is a table that store all comments done in my site. It's also sent to my e-mail. Thank's again. Bruno. - Original Message - From: Jon Farmer [EMAIL PROTECTED] To: Bruno Gimenes Pereti [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED] Sent: Thursday, December 06, 2001 8:41 AM Subject: Re: [PHP-DB] MySQL table recovery. Is there a way to rollback a 'delete from table;' command in MySQL 3.23.36-1? Yes I did it... I pressed enter instead of backspace. Did I lost my table content? I have no backup of this especific database. PS: I didn't close the connection with the database yet. Thank for any help, even if it's forget it, no way... If this was a transaction then you can rollback if not then forget it Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key - Original Message - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Ms SQL.
Matt, I've never worked with mandrake. Does it have rpm? if yes try this, in a redhat I have php with mysql support I get this output: # rpm -qa | grep php php-4.0.4pl1-9 php-manual-4.0.4pl1-9 php-mysql-4.0.4pl1-9 probably there is a packet manager in mandrake, try it. I think this is getting off-topic, let's continue in pvt. When we get the solution you can send it back to the list. Bruno. - Original Message - From: Matt Lemon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 22, 2001 2:30 PM Subject: Re: [PHP-DB] Ms SQL. Bruno, I installed mandrake and the PHP support was built in so I guess that it's a recompile. How do I do that ? Matt Bruno Gimenes Pereti wrote: Hi matthew,Bruno Gimenes Pereti wrote: Hi matthew, you probably don't have the file php_mssql.so in your extension dir, do you? 2 options: - compile php with mssql support (might be ./configure --with-mssql ...) or - if you installed from packet (rpm for example) you can install the packet for mssql (it should be something like php_mssql.version.rpm) Bruno Gimenes Pereti. - Original Message - From: Matt Lemon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 22, 2001 3:08 PM Subject: [PHP-DB] Ms SQL. I'm trying to get my linux server to connect to an MS SQL server via php. If I run the same script on my windows laptop there is no problem but on the Linux server I get the message : Fatal error: Call to undefined function: mssql_connect() in /var/www/html/stationary/index.php on line 49 I edited /etc/php.ini and uncommented the line that loads the mssql module, it reads : extension = php_mssql.so Phpinfo() doesn't say that the SQL support is enabled and I still get the error. Please help ! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] you probably don't have the file php_mssql.so in your extension dir, do you? 2 options: - compile php with mssql support (might be ./configure --with-mssql ...) or - if you installed from packet (rpm for example) you can install the packet for mssql (it should be something like php_mssql.version.rpm) Bruno Gimenes Pereti. - Original Message - From: Matt Lemon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 22, 2001 3:08 PM Subject: [PHP-DB] Ms SQL. I'm trying to get my linux server to connect to an MS SQL server via php. If I run the same script on my windows laptop there is no problem but on the Linux server I get the message : Fatal error: Call to undefined function: mssql_connect() in /var/www/html/stationary/index.php on line 49 I edited /etc/php.ini and uncommented the line that loads the mssql module, it reads : extension = php_mssql.so Phpinfo() doesn't say that the SQL support is enabled and I still get the error. Please help ! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] image content in mail().
Hi, Who can I send an HTML e-mail with a image with mail()? Can PHP encode the image for me? Thank's Bruno. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Oracle via php under windows 2k
I don't use oracle with my windows php but in my extensions directory there is a php_oci8.dll. Do you have it? did you uncomment the line in your php.ini? If you installed your php from the installer, probably you don't have this file. download the zipped file from www.php.net and extract the extensions in your extensions_dir. If you were using it in linux you would need at last the oracle client installed locally, I don't know in windows. Hope I don't sad a lot of things you've done before. Bruno. - Original Message - From: titanesk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 14, 2001 6:07 PM Subject: [PHP-DB] Oracle via php under windows 2k Hello These are pretty basic questions, but I would appreciate help: I need to access Oracle (already running on a separate server) via PHP4/Apache from a windows system. 1) Can this be done? (It will be possible with php scripts but i've oci8 errors) 2) Where do I find instructions? 3) Where do I get php_oci8 ?? i need to rebuild php ? I would find php4 with oci8 extension ready yet ! :) Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Problem with include()
Try this way: in your php script: $foo = something; include(path/file.php); print $bar; in your file.php (included): globals $foo; $bar = $foo. working; I think this example will help... Bruno. - Original Message - From: TorrentUK [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 13, 2001 1:16 PM Subject: Re: [PHP-DB] Problem with include() According to the php manual it can pass args and values. The value I pass in through the $id then determines what poll is presented to the visitor (poll.php opens a file called $id.txt, which contains the poll's title, values, etc). So I set the id variable depending on where the poll script is invoked (i.e. what will the visitor be voting for at this point). I'm confused. I going to have to think of a work-around (sometimes known as a kludge :) ) Thanks -torrent -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] any extra work need to make php mysql function available?
uncomment the line that enables the extension in your php.ini: extension=mysql.so if it don't work verify the line extension_dir = /usr/lib/php4 and if the file mysql.so is in this directory. Bruno Gimenes Pereti. - Original Message - From: JIM [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 11:44 PM Subject: [PHP-DB] any extra work need to make php mysql function available? hi all, i am using redhat. i am able to run php script thro' webpage. but, failed to use mysql functions in php. is there any extra work need to initialize these functions? my code and error are shown as below, code ? echo text generated by php br\n; echo $rmnum; printf( b4 connected br\n); $link=mysql_pconnect(192.168.0.101, chaze, sochausee) or die (failed); mysql_select_db(stjohn); ? result text generated by php b4 connected Fatal error: Call to undefined function: mysql_pconnect() in /home/chaze/public_html/sjc/energy.php on line 7 any comments? thanks, jim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Variables in a loop
try form... input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. input name=a[] value=.. and for ($i=1; $i=10; $i++) { $tab[$i]=$a[$i] ;} This way $a will be a array. Hope it helps Bruno Gimenes Pereti. - Original Message - From: LeTortorec, Jean-Louis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 29, 2001 7:03 PM Subject: [PHP-DB] Variables in a loop I'm trying to write a loop to read variables I receive from a form: form ... input name=a1 value=.. input name=a2 value=.. input name=a3 value=.. input name=a4 value=.. I'd like to get something like: for ($i=1; $i=10; $i++) { $tab[$i]=a.$i ;} The expression a.$i is actually a string, not a variable. Any idea how to read the value of that string? Thanks for your help. Jean-Louis -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Hi Jason, What is the error message, in what line? I really can't find any error... Just one standarlization point: why do you use ( ) when printing BR and not in every other printing. For me, it's easyer to debug if every thing that do the same thing is writen the same way. Other thing out of the point. You could write all the line in one print command: print bTotal:/b $row['total']br; or print bTotal:/b . $row[total] .br; or (my favorite) ? bTotal/b ? print $row[total]; ?br; ? Please send the error message, O got curios.. (sorry I don't remember how to write it, I think I can understand what I mean :-) Bruno Gimenes Pereti. - Original Message - From: Jason [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 3:31 PM Subject: [PHP-DB] PHP query on date field Here is my problem once again... =P I am wondering if I should change the date table to something other than date... maybe something like date_1? Would doing that resolve my issue, because of the fact that the date variable in php is function? Thanks in advance... Jason [snip] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
What I use to do is to print the sql and try it in the command line to know it I'm constructing it correctly. $sql = select foo from bar...; print $sqlbr\n; ## add this line execute your script and copy the line to the mysql command line. If the result is what you expect it should be working. {Hope this helps} else {tell us}. Bruno Gimenes Pereti. - Original Message - From: Big Nickel [EMAIL PROTECTED] To: Bruno Gimenes Pereti [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 4:02 PM Subject: Re: [PHP-DB] PHP query on date field I apologize... there really isn't any error messages.. it just shows that there are no results to be displayed but when i telnet into the db there are plenty of dates that met my search criteria. I just need to know why it wont display the results... and I am thinking that because in php the date function is the same thing i am using for a variable... not sure if that is the problem but i am open to suggestions on it. Thanks again. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP query on date field
Hi again Jason, I think Jason Wong got the problem I missed, it's the date format. If you tested like I sad in the last mail you already found it. When you query: SELECT * FROM ads WHERE date = '%$date%'; you get an empty result. So, that's the solution... Bruno Gimenes Pereti. What is the format of date as defined in your database? If date is of type DATE or DATETIME then $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date LIKE '%$date%'); should be changed to: $result = mysql_query (SELECT * FROM ads WHERE fname LIKE '%$fname%' AND lname LIKE '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE '%$phone%' AND date = '$date' ); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] getting results from INSERT
I think you want this. $sql = INSERT INTO table (cod, nome, email) VALUES ('', '$nome', '$email'); $result = mysql_query($sql); $cod = mysql_insert_id(); The $cod is the primery key. Hope it helps. Bruno Gimenes Pereti. - Original Message - From: Matt Stewart [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 26, 2001 9:57 AM Subject: [PHP-DB] getting results from INSERT What i'm after is getting the primary key for a record that's just been added - I have an image file upload accompanying a database addition, and the image gets renamed $unique_ID.jpeg only problem is that the current method inserts the information, which auto produces the primary key, but the only way i know to extract that is by doing a SELECT, searching for all the matching values to the ones just entered, and if two entries are the same(except for the primary key - which is unknown), the image will replace the earlier entry, rather than the one i actually want it to be for. Is there a way of returning this primary key immediately after that record is created? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] PHP Paradox.
Hi, Yesterday I posted a question about PHP and Paradox. I'd apreciate any comment, sugestion, link... anything. I'm a linux user trying to hadle with a W2k and ODBC. I found nothing related to this problem in the net. Here is the error message: Warning: SQL error: [Microsoft][Driver ODBC para Paradox] Não foi possível abrir PARADOX.NET., SQL state S1000 in SQLConnect in c:\inetpub\wwwroot\odbc.php on line 2 Please, I'm desperate. Thank's. Bruno Gimenes Pereti. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] array-problems
It looks like you need only one array, $date[begin] = $date[end]. Let's see, I think it'll work. I'll write it in your code then you try: $i=0; $result = mysql_query (SELECT DISTINCT date FROM linktracker WHERE name LIKE '$PHP_AUTH_USER' ORDER BY date); if ($row = mysql_fetch_array($result)) { do { $date[$i] = $row[date]); $i++; } while ($row = mysql_fetch_array($result)); } else {print (Sorry, no record were found.); } file://end else $result print(tabletrtdBegindate/tdtdEnddate/td/tr\n. trtdform method=\post\ action=\index.php\ name=\date_select\. input type=\hidden\ name=\action\ value=\date_select\. select name=\date_begin\); $i = 0; while ($date[$i]) { echo option value=\.$date_begin .\ . $date_begin . /option\n; $i++; } print(/select/tdtdselect name=\date_end\); $i--; while ($date[$i]) { echo option value=\.$date_end .\ . $date_end . /option\n; $i--; } print(/select/td/tr\ntrtd colspan=\2\. input type=\submit\ name=\Submit\ value=\Submit\. /form/td/tr/table); mysql_free_result ($result); mysql_close(); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]