Jump to content

stirrah

Members
  • Posts

    30
  • Joined

  • Last visited

stirrah's Achievements

Member

Member (2/5)

0

Reputation

  1. I'll think about it. This issue is already dealth with though. Only the person who created the task can update it + people who's invited. Problem is when those try to update at the same time.
  2. Maybe i wasn't very clear. I've made an entire site, yes. Purpose of this site is to register tasks/projects with a start date, end date, description, asignees, etc. However, if someone is updating the project description I dont want another user to be able to update it at the same time. Example: Project description right now is "this is the description". User1 starts to change the project description and is writing a looot of text. After a while user2 enters the same project and changes the description to "this is the description and its good". When user1 finally saves the description, user2's description will be gone. Sorry for my bad english..I hope you can understand now!
  3. Ok. Do you know what the correct term for this function would be? I don't really know what to search for. I've read about sessions but it's not exactly the information I want.
  4. Hi all! I have a site where its possible to register and update different tasks. However, now I want to prevent the user from doing changes if another user is already there. Can this be done with sessions or something?
  5. I guess so? I'm don't really know what that would mean. What's the drawback?
  6. Hey! I have two querys that are fetching data. Each query is populating a html-table. I want to be able to order this data if i click on the header. I've managed to get this to work, BUT I want the first table to "remember" its sorting even if I sort the other table. Look at the attached picture. This is the code for the link: <th><?php echo "<a href='my_projects.php?order=" . 'projectId' . "'>" . 'ID' . "</a>"; ?></th> This is the code for GET value: $order = $_GET["order"]; if (empty($order)) { $order = 'projectId'; } So I think my problem is that every time I reload the page, the value gets resetted to 'projectId'...how can I make the page remember?
  7. Okey, I understand what you mean. But I'm not sure how to do it any other way. This is my code: First I fetch users from DB: $usersquery = mysql_query("SELECT * blablabla)"); while($row = mysql_fetch_array($usersquery)) { $users .="<option value=\"".$row['user_id']."\">" . $row['username'] . "</option>"; } Then I show them in a dropdown / add submit button: <?php echo $users ?> </select> <input type="submit" value="add_assigne" name="add_assigne"> </li> <?php if (empty($_POST['add_assigne']) === false) { add_assigne($user_1, $_POST['assigne'], $pid); This is working, but I want the dropdown to update itself with the new users after submit is pressed...
  8. Hello everyone! I am populating a dropdown with results from a sql query. After that I am deleting something by pressing the submit button that relates to this dropdown. The submit works and it is deleting the row in my DB, however the new result doesnt show before i reload the page. How can I make my dropdown update itself when I press submit so I can see the updated sql results?
  9. Hey! How should I do if I want to populate a table with results from DB, and then make a submit button beside each row..and then make a query depending on the values of that row. This is my code right now: if (isset($_POST['submit'])){ // do some query to the db depending on row } ?> <h2>Accept or decline your invitation:</h2> <?php $my_id = $user_data['user_id']; $query = mysql_query(MY QUERY) ?> <table class='display'> <th>ID</th> <th>Namn</th> <th>Inbjuden av</th> <th>Svara</th> <?php while($row = mysql_fetch_assoc($query)) { ?> <tr> <td><?php echo "<a href='project.php?pid=" . $row['projectId'] . "'>" . $row['projectId'] . "</a>"; ?></td> <td><?php echo $row['projektName'] ?></td> <td><?php echo $row['username'] ?></td> <td><form action="" method="POST"><input type="submit" name="submit" value="Accept!"></form></td> </tr> <?php } ?> Problem with this setup is that it will submit all the rows before aswell..
  10. Hey! I'm fetching data frmo my database and displaying it in a table. Now I want to be able to display that data but sorted in different ways. Right now it's sorted by id ASC. I want to make the <th> links, so when i press one of them, the page will sort the data in that way. How can I make this without writing a lot of new querys? I want to use the one query i already have made. Here is my code: <?php if(isset($_GET['hpid'])) { $hpid = (int)$_GET['hpid']; $test = mysql_query("SELECT * FROM `project`, `users`, `projectStatus` WHERE `projectHuvudId` = $hpid AND project.projectCreatorId = users.user_Id AND project.projectStatusId = projectStatus.statusId"); $test2 = mysql_query("SELECT p.projektName , p.projectId , s1.statusName , u1.username as creatorName , u2.username as ansvarig , p.projectDescription , p.projectCreateDate , p.projectStartDate , p.projectEndDate FROM project p INNER JOIN users u1 ON p.projectCreatorId = u1.user_Id INNER JOIN users u2 ON p.projectAnsvarig = u2.user_Id INNER JOIN projectStatus s1 ON p.projectStatusId = s1.statusId WHERE `projectHuvudId` = $hpid ORDER BY p.projectId ASC"); ?> <table class="display"> <th>ID</th> <th>Skapat</th> <th>Namn</th> <th>Start</th> <th>Slut</th> <th>Skapare</th> <th>Ansvarig</th> <th>Status</th> <?php while($row = mysql_fetch_assoc($test2)) { ?> <tr> <td><?php echo "<a href='project.php?pid=" . $row['projectId'] . "'>" . $row['projectId'] . "</a>"; ?></td> <td><?php echo $row['projectCreateDate'] ?></td> <td><?php echo $row['projektName'] ?></td> <td><?php echo $row['projectStartDate'] ?></td> <td><?php echo $row['projectEndDate'] ?></td> <td><?php echo $row['creatorName'] ?></td> <td><?php echo $row['ansvarig'] ?></td> <td><?php echo $row['statusName'] ?></td> </tr> <?php } ?> </table><?php } ?>
  11. Oh...I'm so sorry, lol. Im so used to browse this forum...is it possible to move this thread or should a make another one?
  12. I know that the query is OK, because i've run the method outside and it works. The second dropdown gets populated correctly. So the problem should be in the jquery-code i guess. For me, it seems that the method never gets exececuted.
  13. Hey! Im trying to do a chained select dropdown. 1 dropdown decides what should be shown in the second one...i think you all are familiar with this. Anyway..im following this guide: http://www.yourinspirationweb.com/en/how-to-create-chained-select-with-php-and-jquery/ But something is wrong, i cant get it to work properly. My first dropdown is populating correct, but the second one is not working. If i choose something in the first dropdown, the second one just stops at "wait...". I think the problem is somewhere in add_project.php, but im not sure. Here is my code: add_project.php: <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("select#category").change(function(){ var id = $("select#category option:selected").attr('value'); $.post("select_type.php", {id:id}, function(data){ $("select#type").html(data); }); }); }); </script> <?php include "select.class.php"; ?> <form id="select_form"> Choose a category:<br /> <select id="category"> <?php echo $opt->ShowCategory(); ?> </select> <br /><br /> choose a type:<br /> <select id="type"> <option value="0">choose...</option> </select> <br /><br /> <input type="submit" value="confirm" /> </form> <div id="result"></div> select.class.php: <?php class SelectList { public function ShowCategory() { $sql = mysql_query("SELECT * FROM `projectCategory`"); // $res = mysql_query($sql,$this->conn); $category = '<option value="0">choose...</option>'; while($row = mysql_fetch_array($sql)) { $category .= '<option value="' . $row['categoryId'] . '">' . $row['categoryName'] . '</option>'; } return $category; } public function ShowType() { $query = mysql_query("SELECT huvudProjectId, huvudProjectName FROM `huvudProject` WHERE `categoryProject` = categoryId=$_POST[id]"); $type = '<option value="0">choose...</option>'; while($row = mysql_fetch_array($query)) { $type .= '<option value="' . $row['huvudProjectId'] . '">' . $row['huvudProjectName'] . '</option>'; } return $type; } } $opt = new SelectList(); ?> select_type.php: <?php include "select.class.php"; echo $opt->ShowType(); ?> Hope someone can help me with this! I've tried SO many hours but I cant find the problem.
  14. Okey, so it's not possible in CSS3?
  15. Hey! I have a (simple) question. This is my code: nav { float:left; } nav ul { margin:0; } nav ul li { display:inline; margin-right:10px; } nav ul li a { text-decoration:none; } nav ul li.current { font-weight:bold; } nav ul li a.last { border-right:0; } I want to have something called "nav2" to share ALL of nav properties, except the float: left that should instead be float:right. How can I achieve this?
×
×
  • 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.