Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Could be difficult to present since you could have a lot of columns depending upon how many 'dates' are stored/active at any given time. Do you want to show all the days that are currently scheduled or just a window of time? Have you written you query yet? Have you asked yourself these question?
  2. I am unfamiliar with your choice of database interface. Check your manual to see what functions are available to test the results of your query (which you fail to do) and to find out how many rows were returned, which is usually available.
  3. Your sample seems to boil down to this: if only one row simply show the table with that one column. If more than one row, always show two records per row until the end. That's not hard echo "<table>"; $eof = false; while (!$eof) { if (false=$row=$qrslts->fetch())) $eof = true; else { echo "<tr>"; echo "<td>".$row['fld1']...."</td>"; if (false = $row=$qrslts->fetch()) $eof = true; else { echo "<td>".$row['fld1']..."</td>"; } echo "</tr>"; } } echo "</table"; I'll let you figure out that other problem.
  4. I do believe that if the file to be included is in the same folder as the calling script no path is needed, so the current line of code is correct. If however it is one folder up, then benanamen is giving the correct alteration. Ps - While I love the way you use the function to encapsulate a whole bunch of html, the method of outputting could be so much easier if you use the heredocs feature. Here is the link to the php manual: http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
  5. Other issues: 1 - you can't mix the use of MySQL* and mysqli* functions which you are doing. At the risk of coming across sarcastically, the MySQL* functions have been deprecated for years and are no longer part of the current version of PHP. In other words - don't use them at all. 2 - session_register has also been deprecated as in the following message from the manual: "Warning This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0." The preferred method is to simply say "$_SESSION['varname'] = (some value);" (quotes and caps required, parens not) 3 - when checking for a user/password record it is not necessary to retrieve the password value. Simply specifying it as part of the where clause is sufficient for verifying a login. Additionally - you really must store the password in an encrypted format and use that same format on the input value that you supply to the query. You should NEVER store it anywhere except in the user table, not in your script nor session vars. Assign a token of your own choosing to indicate that a user is authorized - not the pswd. 4 - your html is ANCIENT. Really really old. Much of what you have coded is years out of date and you really should revise it. Learn some css and get rid of all that deprecated stylng you are doing. Also - tables are no longer the preferred way of laying out screens (although I used them all the time) so certainly embedded tables are really to be avoided (which I do!). Why have a table of one cell wrapping another entire table? If you copied this code from somewhere you would be well-advised to learn how to do this simple html form yourself and actually learn something from it while you are starting out.
  6. Turn on error checking too to help provide you with more information about your coding as you write it.
  7. With all of these positive critiques, we'll probably never see this poster again, at least not under this name. Thanx for the support!
  8. Thanks for noticing!
  9. "nice try"? My attitude is the same now as it was on my last two posts and will continue to remain the same. If you think I was using sarcasm, apparently you have a hard time recognizing things. Not a good trait in a programmer. I will be sure to pass over your posts in the future.
  10. Sorry to have pointed you in the right direction towards one of the best IT reference manuals in existence. As for adjustments, you seem to need to learn to accept criticism as well as help. I gave you three valid pointers to help you out but you seem to have a problem with being told to read something. Reading is important as any good programmer learns quickly.
  11. IMHO - it is usually easier to start one of these with double quotes and then wrap the attributes in single ones, that way your php vars are properly recognized.
  12. Without looking thru all that code let me state this. You do know that if you set a cookie you cannot retrieve it until the next time you enter that script? The cookies are sent to your session after your next request. I may not be saying it correctly, but if you set a cookie and then try to read it 100 lines later in your code, you will fail. Don't know if that is what you are doing, but if it is, now you know.
  13. And "status" should be giving you an error since you didn't select it. Turn on error checking whenever you are writing new code. It helps the process. (See my signature.) Also - Stop using MySQL* functions. If you bother to read the manual, or ever look at it, you'll see a big red box telling that it is outdated and no longer valid in the current PHP version. Better to stop now than have to come back eventually and re-code. Lastly - don't use this method of retrieving row data from a query result. Fetch a whole row and reduce your resource utilization. For example - if you are using MySQL* functions, then use the MySQL_fetch_assoc() to get a whole array of the fieldnames in your query results with only call to the interface instead of 3. Plus you don't have to keep a row counter. But you should move on to a newer interface - preferably PDO, but that is just my opinion.
  14. did you write this code or copy it from somewhere? So many mistakes. Try fixing the function at the top. You loop thru the query results in there, saving all the rows values in the same variable. This means you only have the last row's information to work with. Why is that? In the main line code you are doing this: while($row_cat_pro=mysqli_fetch_array($run_cat_pro)) { $pro_diametro = $row_cat_pro['diametro']; $link_diametro= "index.php?diametro=$pro_diametro"; echo "<input type='radio' value='" .$link_diametro ."' >" . $pro_diametro . "</option>"; } Why do you echo the start of an input tag and end with a closing option tag??? You do this again later. Do you not know HTML at all?
  15. As a newbie you should make the effort to learn by picking up the manual or a good book and giving it a reading. Look at the syntax sections, how to construct a database 'process' as in: the connection, the query statement preparation, the query, checking the results of the query and then fetching the rows from the query results. All good stuff to learn by yourself and THEN trying to make it work for you and THEN asking for help with it. If you can't understand what you are told, how can we help you?
  16. Once again the failure to include simple PHP error checking during a development costs you time and frustration. You are comparing a datetime var against an integer and that's what I get when I run your script: Notice: Object of class DateInterval could not be converted to int in /home/albany/public_html/homejg/test.php on line 10 See my signature.
  17. So wouldn't that have been a good example to show us?
  18. Maybe I'm confused, but how does this ever get to be zero? Your target is 5 months away.
  19. PS - a header() call following any echo statement (any output) will always fail.
  20. Is $actualpath correct? Looks like it ends in '/uploads/uploads....'.
  21. If you posted my sample at the beginning of this script you will see errors as they occur
  22. You don't check if your query actually executed - poor programming. did you turn on error checking?
  23. Your question didn't say what was wrong. I assume because you stored the message in a non-existent var that the problem was simply a missing message. You could turn on php error checking and see if you any other typos that are causing your failure. See my signature.
  24. Well, your misspelled function name is not a problem since you matched the name to the call. But what about the other line I posted?
  25. Are these spelled correctly? $resopnse["message"] = "User failed to update. Please try again"; } echoRespnse(200, $response);
×
×
  • 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.