Jump to content

ginerjm

Members
  • Content Count

    4,807
  • Joined

  • Last visited

  • Days Won

    63

Everything posted by ginerjm

  1. Two questions: 1 - What do you mean by "read navigation"? 2 - Your php code has a lot of functions but no "main line" code that makes use of them. Perhaps that is why you are posting here?
  2. How to add the echo statements? If you don't know what that is, I'm afraid you are in over your head.
  3. Have you added any debugging code to see what the script is doing? Obviously it is going somewhere you don't expect so add some echos to display what the code is seeing and operating with.
  4. Which commands are you having a problem with? The db interface perhaps? If you tell us what we can point you at some references that will help you learn how the code has to be changed.
  5. Some of us have no f..... clue what is going on here.... The whole topic was confusing form the title on down....
  6. Show us the code for: 1 - your sql statement itself 2 - the code that 'binds' or assigns the values/vars to the parms being used in the sql statement There should be an equal number of values and parms in this code. 3 - the execute
  7. I've shown you how things could be written better. Good luck.
  8. Regarding your edits: if (ctype_alpha($name) === false) { $errors[] = 'name contain letters!'; } Do you WANT letters or not? As a newbie how about this: if (!ctype_alpha($name)) $errors[] = 'Name must be all alphabetic'; And this could be different: if(empty($errors)) { if (mail('XXXXXXX@gmail.com','contact form',$message, 'From: '.$email)) { header('Location: index.php?sent'); exit(); } else { echo "Message not sent"; exit(); } } Note the use of separate physical lines for each line of code. Combining them makes for troublesome reading down the road. Trust me. Also - the php mail function is not the greatest mail tool. It only offers a boolean response and that can be wrong without you knowing it.
  9. First - do you know that what you have so far actually works??? Your 'from' address has to be valid for the mail server to use. You're allowing the user to provide it which is probably not what you want to have happen. A bar? You mean like a moving 'progress' bar? Or just a 'line' of text?
  10. IF you don't understand what I said above, take a fresh look at the code I provided you earlier and read it carefully and try to understand what you are doing differently.
  11. STOP creating NEW VARIABLES!! That is your problem here!
  12. Or you could have just said: $cat_name = str_replace('&', 'and ', strtolower($cat_name)); No need to define arrays for this purpose nor to create a second field to hold category name.
  13. So - however you accept a request from any person on your site to "see" a profile page - you need to simply check if they are signed in. If that means they have to have a certain $_SESSION element set, then all you do is call isset() for that item, no? What is the question about session_start all about? Obviously every script you execute should begin like this: <?php ... ... session_start();
  14. I don't understand any of this discussion. But the worst part of that lack is that I don't see any usage of "session_start()" in any of the many code samples. So my question is "What is the real problem"? Perhaps you could just explain what you are trying to accomplish?
  15. Judging by how well you write English, I'd be worried about your coding skills.....
  16. I don't often code like your example, I use the functions/methods rather than properties.
  17. Yes - that gets you days without the + sign. My last change was to show the months and leftover days, if you wanted it. $dt1 = '2009-10-11'; $dt2 = '2009-10-13'; echo "Using dates of $dt1 & $dt2 :<br>"; $interval = GetInterval($dt1, $dt2); $test = $interval->format('%m'); if ($test > 0) echo 'Interval is: '.$interval->format('%m months %d days'); else echo 'Interval is: '.$interval->format('%d days'); echo '<br><br>'; // test 2 $dt1 = '2009-08-14'; $dt2 = '2009-10-13'; echo "Using dates of $dt1 & $dt2 :<br>"; $interval = GetInterval($dt1, $dt2); $test = $interval->format('%m'); if ($test > 0) echo 'Interval is: '.$interval->format('%m months %d days'); else echo 'Interval is: '.$interval->format('%d days'); echo '<br><br>'; // test 3 $dt1 = '2009-07-11'; $dt2 = '2009-09-25'; echo "Using dates of $dt1 & $dt2 :<br>"; $interval = GetInterval($dt1, $dt2); $test = $interval->format('%m'); if ($test > 0) echo 'Interval is: '.$interval->format('%m months %d days'); else echo 'Interval is: '.$interval->format('%d days'); echo '<br><br>'; exit(); //****************************************** function GetInterval($dt1, $dt2) { $datetime1 = date_create($dt1); $datetime2 = date_create($dt2); $interval = date_diff($datetime1, $datetime2); return $interval; } Here is some code for you to try out.
  18. As for showing it in months - The manual does show you how but it is not immediately clear. After dropping the R, change the a to d
  19. Feeling magnanimous today, and having struggled to get to the correct source in the manual I"ll give you this one. Drop The R. As for showing it in months - the format options only show whole numbers so if you have a gap of less than a month you will show 0 when formatting it. And if it is more than a month you will get a value of "months" but not the full value of months & days without doing some work on figuring out how many days were in the months that did transpire.
  20. #$num = mysqli_num_rows($sql); #echo $num; Your two comments "fail"? Not sure how that can happen. Try echoing out your query before you execute it. Maybe just once (followed by an exit() ) to see if it is being built correctly.
  21. dBase??? I remember when that first came out. And people are still using it? Wow!
  22. How is this button going to work? What is it calling? How is the current row of data being passed to whatever script is going to do the delete? I suggest a form around each row and a proper Submit button (<input type='submit'>) that will do what you need. Using the <button> tag is just not that useful even though people love to use it. I don't get it.
  23. What do you mean by "have same variables but different data"? You do realize that one variable will replace any previously defined variable by the same name so having multiple uses of a single var name is not going to work?
×
×
  • 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.