Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. How did you determine that he code didn't do the check you wanted? And what are you saying after the quoted line? I don't understand your mention of "insert" here. I realize that you may have some English difficulties. Did the rowcount call not give you anything? Do you know for sure that the username does exist exactly as provided? And Why Do You Think We Are "seniors"?
  2. Help with what? Are you still getting any error messages? And what makes you think that you need to buffer your output? I never do so what is so special about this script?
  3. Why is this 'dynamic'? And how do you want this to perform - as a background counter on the server to trigger some response or as a JS one that sits on the client and ticks off time for the user to see? Questions, Questions, Questions.....
  4. You don't want to create a field called 'datetime' as varchar. It s/b a DateTime type. $sql = "INSERT INTO comments (name, datetime, email, comments, approvedby, status, post_id) VALUES(:name, :email, :datetime, :comments, 'Pending', 'OFF', :post_id)"; Looking at your query statement do you see that you have mis-aligned fieldnames and values? You're trying to load an email into a datetime field and the reverse PS - I recommend switching to the array method of assigning the values instead of the tedious bind function as in this: $sql = "INSERT INTO comments(name,datetime,email,comments,approvedby,status,post_id)"; $sql .= "VALUES(:name,:email,:datetime,:comments,'Pending','OFF',:post_id)"; $parms = array( ':name'=>$name, ':datetime'=>$dt, ':email'=>$email, 'comments'=>$comments, ':post_id'=>$postid); if($sucess = $stmt->execute($parms)) {
  5. Way more than I ever learned about writing sql. Way More!!! Thanks for the lesson. I'll try to avoid this scenario in the future.
  6. But why? One works and the other doesn't. Why? I would never think of this and have not had this issue before. And - the error message pointed at the join for the outer join that was previously working and was not altered and not at the Where for the newly included table.
  7. Once again - thanks Barand. But - what looked like a very simple addition completely doesn't work. How come? It is no different than the other join I am doing.
  8. Look at the cleaned up block of your code loop; foreach ($result as $row) { $mail->addAddress('james@jhe.co.uk', 'James Coates'); $mail->Body("This subscription is expiring on" . $row['subRenew']); $mail->send(); // DROP THIS LINE!!! if (!$mail->Send()) echo 'Something went wrong'; else echo 'Mail sent to somebody Complete.'; //Clear all addresses and attachments for the next iteration $mail->clearAddresses(); $mail->clearAttachments(); } As you can see you were doing the send (?) twice although function names are different. Secondly - where are you using the results of your query loop? I see a static address but nothing from your loop.
  9. Ok - I have a working query to which I wanted to add one more item from a new table. Thought it was easy but I must be having a bad day. I will post the original working query (now commented out) and the new query with the added item 'driver_num': /* $q = "select a.race_winner, w.wins, substr(a.race_winner, instr(a.race_winner,' ')+1) as last_name, a.race_name, date_format(a.race_date, '%m/%d') as race_date from trk_races a left outer join (select race_winner, count(race_date) as wins from trk_races where race_winner > '' and Season='$selyr' group by race_winner) w on w.race_winner = a.race_winner where a.race_winner > '' and a.Season='$selyr' order by $orderby"; */ $q = "select a.race_winner, w.wins, substr(a.race_winner, instr(a.race_winner,' ')+1) as last_name, a.race_name, date_format(a.race_date, '%m/%d') as race_date, d.driver_num from trk_races a, drivers d left outer join (select race_winner, count(race_date) as wins from trk_races where race_winner > '' and Season='$selyr' group by race_winner) w on w.race_winner = a.race_winner where a.race_winner > '' and a.Season = '$selyr' and d.driver_season = a.Season and a.race_winner = d.driver_name order by $orderby"; The only addition is the "drivers d" in the from clause of the first select along with the additions to the ending where clause that connects the "drivers" table to the "trk_races" table in that select. Here is the error I am getting from this change: Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a.race_winner' in 'on clause' in /home/albany/public_html/homejg/nascar/nas_show_drivers.php:129 Stack trace: #0 /home/albany/public_html/homejg/nascar/nas_show_drivers.php(129): PDO->query('select a.race_w...') ..... The error column is already being used elsewhere in the query so I can't figure out why I am getting this error.
  10. What I do this to use unique values on the submit tags and let my main script decide what to do. If you want it to go to a different script, when you see that button value you issue a header to that script.
  11. And so if that broken form had been posted here 2 days ago we could have all fixed it for the OP?
  12. So where are the forms on this forum? In this topic? I can't help you if I can't look at your form and the script that it calls.
  13. Do you really expect us to read thru ALL THAT CODE? In my first post I asked to see the form that was not working for you. You never showed it. How about - since you say the form is a problem - you show us this form and also the code block that is supposed to process it and we can start there?
  14. If you are putting this input into a table you could add a key field to connect it to some token that is related to the page that shows the form. User does some entry, submits it, you grab it and if it is incomplete you save the data and your key values and create a cookie to hold those key values so that when your form is called up again the cookie that your script looks at tells it where to get the provided data and places it on the form. Once the input is complete you can delete the cookie and remove the key values from the db record. If the data is not going to a table then you will have to make a table to hold it temporarily.
  15. You need to change this from reading a csv file since it really isn't one. It is simply a text file that you wan't to break up at the semis. while (! gzeof($outputDirHandle) && $values = fgetcsv($outputDirHandle)) { foreach($values as $key => $val) { to be: while (!gzeof($outputDirHandle)) { $values = fread($outputDirHandle) // this gets: 2021-06-30;01:00:00;78 $data = explode(';', $val); // this gets: [0]=>2021-06-30, [1]=>01:00:00;, [2]=>78 $temp[$data[0]][] = $data[2]; // this gets: [2021-06-30]=>78 } You aren't writing anything out so that may be why you don't see any output file. Plus as you can see I don't think you are creating the right output element. I hope that I have read this correctly.
  16. You have shown us your structure and you seem to have planned it out ok. But how about showing us the Problem, ie, the form?
  17. Why is there even a loop? All you are trying to do here is display your form. No Loop.
  18. Try this. //************************************ if (!empty($VehSelection)) foreach($table as $key => $value) $VehSelection= $value["VehSelection"]; //*********************** $chk = ''; if ($VehSelection == 'Yacht') $chk = 'checked'; echo "<label class='boxstyle'> <input type='checkbox' name='vehicle[]' value='Yacht' $chk> I have a yacht </label> <br>"; //*********************** $chk = ''; if ($VehSelection == 'SuperCar') $chk = 'checked'; echo "<label class='boxstyle'> <input type='checkbox' name='vehicle[]' value='SuperCar' $chk> I have a super car </label> <br>"; //*********************** $chk = ''; if ($VehSelection == 'Plane') $chk = 'checked'; echo "<label class='boxstyle'> <input type='checkbox' name='vehicle[]' value='Plane' $chk> I have a plane </label> <br>"; It is untested of course but it does what you ask I think. Note the lack of a single switch out of php mode. And the lack of id values which you don't need if not using JS to access them.
  19. Not enough to work with here. The 3 values. Are they separate data items in your db? If so you shouldn't have any problem. That makes me think that they are 3 static values that you always want to appear but only check the ones in use for this key. I think you want to always produce the output for each choice but only check when the value is in your array. And stop switching in and out of php mode. You don't have to do it.
  20. without seeing any code at all, I'm gonna guess that PHP is actually telling you that you cannot alter that setting from with a php session. You may have to do this edit by actually updating the PHP.ini file itself.
  21. Can I ask why you are converting an "image" ( a picture/photo/piece of art that is a jpg,tiff,mpg, etc. file) ) to some kind of array in order to upload it using an ftp process? I would think that you would do that to the image once you got it uploaded where you could write a script to do what it is you are doing.
  22. Doesn't the manual mention the addition of the header argument?
  23. Don't know how php_self and request_uri are related. One gives you the full name of the script incl. path; the other gives you the entire url with the query string.
  24. HTH! Good luck.
  25. You are trying to create a drop-down list of the items found with your query, correct? Do you want the user to be able to pick just one item or several? If you want to allow multiple picks at once you need to add that option to your select tag and then use an array name for the name attribute of the tag. Then your php can process that array instead of just one item. Look up the tag in an html reference to learn about the multiple select. Then change the name on your select tag to 'size[]' to make it an array. Then in the code that will handle the POST input you will use a loop on the 'size' array to collect all of the items picked.
×
×
  • 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.