Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. 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.
  2. 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.
  3. 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?
  4. What? No front?
  5. 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.
  6. 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 .. ..
  7. 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?
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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!
  14. 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???
  15. Here's something that you can tinker with to see how this s/b done. /* comment out query for now $sql = 'SELECT q1,option1,option2,option3 FROM questions'; $result = mysqli_query( $conn, $sql); if(!$result ) { die('Could not get data: ' ); } */ // create an array to use as data in this example. Remove this and uncomment above // query logic to use your data later. $result = array( array('q1'=>'Question 1 text','option1'=>'Ans 1A','option2'=>'Ans 1B','option3'=>'Ans 1C'), array('q1'=>'Question 2 text','option1'=>'Ans 2A','option2'=>'Ans 2B','option3'=>'Ans 2C'), array('q1'=>'Question 3 text','option1'=>'Ans 3A','option2'=>'Ans 3B','option3'=>'Ans 3C'), array('q1'=>'Question 4 text','option1'=>'Ans 4A','option2'=>'Ans 4B','option3'=>'Ans 4C') ); $q_no = 0; //while($row = mysqli_fetch_array($result)) // loop thru the array until you uncomment the while above to use real data. foreach ($result as $row) { $q++; // added the php_eol in order to show the html code clearer for now // remove them when you are done testing echo "Question $q_no: ".$row['q1']."<br>".PHP_EOL; echo "Answers:".PHP_EOL; // show the answers in an unframed box indented under the question echo "<div style='margin-left:4%;'>"; echo "<br>"; echo "<input type='radio' name='ans$q_no' value='" .$row['option1'] ."'/>" . $row['option1'] . PHP_EOL; echo"<br><input type='radio' name='ans$q_no' value='" .$row['option2'] . "'/>" .$row['option2'] .PHP_EOL; echo"<br><input type='radio' name='ans$q_no' value='" .$row['option3'] . "'/>" .$row['option3'].PHP_EOL; echo "</div>"; echo "<br>--------------------------------<br>".PHP_EOL; } Of course you'll have to add an html form around all this and then grab the resulting $_POST elements to get the user's selected answers. Hope this helps.
  16. IMHO - the easier query is to simply find a record for that IP. If found you still need to update it, so making the query that complex is not necessary. You simply get the record, then check the date and either abort or update it.
  17. The solution is not to limit access to a "function", but to the script that is performing the function/task/whatever. As already pointed out the IP address can be changed/forged(?) so it may not be totally accurate to base your decision on that piece of data. I would simply create a cookie that had an expiration 24 hours from creation that held the ip address as its value. If the cookie exists, abort the script. If not re-create the cookie and proceed. Of course if this is vitally important, you might need to use a db to store a token for the ip address since cookies can be toyed with. Same idea though - store the datetime and the IP address in a record. Upon execution of the script, check the db table for that IP and if the record's datetime value is too soon, abort. If the datetime is over 24 hours old, update the record with the new date/time and proceed. No need to remove expired recs - any future access attempt will simply update them. If it's a problem though after too many users have visited, you could create a simple maintenance script to delete any record with a datetime older than a given value. and run it manually on a periodic schedule.
  18. Glad to hear that you have made such great success with your application. Keep it up! You still need to understand what the meaning of the word "website" is and the meaning of "script". You are writing scripts. Not "websites".
  19. I can see there is a definite communication problem here. I don't understand a thing you just said. Good luck with whatever you are trying to do.
  20. A quick read thru of your code and I am wondering what happened. Your original question was about updating a user profile. This code is about uploading and saving(?) a file. What is the connection? And does one really need a class to upload a file?
  21. Most importantly you need to NOT store an array in your DB. Normalize your data (look it up) and create a table structure that holds the information properly.
  22. I think you have mis-quoted me. My post was to show the OP what the manual shows as the proper syntax and nothing more.
  23. Have you tried using the PHP manual as part of your 'mastering' experience? It would be helpful in showing you the proper syntax for the functions you want to use. bool mysqli_select_db ( mysqli $link , string $dbname )
  24. Methinks you are looking at this oddly. Updating a profile - ie, modifying the contents of a form with various input fields - is a simple update process no different than any other. Give the users a link to a script that checks for proper authorization and then sends out a form and retrieves it via a POST and does the proper input validations and then does the update. Are you seeing this as anything different? PS - I find your choice of logo/avatar offensive.
×
×
  • 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.