Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. You can read up on DATE_FORMAT function of MySQL (its online) or you can use the date function of php to translate it (its in the php manual)
  2. I"m trying to use an email to generate some input to a script of mine. I begin by using the script on my client to generate an email that contains a form with information and an input tag and a submit button. The form triggers this same script again, but with a different intended action which is to gather the input values and update my database. Here is the form from the email: <!DOCTYPE html><html> <form name='emailform' method='POST' action='http://(mydomainname)/(myscriptname)'> (general text) <div style='background-color:#c0c0c0;padding:10px 20px;width:50%;'> <label>#20 - Bottles purchased:</label> <input type='text' name='pq_qty_20' value='' size=3 pattern='[0-9]'> </div> <br> _________<br><br><br> <div style='background-color:#c0c0c0;padding:10px 20px;width:50%;'> <input type='submit' name='btn' value='Post Email Purchases'> </div> </form> </html> So - testing this on my laptop with my browser open and running this script, I generate the email. Going to my email client and grabbing the email I click on the <input tag and my browser immediately opens up a new window running the same script. Filling in the input value and then clicking the submit button opens up a third window on my browser but no other activity occurs. What should be happening is no new browser windows (hopefully) but a process to update a record in my db from the input in the email - this does not happen though. So - I have managed to generate a vaild html email which when I test using the script on my laptop seems to be working. But when using the form from my email client I get screwy and non-existent results. Anyone done this before?
  3. Isn't your url a path to a folder? Can you then read the contents of a whole folder with file_get_contents? From my reading, f_g_c reads a 'file'. I think you need to use glob on that $url and then go thru each one looking at the last modified date or whatever criteria you want to use.
  4. Sorry - don't know much about regex strings.
  5. For future reference you have a "script with a function and a form".
  6. You have a form with a function? That's about the only thing I understood from your post. And I don't believe it. I'd love to see the code that implements this 'thing'.
  7. 200 views and no replies - usually means we don't understand what you are asking. Your descript may make sense to you - you know what you are doing. We don't and can't figure it out from your sketchy outline. Want to try again? I really don't understand it at all.
  8. A new table for each new event? Or a new row in the events table? The former seems more likely. YOu create a new table and put how many rows in it after that?
  9. I saw the part about the passwords, but it didn't mention dbname.
  10. I'm still wondering why it works when you don't select a database name.
  11. Sorry - that doesn't help me to help you either. Good luck.
  12. I've been a programmer for 30+ years - still don't have a structure. Programming is about learning to solve problems in a logical way and writing code in sensible way so that you and others can decipher it in the future. That's about as much structure as one needs.
  13. IMHO - as a newbie you should begin by trying simple procedural php and html and SEE how it's done. You have a perfect learning-tool example project in front of you, so just work on the php to generate the page (html) and the php to handle the input and post the data to your db. When you have that working you can then find something else to do (phase 2?) that you can work a class into. Basically, this example doesn't need classes as it is so small and limited. Good luck.
  14. You really expect somebody to volunteer to read thru 200+ lines of your code of which we know nothing and try to 1) figure out what it's supposed to do and 2) what it is you want it to do when 3) you don't even know? Usually when people ask for help on a forum they have done their homework and tried to isolate a small are where the problem may be and then clearly stated what is is doing wrong. Can you do that?
  15. YOu are outputting a select tag for every user. Move that outside of the while loop
  16. minor change in my code then. Simply change the starting value of $elem_val and instead of decrementing it, increment instead. Oh - and change the value test at the end of my while to detect if it exceeds your value instead of checking for less than 0
  17. Don't you need to have an instance of produit in order to call the add function in that class?
  18. Here's my code - similar to psycho's, but different. <? /* spiral.php */ // $num_rows = 5; // user provided values $num_cols = 4; //******************************** $elem_val = $num_rows * $num_cols; // number to begin with // $edges = array('b','l','t','r'); $min_row = 0; $max_row = $num_rows -1; $min_col = 0; $max_col = $num_cols -1; // $e = 0; $ar = array(); $building = true; while ($building) { $edge = $edges[$e]; switch ($edge) { case 'b': { // do a bottom of the grid row $r = $max_row; for ($c = $max_col;$c >= $min_col; $c--) { $key = "R".$r."C".$c; $ar[$key] = $elem_val; $elem_val--; } $max_row--; break; } case 'l': { // do a left side of the grid $c = $min_col; for ($r = $max_row;$r >= $min_row; $r--) { $key = "R".$r."C".$c; $ar[$key] = $elem_val; $elem_val--; } $min_col++; break; } case 't': { // do a top row of the grid $r = $min_row; for ($c = $min_col;$c <= $max_col; $c++) { $key = "R".$r."C".$c; $ar[$key] = $elem_val; $elem_val--; } $min_row++; break; } case 'r': { // do the right side of the grid $c = $max_col; for ($r = $min_row;$r <= $max_row; $r++) { $key = "R".$r."C".$c; $ar[$key] = $elem_val; $elem_val--; } $max_col--; break; } } if ($elem_val <=0) $building = false; $e++; if ($e > 3) $e = 0; } echo "Showing results table for rows=$num_rows cols=$num_cols<br><br>"; $num_rows--; $num_cols--; echo "<table border=1 style='border-collapse:collapse;'>"; echo "<col width=40px><col width=40px><col width=40px><col width=40px>"; for ($r = 0;$r<=$num_rows;$r++) { echo "<tr>"; for ($c=0;$c<=$num_cols;$c++) { $key = "R".$r."C".$c; echo "<td>$ar[$key]</td>"; } echo "</tr>"; } echo "</table>";
  19. Is this what you are looking for? Showing table for rows=4 cols=4 10 9 8 7 11 2 1 6 12 3 4 5 13 14 15 16
  20. my bad - you saw my original response before I re-read and saw the brace you had. This is now bad: if ($i % 3==0){ if ($i <> 0){ $dyn_table .= "</tr>"; $dyn_table .= "<tr><td>$dynamicList</td>"; } else { $dyn_table .= "<td>$dynamicList</td>";} } $i++;} Try this: if ($i % 3==0) { if ($i <> 0) $dyn_table .= "</tr>"; $dyn_table .= "<tr><td>$dynamicList</td>"; } else { $dyn_table .= "<td>$dynamicList</td>"; } $i++;
  21. Actually looking at this code I don't see what is wrong with it, but as someone else pointed out it Is extremely hard to read as you've written it. Personally I detest code that uses more than one set of <? ?> tags, so reading yours is definitely not easy for me. (look up 'heredocs' in the php manual)
  22. I gave you the fix to make - two lines, that's all and it works just fine. And I showed you where to place them. What else can I do?
  23. Make this change: if ($i % 3 == 0) { if ($i <> 0) $dyn_table .= "</tr>"; $dyn_table .= "<tr><td>$dynamicList</td>"; } else { $dyn_table .= "<td>$dynamicList</td>"; } $i++;
  24. Works for me - I added the </tr> tag at the appropriate place.
×
×
  • 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.