- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 20
- Posts with Upvotes
- 19
- Upvoting Members
- 18
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re: You woud access it like any other cookie for the site, using the Request.Cookies collection of the Controller class, `Request.Cookies["cookie"]` returns an object for the cookie named "cookie". Use the ToString() method to retrieve the text value of the cookie. Check out the docs here, https://docs.microsoft.com/en-us/dotnet/api/system.web.httprequest.cookies?view=netframework-4.8 for more details. | |
Re: On line 79 use $conn->query(...) as you did in your other queries. Use the mysqli object you create at the top of your script. | |
Re: Yeah, that's the gist of it. [CODE=php] <label for="doctor_id">Select a doctor:</label> <select name="doctor_id"> <?php while($doctor = mysql_fetch_assoc($name)) { printf('<option value="%d">%s, %s</option>', $doctor['id'], $doctor['surname'], $doctor['name']); } ?> </select> [/CODE] | |
Re: Some helpful hints when working with HTML checkboxes and PHP. 1. Name the checkbox entries the same and add brackets to the end of the name. This will result in all the selections being stored into an array when submitted to php. 2. If zero entries are selected, the form … | |
Re: The Mailchimp service (http://mailchimp.com/) is a great option. I manage sending announcements for a client of mine and have used Mailchimp for several years. Mailchimp offers some nice services that would take a lot of effort to replicate yourself: * There are several templates to choose from when creating a … | |
Re: $_SESSION is a collection of values stored on the web server per visitor, per browser (ie, tied to the browser by a *cookie* that stores a unique *Session ID*.) Values can be stored in $_SESSION for retrieval on the server in your PHP code in subsequent requests. Your code snippet … | |
Re: Same as you would in html: html5: `<button id="foo" disabled>...` xhtml: `<button id="foo" disabled="disabled">...` Submit buttons follow the same pattern: html5: `<input type="submit" id="foo2" value="Submit" disabled />` xhtml: `<input type="submit" id="foo2" value="Submit" disabled="disabled" />` For a more detailed example, answer pritaeas' question. In what language do you want to disable … | |
Re: Global.asax is a funny thing and can be problematic because of execution order. It looks like this code is in the `Global.asax` file instead of the `Global.asax.cs` file. Try moving your code customizations to the code-behind file, `global.asax.cs`. If there is a problem with the code there, you'll get a … | |
Re: You've got to refer to the cells by their numeric index. .cells(0) is k for example. | |
Re: What problem are you having? From what I see of your code sample, the original uploaded image *might* display (though I'm not sure what URL is getting generated.) The changes you make to the `Bitmap` are all happening in *memory*. They are not altering the image **file** on the web … | |
Re: `index2.html` should be named `index2.php` . The PHP interpreter won't be used (by default, anyway) if the extension is html. | |
Re: In addition to everything @lps says, can you have sql do some of the work in calculating the results you need? You show `$total` which could likely be calculated from a sql query using aggregate functions like SUM(), etc. MySQL is often much better optimized for generating totals than doing … | |
Re: Line 7 of your code should refer to `expenseID.Text` or `expenseId.SelectedValue` (in the case of a dropdown or radiobutton list.) | |
Re: Initially you can simply use drag and drop to drag content files into your Visual Studio project. This automatically adds the files into your project when you drop the files onto Solution Explorer. As @JorgeM points out, if your colleague is responsible for the upkeep of these files, you'll both … | |
Re: Many of your radio buttons do not have event handlers. You need an event handler for the "enable" and "disable" behaviors. The "checkchanged" event is fired by the control receiving the new selection (not when losing selection despite the event name implying this.) I have found that the RadioButtonList control … | |
Re: Without seeing some code behind, it's hard to diagnose but a few things come to mind: 1. Make sure the site is running as an ASP.NET 4.x site (it might be set to run 2.0 or 3.5 for example.) 2. How do you know that the events aren't firing at … | |
Re: Line 9 in the listing above is likely a syntax error. Simply uncomment the H1 element on line 7 for a title heading. You can't have more than one HEAD element in a document. That HEAD element already exists in the master page. Check your master page to see if … | |
Re: The webopt:bundlereference is new in .net 4.5. It is bundling ALL the css in your content folder -- including [Bootstrap](http://getbootstrap.com/)! Basically it concatenates the CSS files, minifies it (removes unneeded whitespace) and sends it all out in one go instead of several seperate files. The blue halo seen around the … | |
Re: @kaziraja, you can use the String class' Split method. [C#: String.Split()](http://msdn.microsoft.com/en-us/library/system.string.split%28v=vs.110%29.aspx) table2 = new Table2(); // Assumes a Table2 entity exists. string source="1002008000300-53-9" string[] codeParts = source.split('-'); // Assign split values to your table2 entity table2.column1 = Int32.Parse( codeParts[0]); table2.column2 = Int32.Parse( codeParts[1]); table2.column3 = Int32.Parse( codeParts[2]); // Go persist … | |
Re: You can only display one image using this technique. Put the loop in a calling script. This is done with the image tag: [CODE=php] <?php // ... $query = "SELECT * FROM tbl_images"; $result = mysql_query($query); foreach ($result as $image) { ?> <img src="image.php?id=<? echo $image['id'];?>" /> <? } ?> … | |
Re: What's in the 300 fields? Are they repeated sets of data? Surely you don't have a table with 300 columns. If you can post your schema we may be able to help better. | |
Re: In your loop, test each value against the one that was submitted. If they are a match, mark that option as selected: <option value="<?php echo $row['bankID']; ?>" <?php echo ($row['bankID'] == $_POST['bankID'] ? 'SELECTED="selected"' : '');?> ><?php echo $row['bank']; ?></option> * *The `?` is the ternary operator which works like … | |
Re: Use a session variable to keep track of the last viewed record between sessions. Then use MySQL `LIMIT` clause to set an offset and limit the results to one record. [MySQL Select (limit) reference](https://dev.mysql.com/doc/refman/5.0/en/select.html) When you end up with an empty result set, reset back to record one. | |
Re: Have a look at strtotime() http://www.php.net/manual/en/function.strtotime.php The manual says it converts an English date but maybe you can find an Italian localized version. | |
Re: In MySQL you can use the LIMIT clause [[Select statement Reference](https://dev.mysql.com/doc/refman/5.0/en/select.html)]. You can use `SELECT COUNT` to determine how many pictures are in the gallery. Decide how many images you want on each page, then divide count into pages. All your links (next, previous, #) will need to pass the … | |
Re: I don't see how the $inactive variable will persist between visits. It is not stored in a session variable and it gets reset to 1 (or 600) immediately when the script begins. Could you provide a spec. that describes exactly how you *intend* this code to work? | |
Re: Guessing by your description, what you need is a left join: display all learning materials and their evaluations even when there are no evaluations available. A left join lets you select ALL relevant entries from the first (left) table to a second (right) table even some corresponding entries don't exist … | |
Re: I have found that MySQL is very effective at doing ORDER BY and the like *IF* proper indexes are set up. Indexing makes a HUGE a difference and is often overlooked. The sql EXPLAIN command is very helpful for evaluating how efficiently a query is being carried out. I admit … | |
Re: One technique is to name form fields in a way that will be translated into an array by PHP. Instead of naming the SELECT element "country1", "country2", etc you can name the fields "country[1]", "country[2]" and so on. When the form gets submitted to PHP, it will automatically convert these … | |
Re: Yes. After a form is submitted and processed, you should issue a redirect to prevent the form from being submitted again unintentionally when a user refreshes their browser (or the browser restores previously open tabs during startup, etc.) |