[PHP-DB] View all results between date 'a' and date 'b'
Probably a simple query, but gogle has turned up good, but not specific info... I have a data capture form, that I wanna view the results of. All good, I've built a results page, that fitlers by many different catagories etc... what I'd like to do now, is have two date fields to sort by, and then only get the entries that fall between those two dates... I've used the mysql 'date' field on the field in the table I'm using... How can it be done...? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
[PHP-DB] all files in a directory
Hi all, I need a small script of php selecting all the files in a directory and putting the names in an array. Also, selecting a specific type might be helpfull like *.TXT I tried to write on my own but it is not a success yet :)) Anyone to help? I will use it on Win32 (2000 pro and XP) Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] all files in a directory
On Fri, 5 Sep 2003, FB wrote: } I need a small script of php selecting all the files in a directory and } putting the names in an array. } } Also, selecting a specific type might be helpfull like *.TXT Untested: $dir = dir('/your/dir/here'); while ($file = $dir-read()) { if (preg_match('/\.TXT$/i', $file)) { $matches[] = $file; } } $dir-close(); Your files will be in the $matches array. /vjl/ -- Vince LaMonica UC Irvine, School of Social Ecology W3 Developer * 116 Social Ecology I, Irvine, CA 92697 [EMAIL PROTECTED] http://www.seweb.uci.edu/techsupport Tower: Delta Zulu Romeo, turn right now and report your heading. Pilot: Wilco. 341, 342, 343, 344, 345... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] all files in a directory
There are many good user-contribued examples in the online PHP manual at function readdir() Ignatius _ - Original Message - From: FB [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 05, 2003 11:55 AM Subject: [PHP-DB] all files in a directory Hi all, I need a small script of php selecting all the files in a directory and putting the names in an array. Also, selecting a specific type might be helpfull like *.TXT I tried to write on my own but it is not a success yet :)) Anyone to help? I will use it on Win32 (2000 pro and XP) Thanks -- 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] ORDER BY Query
Hi, I have a table in my database called Users. This table has (among others) two columns called Location and Name. Location will be either 1, 2, 3, or 4. How can I produce a query that groups the result into Location and then for each Location order the User by Name? Thanks for your help. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] setcookie
Hi! (I'm using php3 on an apache-server) I'm doing lika a shoppingcart where the user can put items. By some reason, when I use setcookie, I can only save between 14-17 posts. Example: setcookie(items, item1); setcookie(items, item2); ... setcookie(items, item17); After this it will not save any more items. It seems to get full..? NE1 had experience with this? Or if you have a different and better way to store many items on the server for a user they are most welcome! Thanx! //Stefan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: ORDER BY Query
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Hi, I have a table in my database called Users. This table has (among others) two columns called Location and Name. Location will be either 1, 2, 3, or 4. How can I produce a query that groups the result into Location and then for each Location order the User by Name? Thanks for your help. You'll need to mix a bit of php with your sql to get the desired result. SELECT * FROM Users WHERE whatever ORDER BY Location, Name Then when you display the results, initialise a variable to keep track of the last value of Location. If it differs from the current value, display the location. This way you end up with something like: Location: 1 Bill Fred George Location: 2 John Agatha Mercedes etc etc -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] setcookie
Stefan, OK, there may be more to this (and I'm sure others will respond if there is), but here's my best take on your problem. You're using the PHP function setcookie() which sets a cookie in the remote browser, not on the server (check Chapter 19 in the PHP manual for a quick explanation or read Netscape's cookie spec for ALL of the details). What the PHP manual doesn't say about the cookie spec is that remote browsers only allow any given server to set a maximum of 20 cookies on a user's machine. So, if you're setting any other cookies in your shopping cart application in addition to the items cookie you listed below, you may be hitting that limit of 20. If you wish to assign multiple values to a cookie, chapter 19 of the PHP manual states the following: If you wish to assign multiple values to a single cookie, just add [] to the cookie name. So if you wanted to set one cookie to hold all of your items, you should be able to setcookie(items[], item1), setcookie(items[], item2), etc up to itemN. Then you can access the items as an array in a PHP script. I'm pretty sure that handling your list of items in this manner would allow you to store a large number of items in the same cookie without setting additional cookies and running into the upper limit of 20. I haven't ever tried it this way before so I may be totally wrong here. I've never done a shopping cart application before and usually only set a cookie or two for last visit date, last page visited, that kind of stuff. Like I said, this is my best guess as to what your problem may be. Hope it helps. Rich -Original Message- From: Ohlson Stefan [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 8:33 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] setcookie Hi! (I'm using php3 on an apache-server) I'm doing lika a shoppingcart where the user can put items. By some reason, when I use setcookie, I can only save between 14-17 posts. Example: setcookie(items, item1); setcookie(items, item2); ... setcookie(items, item17); After this it will not save any more items. It seems to get full..? NE1 had experience with this? Or if you have a different and better way to store many items on the server for a user they are most welcome! Thanx! //Stefan -- 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] COUNT AVG
Hi, Is it possible to combine the COUNT AVG functions using MySQL? I have a table called Bookings and I need to find out the average number of bookings. So I need to count the number of bookings in the table and then get the Average, is this possible? Thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] To many connections problem with LAMP
On Thu, 4 Sep 2003, Balaji H. Kasal wrote: It is usually better not to use persistenc connections. So drop the pmysql_connect or if you really need to use them set set max connections higher for mysql. Which problem it has? On a really busy site persistent connections will just pile up and in the end the sql server will reach its max connections limit. Unless you will do many connects per page you will virtually gain almost nothing by using persistent connections. If you absolutely need to use persistent connections you can stop max connections filling up by dropping MaxRequestsPerChild from httpd.conf to something like 150 or lower. This way unnesseccary connections get killed when the Apache child dies. -- Mika Tuupola http://www.appelsiini.net/~tuupola/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A sql 2000 bd problem
HI, i have the following problem Im working with sql server 2000 in a windows xp pc, then in the bd i have a table called noticias and a text type field, when i insert into the field everything goes rigth, but when i try to get the info of teh field, i can get all the info, is like the variable is not enough to save all the info but im sure that all the info is in the bd, the code is the following: $consulta = new BaseDatos; $consulta-connect(); $sql = select * from Noticias where Id=.$_GET[id]; $res = $consulta-query($sql); $not = $consulta-fetch_row($res); $not[Descripcion] = eregi_replace(chr(13),br,$not[Descripcion]); echo $not[Descripcion]; when i do an echo for $not[Descripcion] i can see that it doesnt have all the info of the field Descripcion on the table noticias. can you help me please?, is urgent! thanks! Carlos A. Castillo. Ingeniero de desarrollo [EMAIL PROTECTED] Su Aliado Efectivo en Internet www.imagine.com.co (57 1)2182064 - (57 1)6163218 Bogotá - Colombia - Soluciones web para Internet e Intranet - Soluciones para redes - Licenciamiento de Software - Asesoría y Soporte Técnico -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] setcookie
On Friday, Sep 5, 2003, at 08:58 US/Eastern, Hutchins, Richard wrote: If you wish to assign multiple values to a single cookie, just add [] to the cookie name. So if you wanted to set one cookie to hold all of your items, you should be able to setcookie(items[], item1), setcookie(items[], item2), etc up to itemN. Then you can access the items as an array in a PHP script. I'm pretty sure that handling your list of items in this manner would allow you to store a large number of items in the same cookie without setting additional cookies and running into the upper limit of 20. IIRC there is a browser-set limit to the size of a given cookie, around 4k. That's pretty big, but there is a limit and it may vary by browser, so it's to your advantage to keep it short. pjm -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Modify MySQL Record
Hell! I'm having a small problem with modifying the data in a MySQL DB. And here's the error: (After I click the Submit Changes button) Error: 1064: You have an error in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10', date='2003-05-05', well' at line 1 Here's the code: function edit_record() { global $default_dbname, $gradient_tablename, $access_log_tablename; global $new_lsd, $kwo, $lsd, $date, $well, $field, $uni, $license, $formation, $perfs, $event, $fluid, $mode, $type, $vhd, $file, $kb, $grd, $open, $sour, $tube, $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag; if(empty($kwo)) error_message('Empty Gradient!'); $link_id = db_connect($default_dbname); if(!$link_id) error_message(sql_error()); $field_str = ''; if($kwo != $new_kwo) $field_str = kwo = '$new_kwo', ; if(!empty($lsd)) { $field_str .= lsd = other_lsd('$lsd') ; } $field_str .= kwo = '$kwo', ; $field_str .= lsd = '$lsd', ; $field_str .= date = '$date', ; $field_str .= well = '$well', ; $field_str .= field = '$field', ; $field_str .= uni = '$uni', ; $field_str .= license = '$license', ; $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; $field_str .= mode = '$mode' ; $field_str .= type = '$type' ; $field_str .= vhd = '$vhd' ; $field_str .= file = '$file' ; $field_str .= kb = '$kb' ; $field_str .= grd = '$grd' ; $field_str .= open = '$open' ; $field_str .= sour = '$open' ; $field_str .= tubing = '$tubing' ; $field_str .= landed = '$landed' ; $field_str .= casing = '$casing' ; $field_str .= landed2 = '$landed2' ; $field_str .= shut_date = '$shut_date' ; $field_str .= sut_time = '$shut_time' ; $field_str .= pres = '$pres' ; $field_str .= tag = '$tag' ; $query = UPDATE $gradient_tablename SET $field_str WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); if($lsd != $new_kwo) { $query = UPDATE $access_log_tablename SET kwo = '$new_kwo' WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); user_message(All records regarding $lsd have been changed!, $PHP_SELF?action=view_recordkwo=$new_kwo); } else { user_message(All records regarding $lsd have been changed!); } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Modify MySQL Record
looks like you stopped putting commas after your fields at $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; hth Jeff Jeff [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Subject: [PHP-DB] Modify MySQL Record 09/05/2003 12:28 PM Hell! I'm having a small problem with modifying the data in a MySQL DB. And here's the error: (After I click the Submit Changes button) Error: 1064: You have an error in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10', date='2003-05-05', well' at line 1 Here's the code: function edit_record() { global $default_dbname, $gradient_tablename, $access_log_tablename; global $new_lsd, $kwo, $lsd, $date, $well, $field, $uni, $license, $formation, $perfs, $event, $fluid, $mode, $type, $vhd, $file, $kb, $grd, $open, $sour, $tube, $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag; if(empty($kwo)) error_message('Empty Gradient!'); $link_id = db_connect($default_dbname); if(!$link_id) error_message(sql_error()); $field_str = ''; if($kwo != $new_kwo) $field_str = kwo = '$new_kwo', ; if(!empty($lsd)) { $field_str .= lsd = other_lsd('$lsd') ; } $field_str .= kwo = '$kwo', ; $field_str .= lsd = '$lsd', ; $field_str .= date = '$date', ; $field_str .= well = '$well', ; $field_str .= field = '$field', ; $field_str .= uni = '$uni', ; $field_str .= license = '$license', ; $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; $field_str .= mode = '$mode' ; $field_str .= type = '$type' ; $field_str .= vhd = '$vhd' ; $field_str .= file = '$file' ; $field_str .= kb = '$kb' ; $field_str .= grd = '$grd' ; $field_str .= open = '$open' ; $field_str .= sour = '$open' ; $field_str .= tubing = '$tubing' ; $field_str .= landed = '$landed' ; $field_str .= casing = '$casing' ; $field_str .= landed2 = '$landed2' ; $field_str .= shut_date = '$shut_date' ; $field_str .= sut_time = '$shut_time' ; $field_str .= pres = '$pres' ; $field_str .= tag = '$tag' ; $query = UPDATE $gradient_tablename SET $field_str WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); if($lsd != $new_kwo) { $query = UPDATE $access_log_tablename SET kwo = '$new_kwo' WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); user_message(All records regarding $lsd have been changed!, $PHP_SELF?action=view_recordkwo=$new_kwo); } else { user_message(All records regarding $lsd have been changed!); } } -- 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] Modify MySQL Record
Yah, I noticed that after I had submitted this, and fixed it - still no change - gives the same exact error. Jeffrey N Dyke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] looks like you stopped putting commas after your fields at $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; hth Jeff Jeff [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Subject: [PHP-DB] Modify MySQL Record 09/05/2003 12:28 PM Hell! I'm having a small problem with modifying the data in a MySQL DB. And here's the error: (After I click the Submit Changes button) Error: 1064: You have an error in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10', date='2003-05-05', well' at line 1 Here's the code: function edit_record() { global $default_dbname, $gradient_tablename, $access_log_tablename; global $new_lsd, $kwo, $lsd, $date, $well, $field, $uni, $license, $formation, $perfs, $event, $fluid, $mode, $type, $vhd, $file, $kb, $grd, $open, $sour, $tube, $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag; if(empty($kwo)) error_message('Empty Gradient!'); $link_id = db_connect($default_dbname); if(!$link_id) error_message(sql_error()); $field_str = ''; if($kwo != $new_kwo) $field_str = kwo = '$new_kwo', ; if(!empty($lsd)) { $field_str .= lsd = other_lsd('$lsd') ; } $field_str .= kwo = '$kwo', ; $field_str .= lsd = '$lsd', ; $field_str .= date = '$date', ; $field_str .= well = '$well', ; $field_str .= field = '$field', ; $field_str .= uni = '$uni', ; $field_str .= license = '$license', ; $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; $field_str .= mode = '$mode' ; $field_str .= type = '$type' ; $field_str .= vhd = '$vhd' ; $field_str .= file = '$file' ; $field_str .= kb = '$kb' ; $field_str .= grd = '$grd' ; $field_str .= open = '$open' ; $field_str .= sour = '$open' ; $field_str .= tubing = '$tubing' ; $field_str .= landed = '$landed' ; $field_str .= casing = '$casing' ; $field_str .= landed2 = '$landed2' ; $field_str .= shut_date = '$shut_date' ; $field_str .= sut_time = '$shut_time' ; $field_str .= pres = '$pres' ; $field_str .= tag = '$tag' ; $query = UPDATE $gradient_tablename SET $field_str WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); if($lsd != $new_kwo) { $query = UPDATE $access_log_tablename SET kwo = '$new_kwo' WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); user_message(All records regarding $lsd have been changed!, $PHP_SELF?action=view_recordkwo=$new_kwo); } else { user_message(All records regarding $lsd have been changed!); } } -- 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] Modify MySQL Record
I'd suggest you first output your SQL statement to the browser to see exactly what it's sending to the database. Might give you the answer right there. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Yah, I noticed that after I had submitted this, and fixed it - still no change - gives the same exact error. Jeffrey N Dyke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] looks like you stopped putting commas after your fields at $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; hth Jeff Jeff [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Subject: [PHP-DB] Modify MySQL Record 09/05/2003 12:28 PM Hell! I'm having a small problem with modifying the data in a MySQL DB. And here's the error: (After I click the Submit Changes button) Error: 1064: You have an error in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10', date='2003-05-05', well' at line 1 Here's the code: function edit_record() { global $default_dbname, $gradient_tablename, $access_log_tablename; global $new_lsd, $kwo, $lsd, $date, $well, $field, $uni, $license, $formation, $perfs, $event, $fluid, $mode, $type, $vhd, $file, $kb, $grd, $open, $sour, $tube, $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag; if(empty($kwo)) error_message('Empty Gradient!'); $link_id = db_connect($default_dbname); if(!$link_id) error_message(sql_error()); $field_str = ''; if($kwo != $new_kwo) $field_str = kwo = '$new_kwo', ; if(!empty($lsd)) { $field_str .= lsd = other_lsd('$lsd') ; } $field_str .= kwo = '$kwo', ; $field_str .= lsd = '$lsd', ; $field_str .= date = '$date', ; $field_str .= well = '$well', ; $field_str .= field = '$field', ; $field_str .= uni = '$uni', ; $field_str .= license = '$license', ; $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; $field_str .= mode = '$mode' ; $field_str .= type = '$type' ; $field_str .= vhd = '$vhd' ; $field_str .= file = '$file' ; $field_str .= kb = '$kb' ; $field_str .= grd = '$grd' ; $field_str .= open = '$open' ; $field_str .= sour = '$open' ; $field_str .= tubing = '$tubing' ; $field_str .= landed = '$landed' ; $field_str .= casing = '$casing' ; $field_str .= landed2 = '$landed2' ; $field_str .= shut_date = '$shut_date' ; $field_str .= sut_time = '$shut_time' ; $field_str .= pres = '$pres' ; $field_str .= tag = '$tag' ; $query = UPDATE $gradient_tablename SET $field_str WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); if($lsd != $new_kwo) { $query = UPDATE $access_log_tablename SET kwo = '$new_kwo' WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); user_message(All records regarding $lsd have been changed!, $PHP_SELF?action=view_recordkwo=$new_kwo); } else { user_message(All records regarding $lsd have been changed!); } } -- 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] Modify MySQL Record
K, my tired eyes last night missed a few stupid mistakes... First: The Commas Second: I removed the period form the first line of the array -- $field_str = kwo = '$kwo', ; Third: two typos. *hangs head in shame* Sorry for bothering everyone. :P BUT! I'm still having a problem - when I try to submit the change it comes back and says Nothing Changed! even if I change every field. Gonna do some more hunting - I'm doubting myself now. ;) Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'd suggest you first output your SQL statement to the browser to see exactly what it's sending to the database. Might give you the answer right there. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Yah, I noticed that after I had submitted this, and fixed it - still no change - gives the same exact error. Jeffrey N Dyke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] looks like you stopped putting commas after your fields at $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; hth Jeff Jeff [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Subject: [PHP-DB] Modify MySQL Record 09/05/2003 12:28 PM Hell! I'm having a small problem with modifying the data in a MySQL DB. And here's the error: (After I click the Submit Changes button) Error: 1064: You have an error in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10', date='2003-05-05', well' at line 1 Here's the code: function edit_record() { global $default_dbname, $gradient_tablename, $access_log_tablename; global $new_lsd, $kwo, $lsd, $date, $well, $field, $uni, $license, $formation, $perfs, $event, $fluid, $mode, $type, $vhd, $file, $kb, $grd, $open, $sour, $tube, $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag; if(empty($kwo)) error_message('Empty Gradient!'); $link_id = db_connect($default_dbname); if(!$link_id) error_message(sql_error()); $field_str = ''; if($kwo != $new_kwo) $field_str = kwo = '$new_kwo', ; if(!empty($lsd)) { $field_str .= lsd = other_lsd('$lsd') ; } $field_str .= kwo = '$kwo', ; $field_str .= lsd = '$lsd', ; $field_str .= date = '$date', ; $field_str .= well = '$well', ; $field_str .= field = '$field', ; $field_str .= uni = '$uni', ; $field_str .= license = '$license', ; $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; $field_str .= mode = '$mode' ; $field_str .= type = '$type' ; $field_str .= vhd = '$vhd' ; $field_str .= file = '$file' ; $field_str .= kb = '$kb' ; $field_str .= grd = '$grd' ; $field_str .= open = '$open' ; $field_str .= sour = '$open' ; $field_str .= tubing = '$tubing' ; $field_str .= landed = '$landed' ; $field_str .= casing = '$casing' ; $field_str .= landed2 = '$landed2' ; $field_str .= shut_date = '$shut_date' ; $field_str .= sut_time = '$shut_time' ; $field_str .= pres = '$pres' ; $field_str .= tag = '$tag' ; $query = UPDATE $gradient_tablename SET $field_str WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); if($lsd != $new_kwo) { $query = UPDATE $access_log_tablename SET kwo = '$new_kwo' WHERE kwo = '$kwo'; $result = mysql_query($query); if(!$result) error_message(sql_error()); user_message(All records regarding $lsd have been changed!, $PHP_SELF?action=view_recordkwo=$new_kwo); } else { user_message(All records regarding $lsd have been changed!); } } -- 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] Modify MySQL Record
Jeff, No problem. Happens to everyone, trust me. Anyway, I see you're using mysql_affected_rows($link_id) to get see how many rows were affected by the UPDATE. Try getting rid of the $link_id in the declaration and just use mysql_affected_rows(). Personally, I have always had trouble when specifying a resource in a mysql function like this (it's probably just me). But, the mysql_affected_rows() function will, by default, use the last connection used by your script. Also, you're checking to see if it's not set e.g.,: $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); According to the documentation, mysql_affected_rows() returns a -1 if the query failed. And I'm pretty sure it returns 0 if your query was successful but didn't affect any rows. I'm pretty sure ! checks for FALSE which is not one of mysql_affected_rows() valid return values. So your check isn't doing what you think it should. Give that a shot and see if it helps out at all. Good luck. Rich -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record K, my tired eyes last night missed a few stupid mistakes... First: The Commas Second: I removed the period form the first line of the array -- $field_str = kwo = '$kwo', ; Third: two typos. *hangs head in shame* Sorry for bothering everyone. :P BUT! I'm still having a problem - when I try to submit the change it comes back and says Nothing Changed! even if I change every field. Gonna do some more hunting - I'm doubting myself now. ;) Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'd suggest you first output your SQL statement to the browser to see exactly what it's sending to the database. Might give you the answer right there. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Yah, I noticed that after I had submitted this, and fixed it - still no change - gives the same exact error. Jeffrey N Dyke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] looks like you stopped putting commas after your fields at $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; hth Jeff Jeff [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Subject: [PHP-DB] Modify MySQL Record 09/05/2003 12:28 PM Hell! I'm having a small problem with modifying the data in a MySQL DB. And here's the error: (After I click the Submit Changes button) Error: 1064: You have an error in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10', date='2003-05-05', well' at line 1 Here's the code: function edit_record() { global $default_dbname, $gradient_tablename, $access_log_tablename; global $new_lsd, $kwo, $lsd, $date, $well, $field, $uni, $license, $formation, $perfs, $event, $fluid, $mode, $type, $vhd, $file, $kb, $grd, $open, $sour, $tube, $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag; if(empty($kwo)) error_message('Empty Gradient!'); $link_id = db_connect($default_dbname); if(!$link_id) error_message(sql_error()); $field_str = ''; if($kwo != $new_kwo) $field_str = kwo = '$new_kwo', ; if(!empty($lsd)) { $field_str .= lsd = other_lsd('$lsd') ; } $field_str .= kwo = '$kwo', ; $field_str .= lsd = '$lsd', ; $field_str .= date = '$date', ; $field_str .= well = '$well', ; $field_str .= field = '$field', ; $field_str .= uni = '$uni', ; $field_str .= license = '$license', ; $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; $field_str .= mode = '$mode' ; $field_str .= type = '$type' ; $field_str .= vhd = '$vhd' ; $field_str .= file = '$file' ; $field_str .= kb = '$kb' ; $field_str .= grd = '$grd' ; $field_str .= open = '$open' ; $field_str .= sour = '$open' ; $field_str .= tubing = '$tubing' ; $field_str .= landed = '$landed' ; $field_str .= casing = '$casing' ; $field_str .= landed2 = '$landed2' ; $field_str .= shut_date = '$shut_date' ; $field_str .= sut_time = '$shut_time' ; $field_str
[PHP-DB] How to exclude the result of union of two tables from the result of union of other two tables
I have a php page where I would like to list a numer of companies as below: 1- retrieve all distinct company names from TableA (SELECT company_name FROM TableA) 2- retrieve all distinct company names from TableB 3- combine the two lists as list1 4- retrieve all distinct company names from TableC 5- retrieve all distinct company names from TableD 6- combine the two lists as list2 7- display company names in list1 that don't exist in list2 MySql version is 3.23.56 3.23.56 , so I cannot use UNION. I would like to accomplish this with as little php code as possible, using mostly SQL. Thanks, Oz. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Modify MySQL Record
Ok, so it sorta works now *grin* Two new problems I added an auto increment field in my table and changed the php to reflect that field - But for some reason, it doesn't work.. When I submit a new record, do I need to tell SQL to add one to the greatest, or should it do it automatically when a new record is created? gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, and I made it the primary. Problem two, If I manually enter a number into that field, I can make changes to the record no problem! but... it goes into some kind of continuous loop. It comes up with a window that says what I told it to say -- user_message(All records regarding $kwo have been changed!, $PHP_SELF?action=view_recordgradient=$new_gradient); -- I hit OK and it jumps to -- if(empty($kwo)) error_message('Empty Gradient!!'); -- if you hit ok again, it just loops. This might be solved as soon as I get that one field to auto populate. :P Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, No problem. Happens to everyone, trust me. Anyway, I see you're using mysql_affected_rows($link_id) to get see how many rows were affected by the UPDATE. Try getting rid of the $link_id in the declaration and just use mysql_affected_rows(). Personally, I have always had trouble when specifying a resource in a mysql function like this (it's probably just me). But, the mysql_affected_rows() function will, by default, use the last connection used by your script. Also, you're checking to see if it's not set e.g.,: $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); According to the documentation, mysql_affected_rows() returns a -1 if the query failed. And I'm pretty sure it returns 0 if your query was successful but didn't affect any rows. I'm pretty sure ! checks for FALSE which is not one of mysql_affected_rows() valid return values. So your check isn't doing what you think it should. Give that a shot and see if it helps out at all. Good luck. Rich -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record K, my tired eyes last night missed a few stupid mistakes... First: The Commas Second: I removed the period form the first line of the array -- $field_str = kwo = '$kwo', ; Third: two typos. *hangs head in shame* Sorry for bothering everyone. :P BUT! I'm still having a problem - when I try to submit the change it comes back and says Nothing Changed! even if I change every field. Gonna do some more hunting - I'm doubting myself now. ;) Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'd suggest you first output your SQL statement to the browser to see exactly what it's sending to the database. Might give you the answer right there. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Yah, I noticed that after I had submitted this, and fixed it - still no change - gives the same exact error. Jeffrey N Dyke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] looks like you stopped putting commas after your fields at $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; hth Jeff Jeff [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Subject: [PHP-DB] Modify MySQL Record 09/05/2003 12:28 PM Hell! I'm having a small problem with modifying the data in a MySQL DB. And here's the error: (After I click the Submit Changes button) Error: 1064: You have an error in your SQL syntax near '(10-10-10-10)' kwo='1235', lsd='10-10-10-10', date='2003-05-05', well' at line 1 Here's the code: function edit_record() { global $default_dbname, $gradient_tablename, $access_log_tablename; global $new_lsd, $kwo, $lsd, $date, $well, $field, $uni, $license, $formation, $perfs, $event, $fluid, $mode, $type, $vhd, $file, $kb, $grd, $open, $sour, $tube, $landed, $casing, $landed2, $shut_date, $shut_time, $pres, $tag; if(empty($kwo)) error_message('Empty Gradient!'); $link_id = db_connect($default_dbname); if(!$link_id) error_message(sql_error()); $field_str = ''; if($kwo != $new_kwo)
RE: [PHP-DB] Modify MySQL Record
Jeff, When you want to increment an autoincrement field, you just put NULL into the query. For example: INSERT (NULL,'Jeff','php list','Modify MySQL Record') INTO mail; Where NULL is in the same spot in the field list as your autoincrement field. That concept is covered in the MySQL manual. Pretty simple stuff. If you're in a situation where you have an autoincrement field that you sometimes autoincrement and sometimes manually assign a value to, I think you're misusing the autoincrement field (IMHO). If you have that situation, use the autoincrement field to assign a unique ID to the table row and use a separate field with another name for the manually assigned data. As far as the stuff you mentioned about clicking things and getting the messages you expected, I'm kinda' lost. But if you use the autoincrement field as it is intended, the logic should present itself. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so it sorta works now *grin* Two new problems I added an auto increment field in my table and changed the php to reflect that field - But for some reason, it doesn't work.. When I submit a new record, do I need to tell SQL to add one to the greatest, or should it do it automatically when a new record is created? gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, and I made it the primary. Problem two, If I manually enter a number into that field, I can make changes to the record no problem! but... it goes into some kind of continuous loop. It comes up with a window that says what I told it to say -- user_message(All records regarding $kwo have been changed!, $PHP_SELF?action=view_recordgradient=$new_gradient); -- I hit OK and it jumps to -- if(empty($kwo)) error_message('Empty Gradient!!'); -- if you hit ok again, it just loops. This might be solved as soon as I get that one field to auto populate. :P Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, No problem. Happens to everyone, trust me. Anyway, I see you're using mysql_affected_rows($link_id) to get see how many rows were affected by the UPDATE. Try getting rid of the $link_id in the declaration and just use mysql_affected_rows(). Personally, I have always had trouble when specifying a resource in a mysql function like this (it's probably just me). But, the mysql_affected_rows() function will, by default, use the last connection used by your script. Also, you're checking to see if it's not set e.g.,: $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); According to the documentation, mysql_affected_rows() returns a -1 if the query failed. And I'm pretty sure it returns 0 if your query was successful but didn't affect any rows. I'm pretty sure ! checks for FALSE which is not one of mysql_affected_rows() valid return values. So your check isn't doing what you think it should. Give that a shot and see if it helps out at all. Good luck. Rich -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record K, my tired eyes last night missed a few stupid mistakes... First: The Commas Second: I removed the period form the first line of the array -- $field_str = kwo = '$kwo', ; Third: two typos. *hangs head in shame* Sorry for bothering everyone. :P BUT! I'm still having a problem - when I try to submit the change it comes back and says Nothing Changed! even if I change every field. Gonna do some more hunting - I'm doubting myself now. ;) Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'd suggest you first output your SQL statement to the browser to see exactly what it's sending to the database. Might give you the answer right there. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Yah, I noticed that after I had submitted this, and fixed it - still no change - gives the same exact error. Jeffrey N Dyke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] looks like you stopped putting commas after your fields at $field_str .= formation = '$formation' ; $field_str .= perfs = '$perfs' ; $field_str .= event = '$event' ; $field_str .= fluid = '$fluid' ; hth Jeff Jeff [EMAIL PROTECTED]To: [EMAIL
Re: [PHP-DB] ORDER BY Query
Shaun wrote: I have a table in my database called Users. This table has (among others) two columns called Location and Name. Location will be either 1, 2, 3, or 4. How can I produce a query that groups the result into Location and then for each Location order the User by Name? Learn SQL, please. SELECT * FROM Table ORDER BY Location, Name -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] multiple queries with PHP
I want to SELECT * from a table and also update the hit counter by 1. So theres 2 different queries which I know I can easily do in PHP seperately, but I thought itd be quicker and more efficient to run them in the same query, ie seperated by a ';'. But PHP returns an error, and it works fine on the command line. I read somewhere thats its a security risk in PHP to allow 2 queries, so its turned off by default. Is this true? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to exclude the result of union of two tables from the result of union of other two tables
Oz wrote: I have a php page where I would like to list a numer of companies as below: 1- retrieve all distinct company names from TableA (SELECT company_name FROM TableA) CREATE TEMPORARY TABLE temp1 SELECT DISTINCT(company_name) FROM TableA 2- retrieve all distinct company names from TableB 3- combine the two lists as list1 INSERT INTO temp1 SELECT DISTINCT(company_name) FROM TableB 4- retrieve all distinct company names from TableC CREATE TEMPORARY TABLE temp2 SELECT DISTINCT(company_name) FROM TableC 5- retrieve all distinct company names from TableD 6- combine the two lists as list2 INSERT INTO temp2 SELECT DISTINCT(company_name) FROM TableD 7- display company names in list1 that don't exist in list2 SELECT t1.company_name FROM temp1 t1 LEFT JOIN temp2 t2 ON t1.company_name = t2.company_name WHERE t2.company_name IS NULL MySql version is 3.23.56 3.23.56 , so I cannot use UNION. I would like to accomplish this with as little php code as possible, using mostly SQL. How about using all SQL? :) All of this is in the MySQL manual, btw... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multiple queries with PHP
John Ryan wrote: I want to SELECT * from a table and also update the hit counter by 1. So theres 2 different queries which I know I can easily do in PHP seperately, but I thought itd be quicker and more efficient to run them in the same query, ie seperated by a ';'. But PHP returns an error, and it works fine on the command line. I read somewhere thats its a security risk in PHP to allow 2 queries, so its turned off by default. Is this true? Yes. Also, just because you can fit something onto one line it doesn't mean it's more efficient. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Modify MySQL Record
Ok, so I added what you suggested, but it still doesn't assign any numbers to the records. $query = INSERT INTO cnrl_db (gradient, kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('NULL', '$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag'); $result = mysql_query($query, $link_id) OR die(mysql_error()); gradient - the auto increment field. Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, When you want to increment an autoincrement field, you just put NULL into the query. For example: INSERT (NULL,'Jeff','php list','Modify MySQL Record') INTO mail; Where NULL is in the same spot in the field list as your autoincrement field. That concept is covered in the MySQL manual. Pretty simple stuff. If you're in a situation where you have an autoincrement field that you sometimes autoincrement and sometimes manually assign a value to, I think you're misusing the autoincrement field (IMHO). If you have that situation, use the autoincrement field to assign a unique ID to the table row and use a separate field with another name for the manually assigned data. As far as the stuff you mentioned about clicking things and getting the messages you expected, I'm kinda' lost. But if you use the autoincrement field as it is intended, the logic should present itself. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so it sorta works now *grin* Two new problems I added an auto increment field in my table and changed the php to reflect that field - But for some reason, it doesn't work.. When I submit a new record, do I need to tell SQL to add one to the greatest, or should it do it automatically when a new record is created? gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, and I made it the primary. Problem two, If I manually enter a number into that field, I can make changes to the record no problem! but... it goes into some kind of continuous loop. It comes up with a window that says what I told it to say -- user_message(All records regarding $kwo have been changed!, $PHP_SELF?action=view_recordgradient=$new_gradient); -- I hit OK and it jumps to -- if(empty($kwo)) error_message('Empty Gradient!!'); -- if you hit ok again, it just loops. This might be solved as soon as I get that one field to auto populate. :P Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, No problem. Happens to everyone, trust me. Anyway, I see you're using mysql_affected_rows($link_id) to get see how many rows were affected by the UPDATE. Try getting rid of the $link_id in the declaration and just use mysql_affected_rows(). Personally, I have always had trouble when specifying a resource in a mysql function like this (it's probably just me). But, the mysql_affected_rows() function will, by default, use the last connection used by your script. Also, you're checking to see if it's not set e.g.,: $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); According to the documentation, mysql_affected_rows() returns a -1 if the query failed. And I'm pretty sure it returns 0 if your query was successful but didn't affect any rows. I'm pretty sure ! checks for FALSE which is not one of mysql_affected_rows() valid return values. So your check isn't doing what you think it should. Give that a shot and see if it helps out at all. Good luck. Rich -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record K, my tired eyes last night missed a few stupid mistakes... First: The Commas Second: I removed the period form the first line of the array -- $field_str = kwo = '$kwo', ; Third: two typos. *hangs head in shame* Sorry for bothering everyone. :P BUT! I'm still having a problem - when I try to submit the change it comes back and says Nothing Changed! even if I change every field. Gonna do some more hunting - I'm doubting myself now. ;) Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'd suggest you first output your SQL statement to the browser to see exactly what it's sending to the database.
RE: [PHP-DB] Modify MySQL Record
Get rid of the single quotes around NULL. If you use 'NULL', it inserts the string NULL into that column instead of a NULL which triggers the autoincrement (think I explained that right). If that doesn't work, echo out your query again and make sure it's sending what it's supposed to be sending. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 3:15 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so I added what you suggested, but it still doesn't assign any numbers to the records. $query = INSERT INTO cnrl_db (gradient, kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('NULL', '$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag'); $result = mysql_query($query, $link_id) OR die(mysql_error()); gradient - the auto increment field. Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, When you want to increment an autoincrement field, you just put NULL into the query. For example: INSERT (NULL,'Jeff','php list','Modify MySQL Record') INTO mail; Where NULL is in the same spot in the field list as your autoincrement field. That concept is covered in the MySQL manual. Pretty simple stuff. If you're in a situation where you have an autoincrement field that you sometimes autoincrement and sometimes manually assign a value to, I think you're misusing the autoincrement field (IMHO). If you have that situation, use the autoincrement field to assign a unique ID to the table row and use a separate field with another name for the manually assigned data. As far as the stuff you mentioned about clicking things and getting the messages you expected, I'm kinda' lost. But if you use the autoincrement field as it is intended, the logic should present itself. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so it sorta works now *grin* Two new problems I added an auto increment field in my table and changed the php to reflect that field - But for some reason, it doesn't work.. When I submit a new record, do I need to tell SQL to add one to the greatest, or should it do it automatically when a new record is created? gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, and I made it the primary. Problem two, If I manually enter a number into that field, I can make changes to the record no problem! but... it goes into some kind of continuous loop. It comes up with a window that says what I told it to say -- user_message(All records regarding $kwo have been changed!, $PHP_SELF?action=view_recordgradient=$new_gradient); -- I hit OK and it jumps to -- if(empty($kwo)) error_message('Empty Gradient!!'); -- if you hit ok again, it just loops. This might be solved as soon as I get that one field to auto populate. :P Richard Hutchins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, No problem. Happens to everyone, trust me. Anyway, I see you're using mysql_affected_rows($link_id) to get see how many rows were affected by the UPDATE. Try getting rid of the $link_id in the declaration and just use mysql_affected_rows(). Personally, I have always had trouble when specifying a resource in a mysql function like this (it's probably just me). But, the mysql_affected_rows() function will, by default, use the last connection used by your script. Also, you're checking to see if it's not set e.g.,: $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message(Nothing changed!); According to the documentation, mysql_affected_rows() returns a -1 if the query failed. And I'm pretty sure it returns 0 if your query was successful but didn't affect any rows. I'm pretty sure ! checks for FALSE which is not one of mysql_affected_rows() valid return values. So your check isn't doing what you think it should. Give that a shot and see if it helps out at all. Good luck. Rich -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 12:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record K, my tired eyes last night missed a few stupid mistakes... First: The Commas
Re: [PHP-DB] multiple queries with PHP
You wouldnt know where to change this setting? John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John Ryan wrote: I want to SELECT * from a table and also update the hit counter by 1. So theres 2 different queries which I know I can easily do in PHP seperately, but I thought itd be quicker and more efficient to run them in the same query, ie seperated by a ';'. But PHP returns an error, and it works fine on the command line. I read somewhere thats its a security risk in PHP to allow 2 queries, so its turned off by default. Is this true? Yes. Also, just because you can fit something onto one line it doesn't mean it's more efficient. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multiple queries with PHP
John Ryan wrote: You wouldnt know where to change this setting? It's not a setting, you just can't do it. Use two mysql_query() calls. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Modify MySQL Record
When you have an auntoincremente field inyour table, you don't have toespecify the field name in the query,as the following: $query = "INSERT INTO cnrl_db (kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag')"; hope it helps eLFeR. ---Original Message--- From: Jeff Date: Viernes, 05 de Septiembre de 2003 01:15:21 p.m. To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so I added what you suggested, but it still doesn't assign any numbers to the records. $query = "INSERT INTO cnrl_db (gradient, kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('NULL', '$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag')"; $result = mysql_query($query, $link_id) OR die(mysql_error()); gradient - the auto increment field. "Richard Hutchins" [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, When you want to increment an autoincrement field, you just put NULL into the query. For example: INSERT (NULL,'Jeff','php list','Modify MySQL Record') INTO mail; Where NULL is in the same spot in the field list as your autoincrement field. That concept is covered in the MySQL manual. Pretty simple stuff. If you're in a situation where you have an autoincrement field that you sometimes autoincrement and sometimes manually assign a value to, I think you're misusing the autoincrement field (IMHO). If you have that situation, use the autoincrement field to assign a unique ID to the table row and use a separate field with another name for the manually assigned data. As far as the stuff you mentioned about clicking things and getting the messages you expected, I'm kinda' lost. But if you use the autoincrement field as it is intended, the logic should present itself. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED]] Sent: Friday, September 05, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so it sorta works now *grin* Two new problems I added an auto increment field in my table and changed the php to reflect that field - But for some reason, it doesn't work.. When I submit a new record, do I need to tell SQL to add one to the greatest, or should it do it automatically when a new record is created? gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, and I made it the primary. Problem two, If I manually enter a number into that field, I can make changes to the record no problem! but... it goes into some kind of continuous loop. It comes up with a window that says what I told it to say -- user_message("All records regarding $kwo have been changed!", "$PHP_SELF?action="" -- I hit OK and it jumps to -- if(empty($kwo)) error_message('Empty Gradient!!'); -- if you hit ok again, it just loops. This might be solved as soon as I get that one field to auto populate. :P "Richard Hutchins" [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, No problem. Happens to everyone, trust me. Anyway, I see you're using mysql_affected_rows($link_id) to get see how many rows were affected by the UPDATE. Try getting rid of the $link_id in the declaration and just use mysql_affected_rows(). Personally, I have always had trouble when specifying a resource in a mysql function like this (it's probably just me). But, the mysql_affected_rows() function will, by default, use the last connection used by your script. Also, you're checking to see if it's not set e.g.,: $num_rows = mysql_affected_rows($link_id); if(!$num_rows) error_message("Nothing changed!"); According to the documentation, mysql_affected_rows() returns a -1 if the query failed. And I'm pretty sure it returns 0 if your query was successful but didn't affect any rows. I'm pretty sure ! checks for FALSE which is not one of mysql_affected_rows() valid return values. So your check isn't doing what you think it should. Give that a shot and see if it helps out at all. Good luck. Rich -Original Message- From: Jeff [mailto:[EMAIL PROTECTED]] Sent: Friday, September 05, 2003 12:44 PM To: [EMAIL PROTECTED] Subject:
RE: [PHP-DB] Modify MySQL Record
Yup, Fernando is correct. But it is not incorrect to specify a NULL value in your query for an autoincrement column. Right out of the MySQL manual: If you insert NULL into an AUTO_INCREMENT column, the next number in the sequence is inserted. Although the MySQL manual implies it by giving examples where rows are inserted into tables with an autoincrement column, I could not find a spot where it explicitly states that you don't have to provide a value for that column in an INSERT query. Probably just falls into the personal preference category. -Original Message- From: Fernando Soto [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 4:00 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record When you have an auntoincremente field in your table, you don't have to especify the field name in the query, as the following: $query = INSERT INTO cnrl_db (kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag'); hope it helps eLFeR. ---Original Message--- From: Jeff mailto:[EMAIL PROTECTED] Date: Viernes, 05 de Septiembre de 2003 01:15:21 p.m. To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so I added what you suggested, but it still doesn't assign any numbers to the records. $query = INSERT INTO cnrl_db (gradient, kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('NULL', '$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag'); $result = mysql_query($query, $link_id) OR die(mysql_error()); gradient - the auto increment field. Richard Hutchins [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, When you want to increment an autoincrement field, you just put NULL into the query. For example: INSERT (NULL,'Jeff','php list','Modify MySQL Record') INTO mail; Where NULL is in the same spot in the field list as your autoincrement field. That concept is covered in the MySQL manual. Pretty simple stuff. If you're in a situation where you have an autoincrement field that you sometimes autoincrement and sometimes manually assign a value to, I think you're misusing the autoincrement field (IMHO). If you have that situation, use the autoincrement field to assign a unique ID to the table row and use a separate field with another name for the manually assigned data. As far as the stuff you mentioned about clicking things and getting the messages you expected, I'm kinda' lost. But if you use the autoincrement field as it is intended, the logic should present itself. -Original Message- From: Jeff [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Friday, September 05, 2003 2:07 PM To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so it sorta works now *grin* Two new problems I added an auto increment field in my table and changed the php to reflect that field - But for some reason, it doesn't work.. When I submit a new record, do I need to tell SQL to add one to the greatest, or should it do it automatically when a new record is created? gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, and I made it the primary. Problem two, If I manually enter a number into that field, I can make changes to the record no problem! but... it goes into some kind of continuous loop. It comes up with a window that says what I told it to say -- user_message(All records regarding $kwo have been changed!, $PHP_SELF?action=view_recordgradient=$new_gradient); -- I hit OK and it jumps to -- if(empty($kwo)) error_message('Empty Gradient!!'); -- if you hit ok again, it just loops. This might be solved as soon as I get that one field to auto populate. :P Richard Hutchins [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, No problem. Happens to everyone, trust me. Anyway, I see you're using mysql_affected_rows($link_id) to get see how many rows were affected by the UPDATE. Try getting rid of the $link_id in the declaration and just use mysql_affected_rows(). Personally, I have always had trouble when
RE: [PHP-DB] Modify MySQL Record
That's ok Richard,I posted the message'cause i haven't seen yours. As a matter of fact. I'm really new to MySQL, my DB background is MSSQL, so, in the MSSQLBooks Online I found this: A. Use the IDENTITY property with CREATE TABLE This example creates a new table using the IDENTITY property for an automatically incrementing identification number.USE pubs IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'new_employees') DROP TABLE new_employees GO CREATE TABLE new_employees ( id_num int IDENTITY(1,1), fname varchar (20), minit char(1), lname varchar(30) ) INSERT new_employees (fname, minit, lname) VALUES ('Karin', 'F', 'Josephs') INSERT new_employees (fname, minit, lname) VALUES ('Pirkko', 'O', 'Koskitalo') The only one thing i have to do was to try it in MySQL and fortunately it works. Anyway, Jeff have 2 options to select, right?... eLFeR ---Original Message--- From: Hutchins, Richard Date: Viernes, 05 de Septiembre de 2003 02:19:23 p.m. To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Modify MySQL Record Yup, Fernando is correct. But it is not incorrect to specify a NULL value in your query for an autoincrement column. Right out of the MySQL manual: "If you insert NULL into an AUTO_INCREMENT column, the next number in the sequence is inserted." Although the MySQL manual implies it by giving examples where rows are inserted into tables with an autoincrement column, I could not find a spot where it explicitly states that you don't have to provide a value for that column in an INSERT query. Probably just falls into the personal preference category. -Original Message- From: Fernando Soto [mailto:[EMAIL PROTECTED]] Sent: Friday, September 05, 2003 4:00 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record When you have an auntoincremente field in your table, you don't have to especify the field name in the query, as the following: $query = "INSERT INTO cnrl_db (kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag')"; hope it helps eLFeR. ---Original Message--- From: Jeff mailto:[EMAIL PROTECTED] Date: Viernes, 05 de Septiembre de 2003 01:15:21 p.m. To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so I added what you suggested, but it still doesn't assign any numbers to the records. $query = "INSERT INTO cnrl_db (gradient, kwo, lsd, date, well, field, uni, license, formation, perfs, event, fluid, mode, type, vhd, file, kb, grd, open, sour, tube, landed, casing, landed2, shut_date, shut_time, pres, tag) VALUES ('NULL', '$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation', '$perfs', '$event', '$fluid', '$mode', '$type', '$vhd', '$file', '$kb', '$grd', '$open', '$sour', '$tube', '$landed', '$casing', '$landed2', '$shut_date', '$shut_time', '$pres', '$tag')"; $result = mysql_query($query, $link_id) OR die(mysql_error()); gradient - the auto increment field. "Richard Hutchins" [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff, When you want to increment an autoincrement field, you just put NULL into the query. For example: INSERT (NULL,'Jeff','php list','Modify MySQL Record') INTO mail; Where NULL is in the same spot in the field list as your autoincrement field. That concept is covered in the MySQL manual. Pretty simple stuff. If you're in a situation where you have an autoincrement field that you sometimes autoincrement and sometimes manually assign a value to, I think you're misusing the autoincrement field (IMHO). If you have that situation, use the autoincrement field to assign a unique ID to the table row and use a separate field with another name for the manually assigned data. As far as the stuff you mentioned about clicking things and getting the messages you expected, I'm kinda' lost. But if you use the autoincrement field as it is intended, the logic should present itself. -Original Message- From: Jeff [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Friday, September 05, 2003 2:07 PM To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Re: [PHP-DB] Modify MySQL Record Ok, so it sorta works now *grin* Two new problems I added an auto increment field in my table and changed the php to reflect that field - But for some reason, it doesn't work.. When I submit a new record, do I need to tell SQL to add one to the greatest, or should it do it automatically when a new record is
Re: [PHP-DB] How to exclude the result of union of two tables from the result of union of other two tables
This can be done in one query using subselects. El Vie 05 Sep 2003 15:49, John W. Holmes escribi: Oz wrote: I have a php page where I would like to list a numer of companies as below: 1- retrieve all distinct company names from TableA (SELECT company_name FROM TableA) CREATE TEMPORARY TABLE temp1 SELECT DISTINCT(company_name) FROM TableA 2- retrieve all distinct company names from TableB 3- combine the two lists as list1 INSERT INTO temp1 SELECT DISTINCT(company_name) FROM TableB 4- retrieve all distinct company names from TableC CREATE TEMPORARY TABLE temp2 SELECT DISTINCT(company_name) FROM TableC 5- retrieve all distinct company names from TableD 6- combine the two lists as list2 INSERT INTO temp2 SELECT DISTINCT(company_name) FROM TableD 7- display company names in list1 that don't exist in list2 SELECT t1.company_name FROM temp1 t1 LEFT JOIN temp2 t2 ON t1.company_name = t2.company_name WHERE t2.company_name IS NULL MySql version is 3.23.56 3.23.56 , so I cannot use UNION. I would like to accomplish this with as little php code as possible, using mostly SQL. How about using all SQL? :) All of this is in the MySQL manual, btw... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- Porqu usar una base de datos relacional cualquiera, si pods usar PostgreSQL? - Martn Marqus |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] date function
Greetings, I have some php code that pulls from the mysql database. Here it is: ?php mysql_connect(wildcat.osborneindustries.com, webuser, webpass); $mymonth = date('n'); $cyear = date('Y'); $query = SELECT name,hdate FROM emp2 where month(hdate)=$mymonth order by hdate; $result = mysql_db_query(iweb, $query); if ($result) { echo table align=center border=0 cellspacing=5 ; while ($r = mysql_fetch_array($result)) { $name = $r[name]; $hyear = date('Y',$r[hdate]); $timein = $cyear - $hyear; if ($timein 0) { echo trtd$name/ttd$timein/tdtd$cyear/tdtd$hyear/td/tr;} } echo /table; } else { echo No data.; } mysql_free_result($result); ? I'm trying to figure out years of employment based on hiredate. Its not working as expected. $timein is always 1969. Date in the database is -MM-DD. What have I screwed up ? thanks, Darryl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unique user ID?
Hi, I want to get a unique ID from a browser. Because i want to replace a cookie with a row in a database (mysql), but i don't want that a user has to open a account, so i want to refer to a unique id from the user's browser. Anybody who knows how to get a unique Id which is the next time the same as the first? Floris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date function
On Saturday 06 September 2003 06:01, Darryl wrote: I have some php code that pulls from the mysql database. Here it is: ?php mysql_connect(wildcat.osborneindustries.com, webuser, webpass); $mymonth = date('n'); $cyear = date('Y'); $query = SELECT name,hdate FROM emp2 where month(hdate)=$mymonth order by hdate; $result = mysql_db_query(iweb, $query); if ($result) { echo table align=center border=0 cellspacing=5 ; while ($r = mysql_fetch_array($result)) { $name = $r[name]; $hyear = date('Y',$r[hdate]); $timein = $cyear - $hyear; if ($timein 0) { echo trtd$name/ttd$timein/tdtd$cyear/tdtd$hyear/td/tr;} } echo /table; } else { echo No data.; } mysql_free_result($result); ? I'm trying to figure out years of employment based on hiredate. Its not working as expected. $timein is always 1969. Date in the database is -MM-DD. What have I screwed up ? date() in php expects a unix timestamp. Dates in MySQL are NOT stored in unix timestamp format. You can perform the calculations directly in MySQL mysql manual Tutorial Introduction Date Calculations -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* People with narrow minds usually have broad tongues. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unique user ID?
Floris wrote: I want to get a unique ID from a browser. Because i want to replace a cookie with a row in a database (mysql), but i don't want that a user has to open a account, so i want to refer to a unique id from the user's browser. Anybody who knows how to get a unique Id which is the next time the same as the first? Can't do it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Oracle connection across page.
I have the following problem, please help me. Many thanks. Script 1: ?php [EMAIL PROTECTED]($o_conn_vars[username], $o_conn_vars[password], $o_conn_vars[db]); //Parse sql statement //Execute sql statement. .. ... require('2.inc'); ? ___ 2.inc: // This script will switch the brower to script2.php html form name=s_form action=script2.php method =POST /html script2.php: ?php My problem is, how to get back the Oracle database connection in this script? Please advise. ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php