Jump to content

gw1500se

Members
  • Posts

    1,041
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by gw1500se

  1. You also forgot to use the code icon (<>) and select PHP. Please edit your OP.
  2. You can't. At least not from PHP directly. PHP is server side. If I understand what you want, you can create an app or javascript using ajax to transmit the data to a PHP script but you can't access the data from PHP. The transfer must be initiated from the client side. All PHP can do it put up a page requesting that data from the user.
  3. I'm confused by what you are trying to do. COUNT() returns the number of rows that match the query criteria. Is that what you really want? Why put it in a loop? The reason the 2nd one works is because it actually returns a row of data.
  4. Since you do no error checking after the query, that is what happens if no rows are returned due to either and error or nothing in the database meets the WHERE clause.
  5. You probably want to do a redirect from http to https. While this can be done in PHP (not recommended) is it better to do it with httpd controls. Assuming you are running Apache make sure you have the rewrite module loaded. Look for this line in your httpd.conf file: LoadModule rewrite_module modules/mod_rewrite.so If it is not there, add it. Then create the following '.htaccess' file in the directory that contains the pages you want to protect: RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] Restart httpd and you should be good to go.
  6. Start by changing that column to data type TIME. That stores it as hh:mm:ss. Then use: $totaltime=strtotime($time1)+strtotime($time2)+... ; echo gmdate("H:i:s",$totaltime); // If you want it back to hh:mm:ss or set whatever format you want.
  7. Also does each call output a single line or all lines? You need some <tr> and <td> tags somewhere which is why ginerjm asked about the HTML code.
  8. You just have to make sure the date formats match. MySQL only uses yyyy-mm-dd, so: $curdate = date("Y-m-d");
  9. First, don't embed your PHP code like that. Separate your HTML from the PHP code. Second, don't use * in your select. Extract only those variables you plan to actually use. To do what you want, you need to create a form that submits your data when you click one of the buttons. See this article about using forms and passing data to PHP.
  10. First please use the code icon (<>) and select PHP for your code. It makes it much easier to read. I'm not sure but I think you need to change your loop to this: $rows = $resultset->fetch_assoc(); foreach ($rows as $row) { $var_course_id = $row['course_id']; echo "<option value='$var_course_id'>$var_course_id</option>"; }
  11. It is not clear to me what you are really asking. If you just want to use an IP address in the URL, that is not unusual. $url = "http://127.0.0.1/index.php";
  12. It can be done and is a routine thing. Here is a simple example.
  13. Its possible that simple_html_dom is not installed on that server. Do you have error reporting turned on?
  14. <div class="section" style="<whatever css style you want>"> <?php if(isset($_SESSION['uid'])) { echo 'Hello,'; echo $_SESSION["uid"]; } ?> </div>
  15. I'm not sure if this possible but I have a bunch on links on my page that are jpg files. When I click on the link it opens the image in a new window which is exactly what I want. However, I need that jpg to automatically resize as if there were an img style attribute: img { max-width=100%; height=auto; } Is there a way to do that without creating an HTML page for each JPG with an img tag in it? TIA.
  16. This is really a MySQL question. I'm not a MySQL expert so I don't know where latitude and longitude come from. I assume they are columns in your data base. I've never used a calculated value for ORDER BY rather than a column value. In my scenario I don't store that in my database. I just pass the zip codes to the MapQuest API and get the distance when I need it. If it were me I'd put the zip codes in an array, then add the distances to that array from the API and sort the array on the distances.
  17. Post your current code.
  18. I do something similar and use the MapQuest API. You have to sign up for a key but it is free.
  19. round(floatval($item['in_bytes'])/1000000,2); I used 'floatval' instead of 'intval' since that is what 'round' wants. The 2 gives 2 decimal places but you can use what you want.
  20. Simply divide it by 1000000 then round to get the desired precision. You may need to use intval to make the string an integer first.
  21. Here is a handy tool to validate your HTML.
  22. If I understand, you are really using the wrong approach. You really want to use preg_match and a regular expression. I am not a regexp expert so you should ask tor the expression in the regexp forum.
  23. $chunk is whatever you name the array you split into. RTFM.
  24. $array1=$chunk[0]; $array2=$chunk[1]; Assuming it was split into 2 chunks.
×
×
  • 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.