Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. 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.
  2. Some of us have no f..... clue what is going on here.... The whole topic was confusing form the title on down....
  3. 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
  4. I've shown you how things could be written better. Good luck.
  5. 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.
  6. 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?
  7. 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.
  8. STOP creating NEW VARIABLES!! That is your problem here!
  9. 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.
  10. 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();
  11. 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?
  12. Judging by how well you write English, I'd be worried about your coding skills.....
  13. I don't often code like your example, I use the functions/methods rather than properties.
  14. 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.
  15. 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
  16. 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.
  17. #$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.
  18. dBase??? I remember when that first came out. And people are still using it? Wow!
  19. 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.
  20. 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?
  21. OK - you have 2 tables - Items and Bids so far. You are saying that you want to get some data items out of the query results and insert them into 2 other tables. Is that correct? Why not use your loop to create two arrays of the data items you want to add to each table. That is, a separate array for each of the 2 new tables. Then run an insert query on each one to insert those items, using the 'value arrays' to insert multiple rows in one query execution. Does that sound like a plan? BTW - in the query you posted - if close is a date or datetime or time field (by def.) you don't need quotes on the value since it is numeric. Just be sure it is in the proper format. And the same for the outbid value. Obviously you will need to add a while loop around that fetch line you have above. As for the group by, if has no use here since I believe all you are doing is collecting the joined sets of data in order to create your new input values for the other tables. BTW #2 - if you already have these data items in your database, why do you need to copy them to new tables?
  22. A rule of PHP is that php vars do not get interpreted if wrapped in single quotes. Leave them off in this case or use double quotes.
×
×
  • 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.