Jump to content

HenryCan

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by HenryCan

  1. Thank you, mac_gyver and ginerjm. I imitated the approach you suggested and everything is working fine now.
  2. I want the checkboxes to be INITIALLY checked but if the user unchecks some of them before pressing Submit and then I have to redisplay the form to show error messages in other fields, I need to display the ones he unchecked as unchecked when I display the errors. If I just hard-code "checked" in the checkbox description, I don't see how I'm going to uncheck them programmatically and keep them unchecked on the form.
  3. How do I turn a checkbox on or off programatically? My form has several checkboxes that are grouped together and I want them to be turned on initially when the user first sees the form.I can do that very easily by just including "checked" in the HTML for the checkbox. But if the user turns off the checkbox before he presses Submit, I want to make sure I show the ones that are off as off when I redisplay the form as a result of errors in other fields, like textareas. How do I turn the checkbox off or on within my PHP code?
  4. I'm developing a form which is essentially a simple set of radio buttons. Conceptually, it is like this: Please select a theme from the list: o Black o Blue o Red [submit] [Reset] I'm actually showing a slideshow of images showing the appearance of each of the themes in a slideshow that only shows one image at a time. I want my users to click on the image that represents the theme they want and, ideally, not have to click on the Submit button at all. Then I will save the name of the theme they chose in a cookie (if cookies are enabled). Many years ago, I dabbled in things like CGI and I have a vague recollection, possibly faulty, that it's not difficult to make a form that has only one set of radio buttons treat the selection of one of the radio buttons as a Submit. I don't remember how to do it though. Can anyone advise me on whether it is indeed possible and, if it is, how I make the selection of the radio button cause the form to be submitted?
  5. Please see my reply to Davidannis. I really don't want to bring JavaScript into the situation since some visitors will certainly have it turned off. I think your approach would make me send the visitor to the Preferences page if he hasn't already set some Preferences and I'm reluctant to do that. Also, what do you mean be having one cookie be an array with all the settings? Is there some reason that a single complex cookie is a much better choice than several simple cookies? And aren't I going to run into issues with the max cookie size of 255 bytes? (At least I think that's what it was back in the early days; perhaps it has been increased in recent years.) I don't actually know how much data I will have to save yet. I'm prototyping a design of my own creation. I may end up letting my visitors choose preferences for a whole bunch of things or maybe just a small handful. It depends on the feedback I get as I test. If they want more control, I'll have to save more data. Multiple simple cookies, each with a clear purpose, seems a little easier at first glance than having to make up a lot of very short codes for everything (assuming many values to be saved) and then packing and unpacking/parsing all of that information once I retrieve the cookie. But that's just an initial reaction. I'm open to trying to cram everything into a single cookie if there is some large benefit to it.
  6. Please see my reply to Davidannis. I don't think I'm likely to generate enough preferences to need a database table. In any case, I'm not awfully worried about database work; I've done lots of that. Some of it was even with PDO and MySQL, both of which are available in my current environment ;-) Hmm. Am I understanding you correctly? Are you proposing a database table INSTEAD of cookies? Or are you suggesting them as a supplement to the cookies? If the latter, what is the table going to do that the cookie doesn't?
  7. The gist of it is that you can't fetch a newly-created cookie immediately after creating it: you have to send a new batch of headers before you can possibly see the new cookie. These are the top two search engine hits to my question: http://stackoverflow.com/questions/6663859/check-if-cookies-are-enabled -and- http://stackoverflow.com/questions/9448424/detect-if-cookies-are-enabled-in-php All the replies seem to get criticized for something or another, although I may be misunderstanding what I'm reading. As for your suggestion, I'm struggling a bit with how to distinguish between the case of: 1. no cookie has been set because the visitor has never been here before 2. no cookie has been set because the visitor has disabled cookies (or someone did it for them and they don't realize they are disabled) I'd like to avoid offering the visitor a Preferences page if it isn't possible for me to save those preferences in a cookie. If they arrive on the Preferences page on their own, I'd like to be able to write code that tells them that cookies are disabled so they will need to enable them before trying to save any preferences. I'd show that message right at the top in bold different coloured text so they couldn't miss it and would probably disable the Submit button as well, only re-enabling it if they can actually save a cookie. I'd rather not force visitors to go to the Preferences page if I can avoid it. Most of them will be perfectly happy with the default values that get set if no Preferences have been selected. I don't want to pressure them to enable cookies just so that I can store Preferences that are identical with default values. I certainly don't want to keep nagging them on every page that cookies are turned off and they should turn them on since many visitors will want to go with values that aren't the default I'm fine with giving them default values if no cookies exist because they haven't been to the site before and haven't chosen any Preferences. I'd rather not force everyone to go to the Preferences page, even if all they have to do is click Submit to save the defaults. However, I might be arm-twisted into going for that if it's the only reasonable way forward.
  8. I want to give the visitors to my site the option of setting certain preferences and remembering what was chosen from one visit to the next. They might have the choice of setting the backgrond colour of the web page or the font or whatever. I've already written and tested code to write standard cookies that preserve their choices. However, I'm wondering if that's the best way or if there is a better approach. I don't want visitors to have to re-choose their preferences every time they arrive at the site, which would appear to be the result of using a session cookie stored on the server. If standard cookies ARE the best solution for my situation, how can I test if the visitor has cookies enabled on their browser? I know that some people definitely don't enable cookies and I'm quite prepared to advise them that they won't be able to save preferences until they enable cookies. However, I first need to know how I can tell definitively if cookies are enabled. Most of the simple code examples I've found by googling simply try to write a cookie and then try to read it; if both succeed, they think the they've established whether cookies are enabled. The more sophisticated examples, particularly those at stackoverflow, come closer but all of them seem to be critiqued by someone to the effect that they won't work in this or that particular situation. Given how long cookies and PHP have been in existence, I have to believe that SOMEONE has figured out a definitive way of testing whether cookies are enabled that works in all reasonable circumstances. Can anyone share that technique with me?
  9. I may be jumping the gun a bit in giving the Ch0cu3r a "Best Answer" for his reply but it will definitely get me started. Thank you for suggesting this tutorial. I've only skimmed it but it looks like it will cover the necessary ground.
  10. I'd like to write - or acquire - code that displays a simple table (name, phone number, email address, plus a comments field) on a web page in a password-protected page and allows a user to add his own information, update it or delete it. I figure hundreds of people and companies have written something like this so I'd like to find either an example I can imitate or even an existing package that I can simply customize to the specifics for my own table. Can anyone help me with that? Or am I going to have to reinvent the wheel for the gazillionth time and write it myself?
  11. I'm an experienced programmer with several languages (COBOL, REXX, Java, Javascript, etc.) under my belt over many years but I know very little about PHP. I dabbled in it a bit a year or two back and got it to do what I wanted to do but I'm not sure how to do what I currently need. A bit of context: I have designed a website where the user can choose between various page styles; each style invokes different CSS to give them a different visual experience of the site. They can select the style they want via View/Style in Internet Exploder and View/Page Style in Firefox but that preference is only remembered as long as they're on that page. As soon as they move to another page on the site, they have to choose the alternate style again or live with the default style. I want them to be able to select that preference ONCE, the store it in a cookie specifically for them, then keep using that style every time they visit the site. (Naturally, I want them to be able to change the style and then remember the new style as well.) There will be many visitors and each will want that same capability. I currently don't require any login to the site. (I'm toying with password-protecting some of the site down the road but that's not a factor in this page style thing that I'm talking about here. Now, my questions. I've found a variety of short articles describing how to use setCookie() to create the cookie (and delete it later) and getCookie() or the newer echo $_COOKIE["name"] to determine the cookie value. However, I am NOT seeing anything that says where I put the code to set and/or read the code within my web pages. I would really appreciate an explanation of that! I expect to write short fragments of php code to do those jobs which I will then imbed within my web pages via SSI (Server Side Includes). Is that reasonable or is there a better way? Also: 1. When the user clicks on the desired Style in the View/Style menu, how do I detect what choice they made? 2. Should the name of the cookie be something like "pageStyle" or should it be something that uniquely identifies the user so that the right cookie is retrieved when the come back? If the latter, what value should I use and how should I obtain it? I assume that something unique about the user obtained from their headers is far better than displaying a dialog and asking them for some unique identifier. I'd rather stay away from Javascript in any of this functionality since I can't rely on it being turned on. One quick aside while I'm here. Does anyone know how to change the page style if visitors use Google Chrome or Opera? I can't even FIND options for changing the page style in my copies of those two browsers and both are current versions. Do they not support differing page styles at all or do they just hide the technique to choose the style very effectively? -- Henry
  12. I agree with trq. Mind you, I used to teach Database Design (for money) and the best approach for many-to-many relationships is to build an association table, sometimes called an intersection table. I've never heard it called a binding table before but I'm guessing it's the same thing. In any case, it would look like this, assuming you have a real many-to-many relationship. In other words, if a given product could be in many stores and a given store could have many products, which would be the way most retail chains work, you'd organize the tables like this: PRODUCT Table: one row for each distinct product - primary key = product_id Product_ID Product_Description 1 Toaster - 4 Slice - Hamilton Beach 2 Computer - Laptop - Model K54N - ASUS 3 Bicycle - 10 speed - Schwinn STORE Table: one row for each store - primary key = store_id Store_ID Store_Location US1 West Valley Mall - Fresno - California UK1 27 Hilldale Lane - Brighton - UK DE1 Meyerstrasse 15 - Berlin - Germany [Note that the description information in the PRODUCT and STORE tables is likely going to be more elaborate and broken out into several columns but the key thing is that there will be a primary key consisting of something that uniquely identifies each product or store.] Then, your association/interesection table. PRODUCT_STORE table : one row for each store in which a given product is carried - primary key = product_id || store_id Product_ID Store_ID Quantity 1 US1 50 1 DE1 10 2 UK1 20 2 US1 85 3 US1 14 3 UK1 27 3 DE1 15 [Note that I've added some extra data that doesn't belong with either the product or store directly just to show you how useful that association table can be. The quantity represents how many toasters, bicycles or whatever are situated in each store. It's the inventory so that a customer can determine if you have that item in a given store in sufficient quantity for him to buy as many as he needs. (I'm picturing a guy who wants to buy several laptops for his business rather than just one for himself.) It's important to note that the quantity is not the quantity of all laptops or bicycles that your company owns, just the number that you have in a given store. But if you want to know how many you have in your whole chain, you can easily add them up from the information in the Quantity column.] It's not that putting a concatenation of locations on the product table is impossible but it's a heck of a lot harder in the long run. A professional database designer MIGHT go the way you want to go if the costs and benefits make it a reasonable approach but that isn't going to happen that often. Professionals are pragmatists and may choose not to employ full normalization of data but only if they do a proper cost-benefit analysis that says it makes sense to go that way.
  13. Sorry, Jonline, your last remark is not completely clear. Am I correct in understanding that if I simply wait with writing the </body> and </html> tags until I have nothing more to write, everything will be fine? Or are you saying it's already fine the way it is now?
  14. I'm happy to tell you that I have an answer and it's mostly good news. According to a guy at IBM's Toronto Lab, where they develop DB2 for Windows, Linux and Unix, you CAN access DB2 iSeries data via PDO. That's the good news. And since you're getting it from a guy at the Toronto Lab who works for IBM, I think you can be quite certain that this is an accurate answer, not just someone indulging in wishful thinking. The only wrinkle is that you apparently need to use DB2 Connect to accomplish this. I have only a very vague idea about what DB2 Connect offers and what it costs but I've found you a web page that gives you some basic information and lets you request a quote. That way, you can figure out if it is worthwhile to buy DB2 Connect or if it is better to just stay with ODBC which you seem to be able to do without buying any other products. Here's the link to DB2 Connect: http://www-142.ibm.com/software/products/us/en/db2connfami/
  15. I would like to password-protect a few parts of my website so that only members of my book discussion club can access those pages. The vast majority of the site will stay open to visitors who don't belong to the club. I should mention that I am using two different hosting services, one for the main copy of the website and one for the backup site. (The backup site is where I make changes and see how the club members like them before copying the changes to the main site.) The two hosting services offer somewhat different services so may operate different web servers (or maybe just different levels of Apache for all I know). The main site doesn't even offer databases with their free accounts. (Hmm, maybe i need to move the main site to one that has more facilities....). I've been googling for info about password-protection and have seen a variety of techniques suggested. I haven't tried any of them so I have no idea which ones work best. I'd rather not have to try several of them before finding the right one. I'm hoping people here can make a case for one or two approaches so that I can decide, then point me to tutorials on how to write the code for that solution. The information that we'd protect is not terribly sensitive, the way credit card information would be. I'm mostly just trying to keep personal information like lastnames, phone numbers, and email addresses out of view of non-members. I'd also like to ensure that certain actions - like accessing forms for proposing future meeting topics - are done only be members of the club. The other factor I should mention is that we have no money to spend on this. I'm willing to invest some time but we have no budget for buying something off the rack.
  16. Yes, you can see/try the form yourself by going to http://sfl.x10host.com/topic_proposal_theme.php. I can certainly try the change you're proposing but isn't it still going to get written AFTER the </html> tag? If so, is it really worth doing? And yes, I think you'll see in my code that all the echos that I'm doing in topic_proposal_theme.php will get written after the original form page (topic_proposal_them.shtml), which includes an </html>, has already been written. The "thank you" page gets written after that so it is inevitably too late to be written before the </html> tag. Is my solution as simple as not including the </body> and </html> tags in topic_proposal_theme.shtml and simply putting it on the "thank you" page? I'm not sure if the three individual pages should all pass HTML validation as separate files? Or is it okay if they are viewing more as fragments that won't pass an HTML validation separately?
  17. Here is the code then. First, the main .shtml page. As per Christian's request, I'm omitting the vast majority of the JQuery code. It seems to work just fine and it is positioned the same as in the various examples I found online. This file is topic_proposal_theme.shtml: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Meeting Topic Proposal - Theme</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.js"></script> <script> $(document).ready(function(){ $("#topic_proposal_theme").validate({ // jQuery code - omitted }); }); </script> <style type="text/css"> label.error { float: none; color: red; background-color: yellow; padding-left: .5em; vertical-align: top; font-weight:bold} </style> <link rel="stylesheet" type="text/css" href="css/main.css" media="screen"/> <link rel="stylesheet" type="text/css" href="css/print.css" media="print"/> </head> <body> <h1>Meeting Topic Proposal - Theme</h1> <form id="topic_proposal_theme" method="post" action="topic_proposal_theme.php"> <p>Use this form to make a suggestion for a future meeting topic. Complete the form and press the Submit button. To clear the form without submitting it, press the Reset button.</p> <div id="errorbox"><ul></ul></div> <p>Topic proposal submitted by (e.g. Doug B.): <input type="text" name="proposer" id="cproposer" size="30" maxlength="30"/></p> <fieldset><legend>Proposed Topic</legend> <p>Title (e.g. The future of Genetic Engineering): <input type="text" name="title" id="ctitle" size="50" maxlength="50"/></p> </fieldset> <p></p> <p>What will we discuss? (e.g. How human beings will change physically and emotionally if genetic engineering proceeds.)</p> <p><textarea name="discuss" id="cdiscuss" rows="10" cols="50"></textarea></p> <p>What, if anything, do we have to do to prepare for the meeting? (e.g. Read a Wikipedia article on genetic engineering and any novel in which genetic engineering is a key plot element.)</p> <p><textarea name="prepare" id="cprepare" rows="10" cols="50"></textarea></p> <p><input type="checkbox" name="related" id="crelated" value="Related">There is a related topic that should be presented at the same meeting.</p> <p>Additional Comments (e.g. It would be helpful if you could prepare a list of genetic enhancements that you would like to have.):</p> <p><textarea name="comments" id="ccomments" rows="10" cols="50"></textarea></p> <p> <input type="hidden" name="_submit_check" value="1"/> <input name="submitForm" id="submitForm" type="submit" value="Submit"/> <input name="reset" id="reset" type="reset" value="Reset"/> </p> </form> <p><!--valid XHTML 1.0 Strict code--><a href="http://validator.w3.org/check/referer"> <img class="noprint unbordered" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict!" height="31" width="88"/></a></p> </body> </html> This is the PHP code, topic_proposal_theme.php. This one is complete. I'm not enclosing the SQL that creates the table. The insert works just fine and I have no concerns about it. <?php $debug = 0; $Defaults = array(); $Errors = array(); include('topic_proposal_theme.shtml'); if ($debug) { echo 'Current php version: ' . phpversion() . '<br/>'; //Gives 5.3.19 on absolut server on 2013-01-18 echo 'Request method: ' . $_SERVER['REQUEST_METHOD'] . '<br/>'; //determine request method } if ($debug) {echo "Count: " . count($_POST) . "<br/>";} /* If any of the form elements were completed, validate them. If all elements were valid, insert a record * to the database. */ if (count($_POST) > 0) { $Defaults = $_POST; $proposer = $_POST['proposer']; $title = $_POST['title']; $discuss = $_POST['discuss']; $prepare = $_POST['prepare']; $related = $_POST['related']; $comments = $_POST['comments']; if ($debug) { echo "Proposer: $proposer<br/>"; echo "Title: $title<br/>"; echo "Discuss: $discuss<br/>"; echo "Prepare: $prepare<br/>"; echo "Related: $related<br/>"; echo "Comments: $comments<br/>"; } /* Verify that all mandatory fields contain data. */ if (empty($proposer) || strlen(trim($proposer))==0) { $Errors[] = 'The name of the person proposing the topic is a required field. Example: Bob T.'; } if (empty($title) || strlen(trim($title))==0) { $Errors[] = 'The title is a required field. Example: The future of genetic engineering'; } if (empty($discuss) || strlen(trim($discuss))==0) { $Errors[] = 'The discussion is a required field. Example: Consider how human beings will change physically and emotionally if trends continue.'; } if (empty($prepare) || strlen(trim($prepare))==0) { $Errors[] = 'The preparation is a required field. Example: Read a Wikipedia article and Holy Fire by Bruce Sterling.'; } //Ensure that the description of what is to be discussed does not exceed the maximum. $max_discuss_length = 500; if (strlen(trim($discuss))>500) { $Errors[] = 'The discussion cannot exceed $max_discuss_length characters. Please shorten your input.'; } //Ensure that the description of the preparation does not exceed the maximum. $max_prepare_length = 500; if (strlen(trim($prepare))>500) { $Errors[] = 'The preparation cannot exceed $max_prepare_length characters. Please shorten your input.'; } /* Cross checks */ //None if (count($Errors)==0){ echo "<h3>Your data has all been validated successfully. Attempting to insert into database...</h3>"; //If the related checkbox is unchecked, pass a value of No to the database. Otherwise, pass Yes to the database. $related = ($related=="") ? "No" : "Yes"; Insert_Proposal($proposer, $title, $discuss, $prepare, $related, $comments); } else { echo "<h4>The form contains errors as noted below. Please fix them and then press the Submit button again.</h4>"; foreach ($Errors as $oneError) { echo "<p class='red'>" . $oneError . "</p>"; } } } function Insert_Proposal($proposer, $title, $discuss, $prepare, $related, $comments) { $debug = 0; //temporary include('#pdo-signin-insert.shtml'); //Sign in, connect and select database $date_proposed = date('Y-m-d'); //The date is generated here, not obtained from the form. if ($debug) { echo "Date proposed: $date_proposed<br/>"; echo "Proposer: $proposer<br/>"; echo "Title: $title<br/>"; echo "Discuss: $discuss<br/>"; echo "Prepare: $prepare<br/>"; echo "Related: $related<br/>"; echo "Comments: $comments<br/>"; } try { $stmt = $db->prepare("INSERT INTO TopicProposals_Themes(Date_Proposed, Proposer, Title, Discuss, Prepare, Related, Comments) VALUES (:date_proposed, :proposer, :title, :discuss, :prepare, :related, :comments)"); $stmt->execute(array(':date_proposed' => $date_proposed, ':proposer' => $proposer, ':title' => $title, ':discuss' => $discuss, ':prepare' => $prepare, ':related' => $related, ':comments' => $comments)); $affected_rows = $stmt->rowCount(); } catch (PDOException $excp) { echo "Error during insert into TopicProposals_Themes. Message: " . $excp->getMessage(); exit(1); } include('topic_proposal_accepted.shtml'); } ?> And this is the "thank you" .shtml file. I doubt there's anything controversial in it, although I can't help but wonder if I need some code that "clears the screen" (deletes the HTML that was previously being displayed) before the Thank You page appears. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" > <head> <title>Thank You!</title> </head> <body> <h1>Thank you!</h1> <p>Your proposed topic has been added to the database. It will be considered at the next planning session. Planning sessions are typically held during the regular June and December meetings.</p> <p>You can <a href="choosing_topics.shtml">make another suggestion</a> or <a href="index.shtml">return to the home page</a>.</p> <p><!--valid XHTML 1.0 Strict code--><a href="http://validator.w3.org/check/referer"> <img class="noprint unbordered" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict!" height="31" width="88"/></a></p> </body> </html>
  18. I've been messing around with form validation and have got my code working quite well. I've replaced all the mysql() calls with PDO code and it is all working. I'm validating the form input on the client side via JQuery's validate plugin and validating it again on the server side with PHP code. I've tested the server validation with Javascript disabled in my browser and it works fine. But I have a bad feeling that I'm not doing things in the best way. I'm still new at PHP and I suspect that my basic design is just not what it should be. I hope people here can suggest a better approach. I've basically got three files associated with each form: an .shtml page that contains the form itself and invokes JQuery to validate the contents of the form on the client side a php file that re-validates the input data from the form and then inserts a row to a mysql database via PDO a "thank you" .shtml page that confirms that the data has been successfully stored in the database The PHP file includes both of the .shtml pages and the main .shtml page, the one with the form, identifies the .PHP file in the Action parameter. Here's why I think the design is not right: Error messages from server validation appear at the bottom of the same page containing the form. That's actually what I want but I'm concerned that when I look at the page source in the browser, it shows the errors are written after the </html> tag. That doesn't feel right to me. By the same token, if there are no errors, I write a couple of lines of text to the page that tell the user that there were no (server-side) validation errors and that the data was successfully written to the database. Those lines also appear at the bottom of that same page after the </html> tag. Assuming there were no server-side validation errors, the contents of the "thank you" page appear directly below everything else on the page. Again, that is after the </html> page. Am I correct in believing that my design is not ideal? I'd be willing to post my code here if it would help you get a better picture of what I'm doing. In fact, I asked a week or two back if I could post it and get people to walk through it but no one replied one way or the other to indicate if that was acceptable in this forum so I took that as a "no".
  19. Congratulations on getting ODBC working for you! I know it's not what you ultimately want but at least it lets you get to your data with your existing infrastructure. I suspect that PDO is also possible but I'm checking on the comp.databases.ibm-db2 newsgroup for you. If I forget to come back and tell you what I found out, you can access the newsgroup yourself with any newsreader and see what the responders have said. It might take a few days. The newsgroup is active but to the point of dozens of posts a day.
  20. I'm really not going to be able to do much more than I already have. I've never accessed an AS/400 from Linux and have no idea of how it is done or even if it can be done. I once had a colleague ask me for help connecting a Windows client to AS/400 but I didn't even know how to do that ;-) It seems possible that a Linux box can talk to an AS/400 but I would check that out just to be sure you're not trying to do something impossible. You could spend a lot of time chasing your tail for nothing if it isn't possible. The fact that Windows can talk to AS/400 isn't conclusive proof that Linux can too. If you do some googling, you can probably find out almost anything you'd ever need to know. If it was me, I'd google on "DB2 iSeries Linux PDO" and see where that takes you. Or look for iSeries forums then see if you can find someone there that has connected Linux to AS/400 for purposes of doing DB2 work. If you use Usenet, there's a newsgroup there that might be helpful. The people there are mostly mainframe and Windows/Unix/Linux guys but I think there are occasionally questions about iSeries. The newsgroup is called comp.databases.ibm-db2. It's still fairly active.
  21. I'm a little rusty with DB2 and have no experience accessing it with PDO but I found this tutorial which seems promising: http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html#4.9 They refer to it as IBM rather than DB2 but the information might be helpful to you. If not, look at the DB2 reference manuals, particularly the Messages and Codes manual (or whatever they call it these days) for details of SQL10007N. It will tell you what reason code 3 is and might tell you what message 0 is. You should be able to find all of the iSeries manuals at the IBM website. (I mostly use the Windows/Linux/Unix version and sometimes the mainframe version so I'm not sure what the URL is for iSeries.) It's possible the iSeries manuals will also cover PDO access to the database but I can't say that for sure without seeing the manuals. Hmm. I think we have a fundamental problem here. I just found the iSeries manuals - http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/rzahf/rzahfli0.htm - and I'm getting the impression that iSeries runs on the AS/400, not Linux. I'm certainly not finding an SQL10007N message in the Messages and Codes book. Are you accessing an AS/400 from a Linux client? I think that's possible although I never actually tried it myself. But I can't see how it could give you a non-existent error message under those circumstances unless these manuals are very old. (I don't see any publication dates on anything at this site so it's possible these are not current manuals.) If you're actually running DB2 for Windows, Unix and Linux rather than iSeries, the description for SQL10007N is here: http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.messages.sql.doc%2Fdoc%2Fmsql10007n.html If you enter PDO in the search box on the top of that page, it takes you to a long list of hits that describe using PDO to access DB2. The first of those hits is this: http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.php.doc%2Fdoc%2Ft0023135.html If that doesn't help, maybe the other hits on that list will get you going in the right direction. I hope some of this helps.... I
  22. Jessica, you're right. I've discovered PDO and written all my newer code to use it. I just have to go back and retrofit the old stuff with PDO.
  23. Thank you VERY much requinix! I completely misread the example I found and thought I was seeing ==> where it was only =>. I'm past that problem and on to a new one ;-)
  24. I just realized I had a way to get some information about PDO in my installation of PHP: info.php. I had a look at its list of values and found a few that mentioned PDO: PDO PDO support enabled PDO drivers sqlite, mysql, sqlite2 pdo_mysql PDO Driver for MySQL enabled Client API version 5.1.65 Directive Local Value Master Value pdo_mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock pdo_sqlite PDO Driver for SQLite 3.x enabled SQLite Library 3.7.7.1 This confirms that I have PDO, right? Do I need to have any standard statements in my program in order to access PDO? For instance, in Java I'd import the Java classes that I was using in my program. Is there a PHP equivalent that I need to do if I'm using PDO in a given program?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.