Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. It's also a good idea to validate and display the errors for all of the form fields at once, rather than displaying only the first error found, fix that, resubmit, fix the next error, resubmit...
  2. A) Don't use a series of named variables, $n1, $n2, ... Use an array (arrays are for sets of data, which is what you have.) B) Instead of an echo statement, you would assign the value to an array element. Programming is about doing what you want when and where you want it to happen. C) Done!
  3. The only reason count got mentioned in the replies is because your post implied that the auto-increment value was somehow a counter and that you expected it to have a specific count value rather than an id - Edit: They are already working properly.
  4. Supprizingly, there is a function to do this directly in your query - http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff No slow php code is needed.
  5. Your are trying to use php include statements to copy/paste together a web page. In order to do that you need to switch from having your include files output (echo/print) the content to just having them produce the content, then you output the content all at once after you have determined what is going to be on the page.
  6. One of the accounts is probably using a short session.gc_maxlifetime in a misguided attempt to 'automatically' log out visitors. Each account should set their session.save_path to point to a 'private' folder within their own account's folder tree so that only their session settings, and not the settings of the other accounts, will affect their session data files.
  7. mysql_fetch_array() only fetches ONE ROW from the result set. You would need to use a while(){} loop to fetch all the rows from the result set.
  8. You are defining the TITLE in a file that you are including after you include the header.php file that is testing if TITLE is defined. Computer programs don't have the ability to go back in time. You must define TITLE before you test and use it.
  9. Given that the code you posted in the first post is not the code in your file, that produces the error, it would take seeing the actual code that produces the error for any one to be able to help you find what is producing the error. And you have single-quotes around your table and column names in your query. That makes them strings instead of table and column names and will produce a sql syntax error.
  10. Are you on a shared web host and are using the default session.save_path setting (/tmp) that would cause your session data files to be stored in the common location as all the other session data files?
  11. mysql_num_rows() is only used after a SELECT query. mysql_affected_rows() is used after an INSERT query.
  12. You should be developing and debugging your code on a WAMP/MAMP development system. You should also have error_reporting set to at least E_ALL or a -1 in your master php.ini so that all the php errors will be reported (it would have helped find the error with the mysql_affected_rows line of code.) You should also remove the line of code in that script that is setting error_reporting as that will hide some of the errors and make it take longer to troubleshoot your code. Using mysql_affected_rows() (the function, not just the name mysql_affected_rows) after the INSERT query will tell you if the email got inserted it it returns a 1, but if it does not return a 1 that does mean that the email did not get inserted but that does not unconditionally mean that it was a duplicate email address. You would need to test if the mysql_errno() returned the value for a duplicate key (I think it is 1062 but you would need to test to make sure what value corresponds to a duplicate key.)
  13. You can use date as a column name and in fact that is what your existing column is named. To populate your new datum column with DATE values from your existing column, execute the following UPDATE query - UPDATE report SET datum = STR_TO_DATE(date,'%m/%d/%Y');
  14. All of the quotes in what you posted appear to be smart/curly quotes and won't work in HTML tags or in php code. You need to use straight quotes - " or ' in HTML tags and in php code.
  15. If you can install the mysqli extension, that would be the best choice, especially since you don't seem to have the necessary experience to convert the code to use mysql. Define: my server? Is this a shared web hosting account, a VPS (Virtual Private Sever), or a dedicated server? You might be able to find or write a database class that emulates mysqli. Also, what does the phpinfo(); statement show for the error_reporting and display_errors settings and the php version?
  16. PEAR does not contain or install the mysqli extension. What does a phpinfo(); statement show for mysqli ?
  17. You are only selecting one row ^^^
  18. It's the lazy-way short open tag, which can be turned off on any particular server, and so has wasted many more man-hours than the few seconds it saves by not typing a few characters. No published code should use it because it results in non-portable code.
  19. Or you can just do this in your query when you retrieve the data. See the first example at this link - http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html
  20. ONLY use full opening php tags <?php. In your case, use php <?php echo
  21. There's a 'Notification' menu in your profile where you can set this.
  22. Php reads included files through the file system, therefore you can deny all http requests to the files in the folder and your php scripts in public folders can still include files in the protected folder.
  23. You would use an array to hold the key/value pairs - <?php $lookup = array(); $lookup['NL'] = "Nederland"; $lookup['AFG'] = "Afghanistan"; // add other entries here... if(isset($lookup[$landdef])){ $landnaamdef = $lookup[$landdef]; } else { // entry does not exist } ?>
  24. You only need these two lines of code - $query = "UPDATE master SET qty=qty - 1 WHERE id= $id"; $result = mysql_query($query,$dblink);
  25. You forgot to tell us HOW you use the scripts in the folder.
×
×
  • 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.