Search the Community
Showing results for tags 'records'.
-
Hello, I have Events and Tickets tables. In Tickets table I have at least the following fields: EventsID CustomersID TicketNo ... The number of tickets for an event varies between 500-20,000. That means the number of records after 100 events may be 50,000-2,000,000. I wonder if it is better for each event to have a different table, which means I have 100 tables with 500-20,000 records in each. Which design is better for selecting/querying customers records? Thanks in advance.
-
I have a piece of code where I use MYSQL to add records into a database. Here I use INSERT, but I want to work with UPDATE. The user selects records which have to be updated. The records have a unique number. I hope people can help me how to convert MYSQL code into PHP. The MYSQL code used in the console is this: UPDATE table_name SET input2='my input here ' WHERE rec_number = 2; The part of the script I use looks like this: <?php $name1 = $conn->real_escape_string($input1); $name2 = $conn->real_escape_string($input2); // $sql = "INSERT INTO $table (input1, input2 ) VALUES (' $name1 ', ' $name2 ')" ; // olde code // $sql = "UPDATE $table SET input2, input1 WHERE rec_number = $rec_number_selected VALUES (' $name1 ', ' $name2 ')" ; $sql = "UPDATE $table (input1, input2) VALUE S (' $name1 ', ' $name2 ') WHERE rec_number = $rec_number_selected " ; ?> Anyone any idea what the right code is in PHP?
- 2 replies
-
- updatemysql to php
- select
-
(and 2 more)
Tagged with:
-
Hi. Wonder if anyone can help. I have a page (which hopefully when finished) will allow a administration user to go in and update the availability of products. I have done a query first to pull the records from the SQL database, and have then used a loop to display the records in a table: @{ Layout="~/Shared/accountArea.cshtml"; Page.Title="Update Product Availability | Sarnies For All"; if (WebSecurity.IsAuthenticated == false) { Response.Redirect("~/"); } var db = Database.Open("sarniesForAllCurrent"); var extractBread = "SELECT * FROM bread ORDER BY breadId"; if (IsPost) { var sql = "UPDATE [bread] SET available = @0 WHERE @1 = @2"; foreach(var row in db.Query(extractBread)) { } }} <h1>Update Products</h1><p>Here are all the details which we hold on our system about you. Should any of these details change please update them as necessary and click on the Update button below.</p><form method="post" action=""> <table> <tr> <th>ID</th> <th>Description</th> <th>Available</th> <th>Price</th> </tr> @foreach(var row in db.Query(extractBread)) { <tr> <td>@row.breadId</td> <td>@row.breadDescription</td> <td><input type="text" name="@row.breadId" id="@row.breadId" value="@row.available" /></td> <td align="right">£@row.price</td> </tr> } </table> <input type="submit" value="Update" /></form> I am now at a loss at how to then input any changed values back into the SQL database. I have already used the SQL update record for my "Update Profile" page as that is for one record in my user table - but am unsure of the process/code to use to update multiple records at once using the above loop method. Thanks. Kevin