Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Give it a top margin equal to the height of the image. You do not need to float it
  2. You can't use array_merge with $_GET['letter_no'] because it's not an array. The array_merge function combines two arrays. If you want to add a scalar value to your array, you would do so the regular way: $_SESSION['key'] = $value array_merge() does not change either of the source arrays, instead it returns a completely new array based on the inputs.
  3. Every time the user opens a page on your website, they send cookies belonging to your domain. Aside from being the program that sends the session cookie, the browser is irrelevant to how sessions work. The browser does not know what a session is, it just sends cookies. When PHP's session_start() method is called, it uses the ID provided by the session cookie, searches for data from the specified session based on that ID and stores that data into the $_SESSION variable, which is available to you. $_SESSION is just a regular array, the only difference being that its value is retained when the user changes pages. Session restrictions are exactly the same as cookie restrictions: The session expires when the session's cookie expires The same session can be used every single PHP page from the domain that the cookie belongs to, including subdomains. Cookies have the option to be restricted to particular subdomains or even directories if necessary. You can set the cookie parameters using session_set_cookie_params().
  4. Where are you hosting your HTML right now if not on a web host? In my experience, free and reliable are mutually exclusive. The last time I looked for a free web host it seemed like a place called 000webhost was the best option, but it's been quite a few years since then.
  5. You would want to merge the two arrays, you can use array_merge() for that.
  6. That expression copies the data from $_GET to the session. It has drawback of overwriting all the rest of the data you may have had in the session previously. Instead, you can create a session variable just for the GET data. $_SESSION['parameters'] = $_GET; If you're doing a query with the GET data and want the query result on multiple pages then it would be far more efficient to store the query results in the session instead of the GET parameters.
  7. This is how you increment the value of a field with an SQL query: UPDATE `field1` SET `field1` = `field1` + 1 WHERE `field2` = 'value' You probably will need to adjust this query to match your table's structure and software requirements. Since I don't have any information about your project or database structure I'm just providing a very generalized solution.
  8. Did you use the code exactly as it is presented on the W3Schools website? There are a couple of issues you may encounter: If you're running the HTML file from your computer's file system, browser security restrictions will prevent the other files from loading. Files from other websites are prevented from loading by browsers unless the other website specifically allows your domain name to use the files.
  9. The video file has to be uploaded to a web host, just like any other resource on the site such as images, stylesheets and audio. Sites like Vimeo and Youtube use their own specialized video players, so you can't use videos from their websites like regular HTML videos. If you want to use the video source you will need to upload compatible video files to your own web host.
  10. I am only a moderator, I did not decide on the forum software. However, from my experience with several different software packages, I find that this Invision is much more robust and has more features than phpBB, unless phpBB has had some major upgrades since I last worked with it.
  11. The forum software defaults to 20 seconds between searches. I've reduced it to 5 seconds for forum members, but due to the amount of traffic and large amount of unidentified bots on the site, the time limit will not be reduced for guests. The forum software is not built by W3Schools, it was created by https://invisioncommunity.com/. They don't have a more user-friendly system, but I don't think such a system is possible. There is not a better solution against server overload attacks than to restrict the amount of heavy operations (like searches) that can be done by anonymous visitors to the site.
  12. Ingolme

    Contact Form.

    If the form's method is GET and the input matches the correct query string parameter then a form can be used because the form generates the query string.
  13. You already asked the same question in this thread
  14. The padding and border are added on to the base width of 960 pixels, meaning that the actual width of the box is 960 + 15 + 15 + 6 + 6, which is 1002. That's explained with the box model https://www.w3schools.com/css/css_boxmodel.asp
  15. Ingolme

    Portfolio CSS

    Oh, the filter is going to cause some trouble. Even though the elements aren't visible, they're still there and are counted for in the nth-child() selectors. I can't immediately think of a CSS solution for that, you probably will need to write a Javascript program to determine which elements need a break before them.
  16. It probably depends on the database engine. I believe it may try ordering by the primary key if the rest of the fields are the same.
  17. Ingolme

    Contact Form.

    The mailto protocol doesn't provide a way to set the "From" address. It lets you set the subject and body. In order to do that, you have to give the inputs the correct name attribute: <input name="subject"> for the subject, <input name="body"> for the body. If you want more sophisticated mail functionality you're going to have to work with server-side programming.
  18. Javascript cannot pass data to PHP. PHP runs first on the server, generates Javascript code and then sends that Javascript code to the browser to be executed. If you need any server-side work done after that then you will have to use AJAX. Here is the AJAX tutorial: https://www.w3schools.com/js/js_ajax_intro.asp
  19. If it was just that, then you could reset it by setting the box-sizing to content-box. In the case of your site, this probably will work: #___gcse_0, #___gcse_0 * { box-sizing: content-box; } I tried that, though, but there are more issues. It seems to be that setting the line-height to 1.5 is also messing with the layout, so you would need to reset that too. .gsc-input { line-height: normal; } I don't know if this will solve all the layout issues.
  20. The end time can be calculated by a server-side programming language prior to being added to the database.
  21. Flexbox works, and setting the display of elements to table-cell using CSS also works, which is not the same as using an HTML <table> element. The vertical-align method works as well. All the solutions are going to require you to have one element wrapped around all the text.
  22. Ingolme

    Drop down menu

    You need three dropdowns <select name="day"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> ... <option value="31">31</option> </select> <select name="month"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> ... <option value="12">December</option> </select> <select name="year"> <option value="1900">1900</option> <option value="1900">1901</option> <option value="1900">1901</option> ... <option value="2018">2018</option> </select>
  23. Ingolme

    Portfolio CSS

    To fix your first issue you can either wrap each set of three items in its own row, or you can add clear:left to every first element of a row like this: .column:nth-child(3n+1) { clear: left; } To determine the number of columns based on device, you have to use media queries to change the width of the columns for each device. For 2 columns, instead of 33.33% you would use 50%; for one column, set float to "none" and set width to "auto".
  24. The fact that it's returning one one row may have to do with how you're using the data. The rest of the code inside the loop is important, you may be overwriting variables or data. If you declare the second query as a prepared statement outside of the loop your code will be more efficient. You only need to declare it once and you can use it many times. $balq = $mysqli->prepare('SELECT SUM(debit) debit, SUM(credit) credit FROM x WHERE a = ? AND b = ?'); $balq->bind_param('ss', $field1, $field2); while ($ledq->fetch()) { $field1 = 'Data from first query'; $field2 = 'Data from first query'; $balq->execute(); $balq->bind_result($debit, $credit); // Your code here echo $debit . ' ' . $credit; ////// $balq->free_result(); } $ledq->free_result(); $mysqli->close(); You omitted a whole lot of information from your code, so a most of this is just examples. If this is returning you just one row then either you're using the loop wrong or your queries really only have one row to return.
  25. $nt1 is a PHP associative array, not a Javascript array. Read about it here: https://www.w3schools.com/php/php_arrays.asp The code you've displayed is a line of PHP that's generating a line of Javascript, you need to be able to distinguish which parts are PHP and quich are Javascript. The addOption function is probably declared elsewhere in the code.
×
×
  • Create New...