[PHP-DB] session and form
hiii all, i've posted this question some days back. but didnt find answer. so posting it again. in my phpscript, some users are allowed to del/modify contents of the database. for this they have been provided login name and password, after user loggs into the secure area, session starts. since here, user can modify/del contents of database, i need to use many forms. arrays have been used to store the checkbox, textbox values which user wants to modify. since these values are submitted thru forms in session, when browsers back button is pressed, it forces to press refresh button, to retrieve the values. and page loads only after pressing refresh button. can any one pls tell me why it happens? and how to pass variables thru form in session ?? smita _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] a where clause question
Hi Alex, I believe your database-design is not good ... think about a re-design or send us some info about your tables. Maybe we find a better solution... Regards, Marcel -Original Message- From: Alex Shi [mailto:[EMAIL PROTECTED]] Sent: 06 October 2002 22:43 To: [EMAIL PROTECTED] Subject: [PHP-DB] a where clause question Hi, I need a where clause in following situation: Say I want to query two tables: A and B. In table A there is field Afn, while in table B there ere 3 fields: Bfn1, Bfn2 and Bfn3. I want to compose a query, in which the where clause can do this: if A.Afn=1, then check Bfn1, if A.Afn=2, then check Bfn2, if A.Afn=3, then check Bfn3. So how I compose a where clause to do this? Thanks in advance! Alex Shi -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] possible Error in Querydefiniton
Hi John W. Holmes, You can find out why with mysql_error(), but it's probably because you haven't selected a database with mysql_select_db(). now I have this code, but with the same result ? mysql_connect(localhost,root); mysql_select_db(finance); mysql_db_query(finace,INSERT INTO buchung (Bezeichnung) VALUES ('b'))or die(Queryfehler); ? I always become the die-message. I'm using PHP Version 4.0.6 Regards, Ruprecht Ruprecht Helms IT-Service und Softwareentwicklung Tel/Fax: +49[0]7621 16 99 16 email: [EMAIL PROTECTED] Homepage: http://www.rheyn.de - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] zend debugger
Hy, I'm having problems with Zend development tool.. anyone can help me in order to run functions like oci* and ora* It not recognize these functions where sholud I have to make changes in order to run zend debugger...otherwise the php is running from the browser but in the debugger it does not recognize these functions... Thanks and I have an ultimate request: Friends from romania please send me an e-mail because i think It's very good for both or third... parties to help each other only for human development... Free Email Account at www.flash.ro -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] possible Error in Querydefiniton
On Monday 07 October 2002 16:16, Ruprecht Helms wrote: Hi John W. Holmes, You can find out why with mysql_error(), but it's probably because you haven't selected a database with mysql_select_db(). now I have this code, but with the same result ? mysql_connect(localhost,root); mysql_select_db(finance); mysql_db_query(finace,INSERT INTO buchung (Bezeichnung) VALUES ('b'))or die(Queryfehler); ? I always become the die-message. I'm using PHP Version 4.0.6 Try adding some error checking code. Have a look at the numerous PHP/MySQL tutorials to find out how it should be done. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Anarchy may not be a better form of government, but it's better than no government at all. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] possible Error in Querydefiniton
Use mysql_error() in your die() message to find out what the problem was... ---John Holmes... -Original Message- From: root@linux [mailto:root@linux] On Behalf Of Ruprecht Helms Sent: Monday, October 07, 2002 4:17 AM To: John W. Holmes Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] possible Error in Querydefiniton Hi John W. Holmes, You can find out why with mysql_error(), but it's probably because you haven't selected a database with mysql_select_db(). now I have this code, but with the same result ? mysql_connect(localhost,root); mysql_select_db(finance); mysql_db_query(finace,INSERT INTO buchung (Bezeichnung) VALUES ('b'))or die(Queryfehler); ? I always become the die-message. I'm using PHP Version 4.0.6 Regards, Ruprecht Ruprecht Helms IT-Service und Softwareentwicklung Tel/Fax: +49[0]7621 16 99 16 email: [EMAIL PROTECTED] Homepage: http://www.rheyn.de - -- 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] possible Error in Querydefiniton
Hi John W. Holmes, Use mysql_error() in your die() message to find out what the problem was... ok, typemissmatch was the problem. Thank for the tip. Regards, Ruprecht Ruprecht Helms IT-Service und Softwareentwicklung Tel/Fax: +49[0]7621 16 99 16 email: [EMAIL PROTECTED] Homepage: http://www.rheyn.de - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Array help needed :-(
Hi there everyone, I have a problem i'm trying to figure out but i'm not too good with arrays, just know the basics, if anyone could help me out on this it would be wonderful :-) I have two sets of data in columns of a MySQL DB, these items are size and price. Size is seperate by comma's in the first column, and I have it split into a dropdown box no problem to read (For example): small medium large but then I have a price field, which contains 1.99,2.99,3.99 etc . what I need to do is when someone selects an item from the dropdown - say small as an example, it would know how to get 1.99 from the price entry in the DB. I guess what I need to do is somehow associate each entry in the price field with those in the size, but I have no idea how to do it :-( Any help would be really appreciated as this stumps the hell out of me. Thanks Chris
[PHP-DB] results of query
What does everyone typically use to display the results of a query. For example, I have a database that has a series of subjects and grades. If I select * from the table, I want a nice way for the data to be displayed. In cold fusion, I can simply use a grid that dynamically fills in. Can I do this with php? Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] results of query
It depends what you want to do with it. To display it in HTML, you can write them in a 2-D array: myarray[$i][$j], where $i is the row nb and $j the column nb, and write two nested loops. To export them to Access, CSV, ... you can issue your query through Access ODBC. You can then save as a CSV. Very simple and effective. Ignatius - Original Message - From: Edward Peloke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 07, 2002 10:07 PM Subject: [PHP-DB] results of query What does everyone typically use to display the results of a query. For example, I have a database that has a series of subjects and grades. If I select * from the table, I want a nice way for the data to be displayed. In cold fusion, I can simply use a grid that dynamically fills in. Can I do this with php? Thanks, Eddie -- 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] results of query
Will this work (assume you're using mysql): function printresult ($rs) { if ($a = mysql_fetch_assoc($rs)) { // Print header echo 'tabletr'; foreach (array_keys ($a) as $v) echo 'th' . $v . '/th'; echo '/tr'; while ($a) { echo 'tr'; foreach ($a as $v) echo 'td' . $v . '/td'; echo '/tr'; $a = mysql_fetch_assoc($rs); } echo '/table'; } else echo 'bNo results found./b'; } You can embellish the resulting HTML code as needed. (Also, please note that I'm doing this from memory... so it might not work right off ;) Marco On Mon, 2002-10-07 at 16:07, Edward Peloke wrote: What does everyone typically use to display the results of a query. For example, I have a database that has a series of subjects and grades. If I select * from the table, I want a nice way for the data to be displayed. In cold fusion, I can simply use a grid that dynamically fills in. Can I do this with php? Thanks, Eddie -- 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] results of query
What does everyone typically use to display the results of a query. For example, I have a database that has a series of subjects and grades. If I select * from the table, I want a nice way for the data to be displayed. In cold fusion, I can simply use a grid that dynamically fills in. Can I do this with php? There is no automatic way to do it with PHP. You have to write the code to display it yourself and this depends on how you want to display it. If you just want to display it in a table, then you can write a generic function to display column names and values in a table given a result set. Assuming $result is a result set from any query. echo table; while($row = mysql_fetch_row($result)) { echo trtd . implode(/tdtd,$row) . /td/tr\n; } echo /table; Adapt to your needs to add error checking, empty fields, header row, etc. You can use the mysql_field_name() functions to get the field names from the result set to create your header row, so you don't actually have to know the names from the query. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] access DB via PHP classes
Hi All, Although I am not so new to PHP (not expert either), this is the first time for me to use PHP class. I am starting a project, and plan to use partially OOP and partially traditional programming. I use PHP/MySQL. I have one class, DB_Do, which does every thing to do with database, and several other classes. When I start my design, I realized that very often, other classes need to access database, eg. I have an Access_Control class which controls all accesses to pages in the application. One of methods in this class is to authenticate the user login via user name and password stored in the database. I am not sure if I should use an object of DB_Do within the method of Access_Control or write separate code to access the database for the user name and password. It seems that I loose purpose of OOP if I write the separate code. However, I am not sure if creating the object within other class is efficient? I would appreciate if some one there could give me some suggestions about this. Thanks in advance. Ruth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Auto Increment
Hi peoples, Just wondering if it's possible with mysql to start an auto-increment field at a specified number instead of 0001? I could always just code it in php to add another number onto it to get it to the right start point, but leaves areas for human error to creep in! Any help would be appreciated! -gav. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] access DB via PHP classes
Well, I'll tell you what I do. I'm not a OOP expert so if someone feel like I'm doing it wrong I'll welcome any comment about . I've got a main class which I use to generate every page in my website (some are actually generated by inherited classes but that's the main idea). As I need a database conection for every page I write the connection threat in the main class constructor using mysql_pconnect which handles a persistent connection. So far it is workin alright for me. As I said before any comments will be welcome. Hope it helps *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Auto Increment
Gavin, You can specify the next auto_increment id by using SET INSERT_ID = #; Where # is your desired number. Will only work for the next INSERT/ALTER. Have a look down the bottom of 7.33 in the MySQL language reference. Cheers, Owen Gavin Nouwens wrote: Hi peoples, Just wondering if it's possible with mysql to start an auto-increment field at a specified number instead of 0001? I could always just code it in php to add another number onto it to get it to the right start point, but leaves areas for human error to creep in! Any help would be appreciated! -gav. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Auto Increment
On October 8, 2002 01:49 am, Gavin Nouwens wrote: Hi peoples, Just wondering if it's possible with mysql to start an auto-increment field at a specified number instead of 0001? I could always just code it in php to add another number onto it to get it to the right start point, but leaves areas for human error to creep in! Any help would be appreciated! -gav. Gavin, One way to approach this is to manual insert one record with the number you want. So, just add a dummy field with an id of 49 for example.. Then the next record you insert will be 50. -- Mark Nenadov, Freelance Software Developer web: www.freelance-developer.com e-mail [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Auto Increment
BTW... you only need to do it once. Subsequent INSERTS will follow on from the previous insert. Owen Prime wrote: Gavin, You can specify the next auto_increment id by using SET INSERT_ID = #; Where # is your desired number. Will only work for the next INSERT/ALTER. Have a look down the bottom of 7.33 in the MySQL language reference. Cheers, Owen Gavin Nouwens wrote: Hi peoples, Just wondering if it's possible with mysql to start an auto-increment field at a specified number instead of 0001? I could always just code it in php to add another number onto it to get it to the right start point, but leaves areas for human error to creep in! Any help would be appreciated! -gav. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Auto Increment
CREATE TABLE table_name (ID INT NOT NULL AUTO_INCREMENT = 1 PRIMARY KEY, ... ); ---John Holmes... -Original Message- From: Gavin Nouwens [mailto:[EMAIL PROTECTED]] Sent: Monday, October 07, 2002 9:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Auto Increment Hi peoples, Just wondering if it's possible with mysql to start an auto-increment field at a specified number instead of 0001? I could always just code it in php to add another number onto it to get it to the right start point, but leaves areas for human error to creep in! Any help would be appreciated! -gav. -- 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] access DB via PHP classes
Thanks Wilmar, for sharing your experience with me. My problem now is that I have already got a class to do every thing related to database. If I don't use this DB class within other classes, I will have a lot of duplicated code. If I do use the DB class within other classes, I am not sure if it is efficient. Thanks again. Ruth - Original Message - From: Wilmar Perez [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 08, 2002 11:53 AM Subject: Re: [PHP-DB] access DB via PHP classes Well, I'll tell you what I do. I'm not a OOP expert so if someone feel like I'm doing it wrong I'll welcome any comment about . I've got a main class which I use to generate every page in my website (some are actually generated by inherited classes but that's the main idea). As I need a database conection for every page I write the connection threat in the main class constructor using mysql_pconnect which handles a persistent connection. So far it is workin alright for me. As I said before any comments will be welcome. Hope it helps *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi All, Although I am not so new to PHP (not expert either), this is the first time for me to use PHP class. I am starting a project, and plan to use partially OOP and partially traditional programming. I use PHP/MySQL. I have one class, DB_Do, which does every thing to do with database, and several other classes. When I start my design, I realized that very often, other classes need to access database, eg. I have an Access_Control class which controls all accesses to pages in the application. One of methods in this class is to authenticate the user login via user name and password stored in the database. I am not sure if I should use an object of DB_Do within the method of Access_Control or write separate code to access the database for the user name and password. It seems that I loose purpose of OOP if I write the separate code. However, I am not sure if creating the object within other class is efficient? I would appreciate if some one there could give me some suggestions about this. Thanks in advance. Ruth -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] array intersect with 2 arrays created from mysql
Hi, If anyone can help me with this I'd be most appreciative. I'm constructing 2 arrays of IDs from 2 different tables. Then I want to compare one to the other and only use the results that both arrays share in common to do a query loop that pulls the information for the related IDs to display. The error I get from the code below is: Warning: Argument #2 to array_intersect() is not an array in /usr/local/www/vhosts/trustbuild.co.nz/htdocs/partners_region.php on line 185 I cant see what is causing the problem. Start of My Existing Code $result = mysql_query(SELECT partner_id FROM partner_region WHERE region_id = '$r' ORDER BY partner_id); if ($row = mysql_fetch_array($result)) { do { partner_region[] = $row['partner_id']; } while ($row = mysql_fetch_array($result)); } if (count($partner_region) != 0) { array_unique($partner_region); } $result2 = mysql_query(SELECT id FROM partner WHERE type = '$t' ORDER BY id); if ($row2 = mysql_fetch_array($result2)) { do { partner_type[] = $row2['id']; } while ($row2 = mysql_fetch_array($result2)); } if (count($partner_type) != 0) { array_unique($partner_type); } $partner = array_intersect($partner_region, $partner_type); if (count($partner) != 0) { foreach ($partner as $p) { $result3 = mysql_query(SELECT * FROM partner WHERE id = '$p'); if ($row3 = mysql_fetch_array($result3)) { do { $company_name = $row3['company_name']; $contact_name = $row3['contact_name']; $physical_address = $row3['physical_address']; $postal_address = $row3['postal_address']; $city = $row3['city']; $phone = $row3['phone']; $fax = $row3['fax']; $email = $row3['email']; $url = $row3['url']; $gst_number = $row3['gst_number']; $company_age = $row3['company_age']; $services = $row3['services']; $region = region($r); if ($count == 0) { echo trtd bgcolor='#FF'a href='closeup.php?id=$id'$region $company_name/abrType: $company_typebrContact Name: $contact_namebr.nl2br($physical_address)./td/tr; $count++; } else { echo trtd bgcolor='#DD'a href='closeup.php?id=$id'$region $company_name/abrType: $company_typebrContact Name: $contact_namebr.nl2br($physical_address)./td/tr; $count--; } } while ($row3 = mysql_fetch_array($result3)); } } } else { echo There are no listings for your criteria. Please try again.br; } End of My Existing Code Thanks in advance for any help with this one, Nigel Dunn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Nevermind...I answered the question myself.
Having a blonde moment the code to this post does work...there was no error handling in the code for the array_intersect() incase either of the arrays contained no data. My mistake. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: array intersect with 2 arrays created from mysql
It may be because your not initialising your array. ie: $partner_type = array(); $partner_region = array(); PHP should automatically make it an array (if its not previously a different type) as soon as you do $partner_type[] but if you get no results from your query then it wont be an array. Cheers, Owen Prime http://www.noggin.com.au Nigel Dunn wrote: Hi, If anyone can help me with this I'd be most appreciative. I'm constructing 2 arrays of IDs from 2 different tables. Then I want to compare one to the other and only use the results that both arrays share in common to do a query loop that pulls the information for the related IDs to display. The error I get from the code below is: Warning: Argument #2 to array_intersect() is not an array in /usr/local/www/vhosts/trustbuild.co.nz/htdocs/partners_region.php on line 185 I cant see what is causing the problem. Start of My Existing Code $result = mysql_query(SELECT partner_id FROM partner_region WHERE region_id = '$r' ORDER BY partner_id); if ($row = mysql_fetch_array($result)) { do { partner_region[] = $row['partner_id']; } while ($row = mysql_fetch_array($result)); } if (count($partner_region) != 0) { array_unique($partner_region); } $result2 = mysql_query(SELECT id FROM partner WHERE type = '$t' ORDER BY id); if ($row2 = mysql_fetch_array($result2)) { do { partner_type[] = $row2['id']; } while ($row2 = mysql_fetch_array($result2)); } if (count($partner_type) != 0) { array_unique($partner_type); } $partner = array_intersect($partner_region, $partner_type); if (count($partner) != 0) { foreach ($partner as $p) { $result3 = mysql_query(SELECT * FROM partner WHERE id = '$p'); if ($row3 = mysql_fetch_array($result3)) { do { $company_name = $row3['company_name']; $contact_name = $row3['contact_name']; $physical_address = $row3['physical_address']; $postal_address = $row3['postal_address']; $city = $row3['city']; $phone = $row3['phone']; $fax = $row3['fax']; $email = $row3['email']; $url = $row3['url']; $gst_number = $row3['gst_number']; $company_age = $row3['company_age']; $services = $row3['services']; $region = region($r); if ($count == 0) { echo trtd bgcolor='#FF'a href='closeup.php?id=$id'$region $company_name/abrType: $company_typebrContact Name: $contact_namebr.nl2br($physical_address)./td/tr; $count++; } else { echo trtd bgcolor='#DD'a href='closeup.php?id=$id'$region $company_name/abrType: $company_typebrContact Name: $contact_namebr.nl2br($physical_address)./td/tr; $count--; } } while ($row3 = mysql_fetch_array($result3)); } } } else { echo There are no listings for your criteria. Please try again.br; } End of My Existing Code Thanks in advance for any help with this one, Nigel Dunn -- Cheers, Owen Prime http://www.noggin.com.au -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Array help needed :-(
In article 000801c26e10$a2128510$f7fea8c0@chris, [EMAIL PROTECTED] says... Hi there everyone, I have a problem i'm trying to figure out but i'm not too good with arrays, just know the basics, if anyone could help me out on this it would be wonderful :-) I have two sets of data in columns of a MySQL DB, these items are size and price. Size is seperate by comma's in the first column, and I have it split into a dropdown box no problem to read (For example): small medium large but then I have a price field, which contains 1.99,2.99,3.99 etc . what I need to do is when someone selects an item from the dropdown - say small as an example, it would know how to get 1.99 from the price entry in the DB. I guess what I need to do is somehow associate each entry in the price field with those in the size, but I have no idea how to do it :-( Any help would be really appreciated as this stumps the hell out of me. Thanks Chris I think you may have a problem with your database design? Can you explain a little more exactly what it is you are trying to do and perhaps someone can advise on how your data might best be structured. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php