Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Show us the EXACT script you have setup as the cron job. You can hide any passwords. And PLEASE remember to wrap your code in the appropriate forum tags.
  2. Since you can't seem to explain in plain English what you want to do without mixing in things you don't yet know about, how about you show us the code you have already written. Of course if you have never written any code, then you have a learning curve to follow before you start trying to do this thing.
  3. My question is still awaiting an answer. If you want help you have to cooperate with those trying to help. Perhaps you could show a bit more of the context that you are describing to us.
  4. Turn on php error checking (see my signature) and run this NOT as a cron job. Put some debugging lines in there to ensure that things are happening correctly and work on it THAT way until it works as desired. Then set it up as a cron job and test it by sending yourself the email still.
  5. What kind of "code" did you place "after the head and before the body"? Html? Js? Php? Hopefully not php.
  6. It's not a question of being 'user-friendly' but being more understandable to yourself and anyone else who reads your code, such as forum members trying to decipher it. To elaborate on my suggestion about using an id as the key. Create a 'header' table that defines each label and assigns an id number. You could use an auto-increment column in this to help keep it unique. Your process would add a record to this table and retrieve the newly assigned id. Then you would have a table with this id as the key and the rest of the columns being the attributes about this label. Be sure to design your columns to contain simple data types only - no combined values in a comma-delimited string because you have several of them. If you need to do something like that you create another table to keep multiple values in separate rows all having the same id. This would apply to purchase transactions perhaps where you would have a record of each one stored under the id all retrievable with a query on id. When you want to find a whiskey you query the header table and let the user pick a name. You then use the corresponding id in your next query to retrieve al l the attributes from the 'details' table. A brief description but an accurate representation of how a RDBMS works
  7. Perhaps you could re-post your code in a more readable format? One line per line of code is the norm as well as using this forum's code tags to make it more clear. You should also learn a bit about css and get all that clutter of styles out of your html by just assigning one class to a tag instead of all the stuff you are currently doing.
  8. Two things I noticed in your style. You should use more meaningful names for your column names. 'name', 'date' and such are so vague. Even more so is your use of 'id' as the input value and then comparing it to a 'name' field in your where clause. Which is it - an id or a name that you are searching on? PS - using a column name of 'date' might give you a problem in your query since date may be a reserved name. What is the date - a 'purchase date', a 'date added', a 'date distilled'? Plus using a name as the key field will be a real problem if indeed you have truly different whiskeys with the same name and you want to store data about them each and not make them entirely un-searchable. A simple sequential number assigned to each distinct label would be the way to go and then assign that id to every record pertaining to that label from that point on. Requires two tables of course, but that is how the db should be structured.
  9. You probably mean to say $row['avg']. But you also may have to do this: AVG(price) as avg
  10. That's the idea. Although if this will be your first cron task, I suggest you write a script to do all the work while interacting with your console until you have it debugged. Use your email address to prove it out with results info and then eliminate any debugging outputs before setting it up to be a cron job. I use an email to do my debugging of cron tasks. I output all my debug info to a separate message body and then send out the debug email to my address to test my program and watch what it is doing. Once I'm through I disable the debugging email by turning off a switch in the top of the script.
  11. How about you take a look at what the actual query statement looks like in each situation and decide for yourself what needs to be changed? Do an echo of the query after it is built and make sure you are building the 'correct' statement.
  12. What debugging attempts have you made? Turn on php error checking to be sure you don't have any errors that could be affecting you. Add some echos at points where critical things are happening to ensure that you have the values that you expect to have at those points.
  13. How are these two code samples connected? PS - you might think about structuring your scripts to completely separate the html, the php and the js. Also you might build a proper web page rather than just echoing out some random js code in the middle of whatever is going on.
  14. Turn on error checking and see what your query statement triggers. What is 'reminder'? PS You are developing this as a funning script before setting it up as a cron job, aren't you?
  15. IIRC there is something about the iphone in the ways it tags pics when you take them the "wrong" way. They designed it to indicate that they s/b landscape but when you upload them they get interpreted as portrait. Were this pics taken as portrait? Don't remember how I tackled this but that may be your problem. Somewhere between Apple and html and how things are being interpreted.
  16. Things could be easier to achieve and understand if you separate your php logic completely from your html. Do your tests/comparison and assign your output vals to vars and only include them in your html code, rather than burying snippets of php code here and there. if (!empty($qty1) $show_qty = $qty1; else $show_qty = ''; (etc.etc.etc.) $code=<<<heredocs <tr> <td><input name="qty1" size="1" type="text" value="$show_qty1"></td> <td><input name="desc1" size="70" type="text" value="$show_desc"></td> <td><input name="unit1" size="5" type="text" value="$show_unit1"></td> <td><input name="disc1" size="1" type="text" value="$show_disc1"></td> <td><input name="total1" size="6" type="text" value="$show_total1" READONLY></td> </tr> heredocs; echo $code .. ..
  17. Looking at your latest code (#4) it seems that you are a bit haphazard with your thought process. You do your db connect well before you have a need for it. Plus you do the connect, go get an input value, and THEN decide to check if the connection succeeded. Hmmm.... You ask about doing an update to your db, but your code only shows an inquiry. Also your code is incomplete - in fact when I tried to run it I got an error because you left your while loop open. What am I missing?
  18. The code that I posted prior is working almost perfect. I'd like to find a way to get it to pre-load in order to avoid the buffering, but that isn't working that well. Thanks for sharing.
  19. Ok - I have found this to work. <a><video preload='none' controls='controls' width='300' height='200' name='$file' src='$href' ></video></a> Have to experiment with other clients to see if something needs to be loaded since my machine has already loaded some things. Buffering too.
  20. Thanks Benanamen but that is exactly what I don't want to do. Don't want to upload my vids to other sites to view them and in the other choice it doesn't support .mov files. Really looking for the simple approach to uplaode it to MY site and rely on a downloaded plugin(?) that is called by the browser if the client doesn't already have the proper tool. Is that not possible? Kinda like how PDF files work when one clicks on the link.
  21. I've posted many webpages with pictures on them and they are pretty easy. Now I want to post a couple iphone videos that I uploaded to my server. These are .MOV files and I have searched quite a bit for recent posts about how this is done. I know nothing about this and some of the stuff I have found is beyond me. Is there a simple way of doing this? And if not, how about the hard way although not too hard. I don't want to do anything complex like using Youtube or other file converters. I would think it would be possible to just take my own videos and upload them and place them on my own web pages. I have tried the following snippets: #1 echo "<video controls='controls' width='300' height='200' name='$name' src='$href'></video>"; And:#2 echo "<embed src='$href' width='150' height='100' scale='tofit' autoplay='false' controller='true' loop='false' bgcolor='#C0C0C0' type='video/quicktime' pluginspage='http://www.apple.com/quicktime/download/'> </embed>"; But neither do anything than display a sized box on my screen. Clicking on them does nothing. The only reference I found on this forum is from 2007, so I discounted that. Any help will be appreciated.
  22. How about putting the limit clause on the join'ed table selection? To paraphrase: select your categories in the main table and join the table that pertains to those categories, limiting that selection to 10.
  23. The smarter way would be to write a PHP function that does your editing to an argument that is passed to it. Then you could use that "corrected" variable in your update query. The beauty is that the function can be used prior to any query statement you write instead of having to modify every query statement when you decide to remove something new!
  24. What makes you think anything's wrong? Try turning on PHP error checking while developing. See my signature. See my comments in code below: if($showclosedgames==1) { $query1="SELECT * FROM games"; } elseif($showclosedgames==0) // why this check??? { $query1="SELECT * FROM games WHERE winner=''"; } $record_count = $conn->query($query1); // why is this called record_count??? $per_page= $limit; $pages = ceil($record_count->num_rows / $per_page); if(!isset($_GET['page'])) { $page = 1; } else { $page = $_GET['page']; } if($page <= 0) { $start = 1; } else { $start = $page * $per_page - $per_page; } $prev = $page -1; $next = $page +1; // if($showclosedgames==1) { $query2="SELECT * FROM games ORDER BY amount DESC LIMIT $start, $per_page"; } elseif($showclosedgames==0) { $query2="SELECT * FROM games WHERE winner='' ORDER BY amount DESC LIMIT $start, $per_page"; } $query = $query2; // if ($result = $conn->query($query)) { while ($row = $result->fetch_assoc()) { if(empty($row['winner'])) { $status='open'; } elseif(!empty($row['winner'])) { $status='closed'; } // WHERE'S THE REST OF THIS BLOCK???
×
×
  • 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.