Jump to content

fran

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by fran

  1. The program is Kalipso. The issue is coming from the .csv file downloaded from scanner. When I open it, copy it to notepad and save it as .csv then run it again, it works fine. So no, it isn't because I opened/closed the file. I tried to use php to open, read and write the file but it doesn't change anything. How do you remove the leading BOM characters when you don't really see them?
  2. The file is coming from a scanner program. Is it possible to change the character type with php?
  3. I have this query: "LOAD DATA LOCL INFILE '$txtfile' INTO TABLE $table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; when it loads the file into the database, it looks like this: userid | XY | gondola_no | date | time | processed ÿþ1 | x123y132| h123 |20140212| 082219 | 2 | x123y132| h123 |20140212| 082219 | | | | | | N If I copy the same data from the csv file and paste it into another csv file and run it everything is perfect. LOAD DATA LOCL INFILE '$txtfile' INTO TABLE $table CHARACTER SET UTF8 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; caused an error. What am I doing wrong?
  4. My code is telling me that the port is open but isn't reading $buffer. No errors are reporting. error_reporting(E_ALL); $fp = fopen('COM1', 'r+'); if(!fp){ echo "Port not accessible"; } else { echo "Port COM1 opened."; } $output = "mode COM1: BAUD=1200 PARITY=Even data=7 stop=1 Xon=off"; $buffer = fgets($fp); echo "Read: $buffer"; Any suggestions?
  5. It also never hurts to learn more about what you already know :-)
  6. I found this: http://www.zzee.com/php-gui/ Are there similar programs?
  7. Mostly because I know php programming and can make it do exactly what I need it to do. :-(
  8. This is the scenario: I want to create a program on a computer which uses PHP and MySql. I want an executable icon on the desktop that opens the php program (preferably not in a browser). I know I have to install PHP and MySql on the computer. Can this be done and are there programs that I can use to accomplish this task?
  9. I did finally go back and added a table. It took a lot of thought but it works now. They can now add the scores per game and the scripts all do the math for them. Thank you for all your help. I have learned a lot from this site.
  10. For the individual scores, this works. <? $sql = "SELECT name, GREATEST(pins1, pins2, pins3) AS high_score FROM bc_averages WHERE league = '$list[league]' AND week = $list[week] ORDER BY high_score DESC LIMIT 4"; The problem is now I want the sum of the team scores. So basically I need <? $sql = "SELECT team, GREATEST(sum(pins1), sum(pins2), sum(pins3)) AS high_score FROM bc_averages WHERE league = '$list[league]' AND week = $list[week] ORDER BY high_score DESC LIMIT 4"; And of course, this doesn't work. I am going to try to create a new table.
  11. I have been working on this script and finally got it this far but now I am stuck. It shows the team and their scores from 3 games. SELECT team, SUM(game1) AS game1, SUM(game2) AS game2, SUM(game3) AS game3 FROM totals WHERE league = '$league' AND week = '$week' GROUP BY team"; $sql_result = mysql_query($sql,$link) or die(mysql_error()); while ($row = mysql_fetch_array($sql_result)) { Team Game1 Game2 Game3 Team 1 180 240 210 Team 2 400 252 236 Team 3 294 258 310 Team 4 394 358 410 I need find the top 3 teams with the highest scores from all the games. So it should print this: TEAM Top Games Team 1 410 Team 2 400 Team 3 394 Help???
  12. After spending a lot of time rearranging, changing, testing and researching, I finally got it. Good luck to all who were looking for the answer. I hope this helps. $id = $_POST['sel_record']; $sort = $_POST['sort']; for($i=0;$i<count($id);$i++){ $sql = "UPDATE invest SET sort='$sort[$i]' WHERE id='$id[$i]'"; $sql_result = mysql_query($sql,$con) or die (mysql_error());
  13. I have gotten my script this far, and as I said...it worked before so I just don't see where I am going wrong. The fields are all correct. I even ran the script with one update and it worked. The problem is when I run it trying to update multiple, it doesn't change anything. I ran the error_reporting(E_ALL); ini_set("display_errors", 1); with no errors showing up. I have scoured over the blogs and cannot find the error of my ways. In answer to "My script is broke, someone else fix it"...I didn't mean to come across that way. I just need a little help finding an error.
  14. So many views...No answer???
  15. I have ran this code before and it worked but not it won't update. Can anyone see what I am doing wrong? <? if(isset($_POST[sort_invest])) { // if form was submitted $id = $_POST['sel_record']; $sort = $_POST['sort']; for($i=0;$i<$count;$i++){ $sql = "UPDATE invest SET id='$id[$i]', sort='$sort[$i]' WHERE id='$id[$i]'"; $sql_result = mysql_query($sql,$con) or die (mysql_error()); } } // if form was submitted or if it came from another page if (isset($_POST['order_invest']) || isset($_POST['sort_invest'])) { ?> <p><strong>Order Invest</strong></p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <? $sql = "SELECT id, sort, title FROM invest ORDER BY sort ASC"; $sql_result = mysql_query($sql,$con) or die(mysql_error()); while ($row = mysql_fetch_array($sql_result)) { $id = $row["id"]; $title = $row["title"]; $sort = $row["sort"]; ?> <input type="hidden" name="sel_record[]" value="<? echo "$row[id]"; ?>"> <table width="545" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="69"><input type="text" name="sort[]" value="<? echo "$row[sort]"; ?>" size="3"></td> <td width="476"><? echo "$row[title]"; ?></td> </tr> </table> <br> <? } } ?> <input name="sort_invest" type="submit" value="Sort"> </form>
  16. Oh, now I understand. I needed <option value="lastname, firstname">... <option value="<? echo "$row[Artist]"; ?>"><? echo "$row[Artist]"; ?></option> Now it works! Thanks so much!
  17. Database has Artist: "lastname, firstname" Text is sent from here: $sql = "SELECT DISTINCT Artist FROM inventory ORDER BY Artist"; <option value=$row[Artist]>$row[Artist]</option> Updated here: $sql = "UPDATE inventory SET id = '$id', Title = '$_POST[Title]', Artist = '$artist', ... I have mysql error on both but no errors appear. It simply eliminates everything after the comma and saves in database "lastname," Is that enough to give you an idea?
  18. I even put lastname, firstname into the MySql db and then tried to update it. It then changes it to lastname, and deletes the rest.
  19. I am trying to update a db with "lastname, firstname". When I use the comma, it deletes everything after the comma. I tried replacing the comma with a special character but it didn't work.
  20. Well, thank you! This will save me from beating my head against a wall!
  21. $sql = "UPDATE books SET id = '$id', (etc...) READ= '$READ, CONDITION = '$CONDITION', (etc...) I have 29 fields to add to a MySql database. The problem is the two fields shown above. If I replace them with something else such as RD and COND, they work perfectly. Is there a list of words that are not allowed in PHP/MySql?l
  22. Ok, cool. So how do I write the query? $sql = "SELECT email FROM contacts WHERE notify = 'Y' AND sex = 'a boy' AND sex = 'a girl');
  23. Well, I want to email those who want to be notified but I also want to check off only certain ones. IE: only "a boy" and "a girl" but not "none" as specified by the checked boxes.
  24. Database Table: contacts id | name | email | c1 | c2 | c3 | notify 1 | Suzie | sue@email.com | a girl | | | Y 2 | John | john@email.com | | a boy | | Y 3 | Uni | uni@email.com | | | none | Y form: Send email to this type of people: <input type=checkbox name=c1 value="a girl"> <input type=checkbox name=c2 value="none"> <input type=checkbox name=c3 value="a boy"> PHP: $sql = "SELECT email FROM contacts WHERE notify = 'Y' AND (checkbox is checked); How can I specify the fields that are checked?
×
×
  • 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.