Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. http://us.php.net/manual/en/control-structures.foreach.php
  2. About the only affect outputting the phpinfo() content would have on getting output from your code to work is if you have some buffering that is not being satisfied or a content-type problem... It would really help if you posted your code. For all we know you are doing this inside of a HTML tag and any errors or output are appearing in the "view source" of the page but are not being rendered. Also, what exact lines did you add or alter in the httpd.conf? Because this sounds like a content-type problem.
  3. Good God again, the original code produces 'A database error occurred.' when the page is not requested with proper GET parameters and when a database error occurs. Yet another violation of good programming practices.
  4. The code I posted removed the header() redirect at the end. If your web server/php has output buffering turned on in the php.ini and you redirect, you will never see the result of the mysql_error().
  5. Not if you use a LEFT JOIN. All the records from the left-hand table will be used, even if there is no matching value in the second or right-hand table.
  6. It is too straight-forward, while it is checking for some of the possible errors (all at once so you don't know which one is failing) it is not checking for any where near all the possible errors. See this link for more error checking and error reporting ideas - http://www.phpfreaks.com/forums/index.php/topic,278952.msg1320835.html#msg1320835 Edit: and please remove the @ from in front of your mysql_ functions. Don't you suppose that if you were getting errors when you called those functions that you would want to know about them as they could be relevant to why your code is not doing what you expect? You should NEVER put @ in code to suppress errors.
  7. Good God, that code from your book is a joke. You should perform error reporting at the point where the error was detected. By redirecting all over the place, you are not carrying over the information about what caused the error. These are the lines from the end of the first code you posted - if (@mysql_query ($query, $connection)) { header("Location: example.8-5.php?status=T&" . "phonebook_id=". mysql_insert_id($connection)); exit; } } // if empty() header("Location: example.8-5.php?status=F"); ?> Change them to this - if (mysql_query ($query, $connection)) { header("Location: example.8-5.php?status=T&" . "phonebook_id=". mysql_insert_id($connection)); exit; } else { // the query failed, do some basic error reporting - echo mysql_error(); } } // if empty() ?>
  8. On the mysql host you are trying to connect to, the username/password does not have any access. Are you sure the host name you are using is correct for your account? Most shared web hosts have multiple mysql servers.
  9. All string data that is placed into a query must be escaped so that any special sql characters in the string don't break the sql syntax of the query. See the mysql_real_escape_string function. I'm also going to guess you are getting the "Result failed" message that your code outputs when a query fails? If you bother to mention what you see in front of you, you can get faster and better solutions to your problem.
  10. The code you are trying has no error checking or error reporting logic in it to get it to tell you why it is failing. Try the code at this link - http://www.phpfreaks.com/forums/index.php/topic,278952.msg1320835.html#msg1320835
  11. When you do a "view source" of your form in your browser is it as expected? It would take seeing your form processing code in order to be able to tell what it is or is not doing.
  12. Why did you even start another thread for this same problem. It is not a HTML problem. Your logic on the page is incorrect and is not outputting the correct content when your code detects invalid user supplied input. Your existing thread where several people tried to help with the logic - http://www.phpfreaks.com/forums/index.php/topic,279665.0.html Until you fix the logic on the page to output what you want when you want it, your page won't work. That is the whole point of programming.
  13. The missing </table> tag is what is causing your most immediate problem. But if you are trying for a XHTML strict doctype, you need to work on the missing <body> tag, the UPPER-CASE tags, and everything else in the HTML output that is resulting in 28 Errors and 2 warning(s) at the w3.org validator.
  14. What's the code in test.php? From your description of what the posted code is doing, it is likely that it is redirecting to test.php but then test.php is redirecting to the login form page.
  15. Until you read or post the part of the error message that states where the output is occurring at that is preventing the headers from working, you cannot solve the problem.
  16. You have an exit; statement on the line of code that outputs your error message, so of course nothing else is output on the page after the error.
  17. mrMarcus actually did answer your question, because you are basically asking how to fetch the row that the query returned - $res = mysql_fetch_array($result); You then reference the correct elements of $res and assign them to $_SESSION variables - $_SESSION['fname'] = $res['fname']; .. repeat for the other columns that your query returned
  18. Or you can just do this a simple way - http://www.phpfreaks.com/forums/index.php/topic,279649.msg1324475.html#msg1324475
  19. In the code you originally posted, then removed when you edited the post, you were using implode() to get your current string. All you would need to do is alter the impload() to add single quotes next to the comma and then add some single-quotes to the start and end of the complete string. Since I don't know what variables you were using in your original code, take a look at this - <?php $output = "john,18,Cancer"; $together = implode("','",explode(',',$output)); $output = "'$together'"; echo $output; ?>
  20. Just changing the character set/collation of existing tables won't change the data in the tables, it will just make it non-displayable. Since a fresh install of phpbb3 has all the tables with the utf8 character set and collation, best guess is that you got to this point through an upgrade. You will need to do an export of your existing data, convert the data and the tables, and import the data back in to get this to work. There might be a phpbb mod or a utility to help with this, but your best bet would be to export your existing data in a format that can be imported into a new installation of phpbb3.
  21. Ummm. Which version of phpbb are you using, because phpBB3 supports UTF8 natively. Perhaps it is time to upgrade...
  22. Just an FYI to gevensen on anyone else that happens upon this thread - and - No they did not. The array was not empty. It contained an element, but the element contained a null value, which I why I asked more than once for you to provide actual information that you were seeing in front of you. When you post actual information, you can get solutions a lot faster.
  23. Under Windows, php converts each / to a \ before passing the command to the operating system. The issue is a missing / before the ..
  24. Read the error - Does C:\inetpub\wwwroot\SpecialsAdmin../shop/Item/Brochures/Row1/Brochure.pdf look like a correctly formed and valid path statement?
  25. If you don't know how to perform basic queries to store and retrieve information in a database, your first step would be to read a php/mysql book or start checking out the tutorials posted all over the Internet. Here is one to get you started - http://w3schools.com/php/php_mysql_intro.asp
×
×
  • 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.