RE: [PHP-DB] group by day (unix timestamp provided)
How can I get mySQL to group stuff by the day? my date coloumn is a UNIX timestamp. SELECT whatever FROM my_table GROUP BY FROM_UNIXTIME(timestamp_col, '%Y-%m-%d') Regards Joakim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] From address in mail() header not working - ideas?
Hi Guys, I did try that but I will try it again. Also, I have echo'd the data and it does appear as I expect. Any other thoughts while I try this? Don't know if this has anything to do with your problem, but $headers = Return-Path: $support_email\r\n; should be $headers .= Return-Path: $support_email\r\n; I'm also courious if this is correct: $headers .= Content-disposition: attachment; filename=\$attach_name\\n\r\n; Look at the end and you see \n\r\n. Shouldn't it be just \r\n? And as others already have suggested, move the From-part up a bit... Also you should try to echo $headers and see if it is what you expect. Regards Joakim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Millions of records in MySQL
Hiya, I remember ages ago that mysql does not properly handle upwards of 10 million records in a table? Any details would be great! Thanks, Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Millions of records in MySQL
On Friday 25 October 2002 16:10, Steve Vernon wrote: Hiya, I remember ages ago that mysql does not properly handle upwards of 10 million records in a table? Any details would be great! Try it, or ask on the mysql list? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* You boys lookin' for trouble? Sure. Whaddya got? -- Marlon Brando, The Wild Ones */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Millions of records in MySQL
I remember ages ago that mysql does not properly handle upwards of 10 million records in a table? What's this got to do with PHP? And yes, MySQL will handle it, depending on what you're doing with the data. There are always alternatives, though. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fw: array transfer via form.
yes i did, and it creates a the access.temp2.txt file but it only contains the last array... - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 25, 2002 6:40 PM Subject: Re: [PHP-DB] Fw: array transfer via form. On Friday 25 October 2002 10:40, Garry Climacosa wrote: 6. heres the action page check_act.php ?php $file2write = fopen(/var/lib/data/access.temp2.txt, w); $write2line = $myline\n; $filewrite = fwrite($file2write, $write2line); ? The first thing to check -- did you echo $myline (or $write2line) to see whether it contains what you had expected it to contain? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* It's not the fall that kills you, it's the landing. */ -- 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] Millions of records in MySQL
Go to www.mysql.com and join their's general list. it's address is [EMAIL PROTECTED] Andrey - Original Message - From: Steve Vernon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 25, 2002 2:15 PM Subject: Re: [PHP-DB] Millions of records in MySQL Which is the MySQL list you are talking about please? Thanks, Steve On Friday 25 October 2002 16:10, Steve Vernon wrote: Hiya, I remember ages ago that mysql does not properly handle upwards of 10 million records in a table? Any details would be great! Try it, or ask on the mysql list? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* You boys lookin' for trouble? Sure. Whaddya got? -- Marlon Brando, The Wild Ones */ -- 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] What is OCINewCollection() for?
Hello, friends. I am working with PHP+ORACLE project. I need there to request a procedure with pl/sql table parameter. e.g. something like: TYPE tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; I had found OCINewCollection() function in manual. Unfrortunatly this function description is only comming soon. Does any one know what this function ir realy for and how do I use it? -- Regards, A.K. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] TOO MANY CONNECTIONS!!
You can also do something like this: if ($db_link = mysql_pconnect($host, $user, $pass)) { if (mysql_select_db($db,$db_link)) { return $db_link; } else die(MySQL Error: Cannot select {$db} database using {$user}@{$host}: .mysql_error()); } else die(MySQL Error: Cannot connect to {$db}: .mysql_error()); make $db_link global (if you use this in a function) then you can know that you are connected if your script is still running. If you make two connections, just make db_link something different for the other connection, and do this: $x = mysql_query(Select * from users,$db_link); That will force PHP to use the $db_link specified instead of the last opened connection. Peter On Fri, 25 Oct 2002, dr. Agon wrote: Helo, why you don't make some kind of db_connect.php which will make mysql_pconnect() and include it in top of your first script? You then will be able use mysql query in everyone of your page. You can also make $mysql_is_connected=true; there and check that variable in other scrips if need to be sure that this file was already included. -- Regards, A.K. Georgie Casey [EMAIL PROTECTED] wrote in message news:20021024201835.36082.qmail;pb1.pair.com... Yeah, sometimes I open and close 2 or 3 permanent connections in one page. I knida have to as each page is made up of a few different include files, and if I dont do seperate connections, it mightnt work. I'll recode my site to cache everything except search pages, or can I even cache these as well?? Duncan Hill [EMAIL PROTECTED] wrote in message news:20021023222841.GD30375;bajan.cricalix.net... On Wed, Oct 23, 2002 at 10:18:07PM +0100, Georgie Casey wrote: Im getting a too many connections error in my PHP pages at http://www.free-ringtones.tv. I presume this is from the MySQL server, and I know I access the database a lot for each page. So whats the solution to MySQL has a default of either 50 or 100 concurrent connections. Exceed it and you'll get that error. That parameter is configurable - if you run the MySQL daemon itself. If you use shared hosting, you may not be able to tweak it. Do the pages -need- to be totally dynamic, or can you use the caching system you mentioned? If so, then wrap code that stats an HTML page for the time, and if it's too old, update it. Be sure to use file locking so you don't clobber yourself. Moreover, do you open one connection and re-use it in a page, or do you do multiple opens and closes? -- 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-DB] PHP and MS-SQL
I want to apologize for my ignorance in advance... I'm developing PHP code with MySQL on Unix platforms for quite a while. Now I'm asked to use my unix based PHP code with a MS-SQL database on a Microsoft platform. So while having the php code on a unix platform the MS-SQL database is obviously sitting on a Microsoft platform. Can this work and if so how can I do this? Thanks, Axel __ Axel Bergmann ICQ#: 114599496 Current ICQ status: + More ways to contact me __ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and MS-SQL
yes this works. if your code is going to remian on Unix you'll have to install freetds (www.freetds.org). there are instructions on www.php.net/mssql for install in the comments... when you get to the site(freetds.org) I know it says Sysbase..but it is what you're looking for. hope this helps jd Axel [EMAIL PROTECTED] To: [EMAIL PROTECTED] et cc: Subject: [PHP-DB] PHP and MS-SQL 10/25/2002 09:57 AM I want to apologize for my ignorance in advance... I'm developing PHP code with MySQL on Unix platforms for quite a while. Now I'm asked to use my unix based PHP code with a MS-SQL database on a Microsoft platform. So while having the php code on a unix platform the MS-SQL database is obviously sitting on a Microsoft platform. Can this work and if so how can I do this? Thanks, Axel __ Axel Bergmann ICQ#: 114599496 Current ICQ status: + More ways to contact me __ -- 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] PHP and MS-SQL
Great, thanks a bunch! -Original Message- From: [EMAIL PROTECTED] [mailto:Jeffrey_N_Dyke;Keane.com] Sent: Friday, October 25, 2002 3:11 PM To: Axel Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP and MS-SQL yes this works. if your code is going to remian on Unix you'll have to install freetds (www.freetds.org). there are instructions on www.php.net/mssql for install in the comments... when you get to the site(freetds.org) I know it says Sysbase..but it is what you're looking for. hope this helps jd Axel [EMAIL PROTECTED] To: [EMAIL PROTECTED] et cc: Subject: [PHP-DB] PHP and MS-SQL 10/25/2002 09:57 AM I want to apologize for my ignorance in advance... I'm developing PHP code with MySQL on Unix platforms for quite a while. Now I'm asked to use my unix based PHP code with a MS-SQL database on a Microsoft platform. So while having the php code on a unix platform the MS-SQL database is obviously sitting on a Microsoft platform. Can this work and if so how can I do this? Thanks, Axel __ Axel Bergmann ICQ#: 114599496 Current ICQ status: + More ways to contact me __ -- 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 statement
What's the error? -Original Message- From: Steve Dodkins [mailto:Steve.Dodkins;ebm-ziehl.co.uk] Sent: 25 October 2002 16:46 To: Php-Db (E-mail) Subject: [PHP-DB] select statement Hi I get an error message with the following statement, if I remove the 'AND works_order_part_no=parts_parts_no' I don't get an error message but also get the wrong data ?? $link = mysql_connect($host, $user, $pass); mysql_select_db(DB_EDMsystem, $link); $result = mysql_query(SELECT * FROM labor, works_orders, parts where labor_ord_no = works_orders_ord_no AND works_order_part_no = parts_parts_no,$link); echo TABLE BORDER=2; echoTRTDBWorks Order/BTDBPart Number/BTDBOrder Qty/BTDBMade Qty/BTDBOptionsTRTD; while($myrow = mysql_fetch_array($result)) Regards Steve Dodkins IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This message has been checked for all known viruses by the MessageLabs Virus Control Centre. This message has been checked for all known viruses by the MessageLabs Virus Control Centre. * Notice: This email is confidential and may contain copyright material of Ocado Limited (the Company). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY * -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP and MySQL form problem - Undifined variables
First time playing with PHP, Apache, and MySQL. I have a simple form error and I don't know how to solve it. I was doing the Webmonkey PHP/MySQL tutorial and when I started using forms with $PHP_SELF I started getting errors with variables not defined. PHP 4.2.3 MySQL 4.0 Windows 2000 Apache 1.3.27 (Since I was not able to get 2.0 working on Windows 2K Pro) My code is: //-- START OF CODE -- htmlbody?php $db = mysql_connect(localhost, root); mysql_select_db(mydb,$db); $result = mysql_query(SELECT * FROM employees,$db); if ($myrow = mysql_fetch_array($result)) { do { printf( a href=\%s?id=%s\%s %s/abr\n, $PHP_SELF, $myrow[id], $myrow[first], $myrow[last] ); } while ($myrow = mysql_fetch_array($result)); } else { echo Sorry, no records were found!; } ? /body/html //-- END OF CODE --- My ERROR is: Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 Bob Smith Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 John Roberts Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 Brad Johnson Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 Mar f --- END OF ERROR I am able to connect to the MySQL DB and retrieve info, but I don't get the error. I changed the REGISTER_GLOBALS of the php.ini file to ON and I still get the variables error. I also added $_POST as stated in another form issue but it did not resolve my problem. It must be simple but I don't know enough to identify the issue. Thanks for any help or input. Mario [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Inserting checkbox data
Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub
Re: [PHP-DB] Inserting checkbox data
Graeme, first, extend the for loop over the if and the query for insertion of data. As you have it now, it just inserts the last element of the array. second, I think that the for loop should be $a$number. if you put =, then the loop is processing the array with the last value not assigned by you (an extra element in the array). Hope it helps. Mihai On Fri, 25 Oct 2002, Graeme McLaren wrote: Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Inserting checkbox data
In addition to what Mihail had to say, I saw a couple of minor things as well. I'm not sure if they're the cause of or solution to the problem you're experiencing. First, I'm pretty sure that a value of value=\Y\ is not valid HTML. I don't know what it does to your name/value pair when you POST the data from the page, but I'm pretty sure it's invalid HTML. HTML wants value=Y; it doesn't like the slashes. Second, I noticed you're missing a comma in your SQL statement between $LastName and $Username. That would probably cause your SQL statement to error out. Just my two cents. -Original Message- From: Graeme McLaren [mailto:mickel;ntlworld.com] Sent: Friday, October 25, 2002 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Inserting checkbox data Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] URGET HELP : Logic Help - for first record do_this for each record after do_that
Hey guys, Not really off topic as this involves some Db work as I have to query the DB. Got a logic problem that was jumped dumped on me from UPS (dummys!). Basically I need to pull some records out of a database and for the first record do_this logic and for each record after in the array do_something_else logic. How would I approach this? something like: for ($first_record) { do_something; } else { do_something_else; } Any clues? Thanks! Aaron -Original Message- From: Graeme McLaren [mailto:mickel;ntlworld.com] Sent: Friday, October 25, 2002 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Inserting checkbox data Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] URGET HELP : Logic Help - for first record do_thisfor each record after do_that
on 10/25/02 2:53 PM, Aaron Wolski at [EMAIL PROTECTED] appended the following bits to my mbox: Basically I need to pull some records out of a database and for the first record do_this logic and for each record after in the array do_something_else logic. Psuedo code: $first_record = 'yes'; while (result = something) { if ($first_record == 'yes') { do_something(); $first_record == 'no'; } else { do_something_else(); } } HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] URGET HELP : Logic Help - for first record do_this foreach record after do_that
$x = 1; while($row = mysql_fetch_array($result)) { if ($x) { do_something(); $x = 0; continue; } else { do_something_else(); } } This sets $x = 1 before the loop. The first time it goes through the loop it does something for the first record and sets $x = 0; Every time you loop through after that $x will equal 0 and that do_something_else() condition will be used for every subsequent loop. Peter On Fri, 25 Oct 2002, Aaron Wolski wrote: Hey guys, Not really off topic as this involves some Db work as I have to query the DB. Got a logic problem that was jumped dumped on me from UPS (dummys!). Basically I need to pull some records out of a database and for the first record do_this logic and for each record after in the array do_something_else logic. How would I approach this? something like: for ($first_record) { do_something; } else { do_something_else; } Any clues? Thanks! Aaron -Original Message- From: Graeme McLaren [mailto:mickel;ntlworld.com] Sent: Friday, October 25, 2002 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Inserting checkbox data Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- 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] URGET HELP : Logic Help - for first record do_this for each record after do_that
What about wrapping your logic in a counter? Set $count=1, if($count=1){do_this; then $count++;} else{do_that}. Wouldn't really add any overhead to your script since the counter only gets incremented once when the if() statement is true then stays at 2 and executes the else{} stuff after that. Pretty stupid solution and maybe not the most elegant, but you DID say URGENT. I just read Paul's post. This is pretty similar. -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, October 25, 2002 2:54 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] URGET HELP : Logic Help - for first record do_this for each record after do_that Hey guys, Not really off topic as this involves some Db work as I have to query the DB. Got a logic problem that was jumped dumped on me from UPS (dummys!). Basically I need to pull some records out of a database and for the first record do_this logic and for each record after in the array do_something_else logic. How would I approach this? something like: for ($first_record) { do_something; } else { do_something_else; } Any clues? Thanks! Aaron -Original Message- From: Graeme McLaren [mailto:mickel;ntlworld.com] Sent: Friday, October 25, 2002 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Inserting checkbox data Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- 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] URGET HELP : Logic Help - for first record do_this for eachrecord after do_that
I'm sure there are a hundred ways $rs = 0; // record set array for ($i = 0; $i count($rs); ) { while($rs = mysql_fetch_array($result)) { if ($i ==0 ) { //do first thing } else { //do other things } $i++ } Jeff Aaron Wolski aaronjw@marte To: [EMAIL PROTECTED] kbiz.comcc: Subject: [PHP-DB] URGET HELP : Logic Help - for first record do_this 10/25/2002for each record after do_that 02:53 PM Please respond to aaronjw Hey guys, Not really off topic as this involves some Db work as I have to query the DB. Got a logic problem that was jumped dumped on me from UPS (dummys!). Basically I need to pull some records out of a database and for the first record do_this logic and for each record after in the array do_something_else logic. How would I approach this? something like: for ($first_record) { do_something; } else { do_something_else; } Any clues? Thanks! Aaron -Original Message- From: Graeme McLaren [mailto:mickel;ntlworld.com] Sent: Friday, October 25, 2002 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Inserting checkbox data Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- 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] URGET HELP : Logic Help - for first record do_this f oreach record after do_that
Why not use the for loop to post the values? for ($i=0; $i$num_rows, $i++) { if ($i==0) { bla bla } else { bla2 bla2 } } $i=0 ensures that the first record of his query is retrieved. On Fri, 25 Oct 2002, Hutchins, Richard wrote: What about wrapping your logic in a counter? Set $count=1, if($count=1){do_this; then $count++;} else{do_that}. Wouldn't really add any overhead to your script since the counter only gets incremented once when the if() statement is true then stays at 2 and executes the else{} stuff after that. Pretty stupid solution and maybe not the most elegant, but you DID say URGENT. I just read Paul's post. This is pretty similar. -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, October 25, 2002 2:54 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] URGET HELP : Logic Help - for first record do_this for each record after do_that Hey guys, Not really off topic as this involves some Db work as I have to query the DB. Got a logic problem that was jumped dumped on me from UPS (dummys!). Basically I need to pull some records out of a database and for the first record do_this logic and for each record after in the array do_something_else logic. How would I approach this? something like: for ($first_record) { do_something; } else { do_something_else; } Any clues? Thanks! Aaron -Original Message- From: Graeme McLaren [mailto:mickel;ntlworld.com] Sent: Friday, October 25, 2002 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Inserting checkbox data Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- 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] Inserting checkbox data
Mihail, thanx for your advice, I've got it going now ! :) Thank you ! Richard, your points were valid, the HTML code with the slashes was just a copy n' paste from a PHP script and the comma I think I deleted by accident so its all sorted now. Thank you again! Graeme :) - Original Message - From: Mihail Bota [EMAIL PROTECTED] To: Graeme McLaren [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, October 25, 2002 7:47 PM Subject: Re: [PHP-DB] Inserting checkbox data Graeme, first, extend the for loop over the if and the query for insertion of data. As you have it now, it just inserts the last element of the array. second, I think that the for loop should be $a$number. if you put =, then the loop is processing the array with the last value not assigned by you (an extra element in the array). Hope it helps. Mihai On Fri, 25 Oct 2002, Graeme McLaren wrote: Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB. I can print out what the variable holds, the problem is it just won't go into the DB. Weird thing is when I login to SSH there isn't a NULL value for it instead that field is just blank. Anyone got any ideas what the problem is? The HTML that is used for the checkbox is: Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\ So it should theoretically insert Y into the DB Here is the code that appears to be causing the problem: $number=count($GiftWrapping); for($a=0;$a=$number;$a++) { echo $GiftWrapping[$a]; $GW = $GiftWrapping[$a]; echo $GW; } if ($Submit == Submit) { $sql = INSERT INTO SiteMember SET FirstName = '$FirstName', LastName = '$LastName' Username = '$Username', Password = '$Password', GiftWrapping = '$GW'; } Thank you in advance for any help. Graeme :) Public Sub House() On Error Resume drink If Pint.empty = True Then Pint.refill Else Pint.drink End if stomach.add Pint MsgBox I've had stomach.count Pints MsgBox VERY DRUNK End Sub -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP and MySQL form problem - Undifined variables
Mario, The one neat thing about PHP is when something goes wrong with the code, it usually tells you where the error is happening and like a small reason why. On line 11 of your code, you have: $PHP_SELF, this is the variable that needs to be defined as to what this string is supposed to be. PHP is trying to find out what the string $PHP_SELF is, so you going to need to put something in your code to do this. Hope this helps some. Mario Montag [EMAIL PROTECTED] wrote in message news:20021025170041.51178.qmail;pb1.pair.com... First time playing with PHP, Apache, and MySQL. I have a simple form error and I don't know how to solve it. I was doing the Webmonkey PHP/MySQL tutorial and when I started using forms with $PHP_SELF I started getting errors with variables not defined. PHP 4.2.3 MySQL 4.0 Windows 2000 Apache 1.3.27 (Since I was not able to get 2.0 working on Windows 2K Pro) My code is: //-- START OF CODE -- htmlbody?php $db = mysql_connect(localhost, root); mysql_select_db(mydb,$db); $result = mysql_query(SELECT * FROM employees,$db); if ($myrow = mysql_fetch_array($result)) { do { printf( a href=\%s?id=%s\%s %s/abr\n, $PHP_SELF, $myrow[id], $myrow[first], $myrow[last] ); } while ($myrow = mysql_fetch_array($result)); } else { echo Sorry, no records were found!; } ? /body/html //-- END OF CODE --- My ERROR is: Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 Bob Smith Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 John Roberts Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 Brad Johnson Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache\htdocs\mysql2.php on line 11 Mar f --- END OF ERROR I am able to connect to the MySQL DB and retrieve info, but I don't get the error. I changed the REGISTER_GLOBALS of the php.ini file to ON and I still get the variables error. I also added $_POST as stated in another form issue but it did not resolve my problem. It must be simple but I don't know enough to identify the issue. Thanks for any help or input. Mario [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Print data
We faced this problem, and decided if we couldn't get a good solution to eliminate the printer. Turns out the users liked it better, and we eliminated a lot of paper. - First we wrote a report writer. - All reports go to the database. - We wrote a report file system. - The report output title shows up in the user report file system in the IN BASKET. - The user can click the file and it displays the first 5 pages to the screen. They can change the start page and number of pages. - The user can file it into other files like WEEKLY REPORTS. - They can send the report to others and it shows up in their IN BASKET. - If they delete the report it sits in the WASTE BASKET file for 10 days. This gives them the ability to file it back somewhere if it was deleted by mistake. This is fast because the reports are run on the server. Only one copy of the report is kept in the database, and the user report file system points to it. Anyway this was our solution and the users love it since they no longer have to file paper, but file reports electronically. They can carbon copy anyone. They can look at any section of the report any time. They can still print the report if they want by using the print button. HTH... Have a great day... Dan José Moreira wrote: hello, at my company we have several network printers and i was was wondering if it's possible to print directly to them using PHP, instead of showing on the screen or both ... to gain more control on what is printed, because of the nasty browsers header and footer ... whom i now how to remove ... i know that the printer IP is 192.192.1.100 and the port is 9005 ... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php