Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. yeah, you did, why don't you just JOIN the tables on listing_id?
  2. oh, and you should stop inserting NULL into an auto_inc field as well.
  3. you would be better to build the full where clause dependant on the input, rather than the filter placed on the field: if($_POST['category'] == "(Any)"){ $where = ''; } else{ $where = " WHERE category = '{$_POST['category']}'"; } $sql = $sql.$where;
  4. Well the case is fairly complicated compared to what you are using just now. it will require you to assign some varibles within the SQL. Oh, and as far as efficiency is concerned, I doubt you would notice any difference at all. The following code is not tested, and is only given as a guide for you to see how it could work. <SET @c=0, @id=[value] /*include this at the top of the SQL code where [value] is the id of the action that is being performed - you will need to get this from the submit form or from an additional SELECT at this point */ /*the following should be put in place of your current field select for the action performed*/ CASE WHEN TIMEDIFF(NOW(), table2.`time`) <= 00:05:00.000000 AND table1.id = @id THEN @c= @c++ ELSE (SELECT actiondescription FROM table1 WHERE id = @id) END as commment /*this should only display different actions that have happened within the last 5 minutes.*/
  5. have a go with this: $array_name = array_values($array_name);
  6. OK, rip out all the $i's in the input name arrays, you don't need them - especialy if your just going to run a foreach anyway. repost the entire page inside php tags ['php']...['/php'] (without the quotes) and please explain what exactly you are trying to do here.
  7. ok, couple of things - please please please use code/php tags around your code - what's this $i that's popping up all over the place?
  8. What I have used in the past is getcwd(). It's not the "Absolout" method, but it's more effective cross system. have a look here for some more options: http://php.net/manual/en/book.dir.php
  9. $SQL="INSERT INTO predmeti (nastavnik) FROM nastavnici VALUES ('$_POST[id_nastavnik]')"; problem is with the above query. 1st you don't build an insert query using a FROM clause (unless you have a SELECT to go with it) 2nd you have not inserted the $_POST variable within the string properly. Try this $SQL="INSERT INTO predmeti (nastavnik) VALUES ('{$_POST['id_nastavnik']}')"; On another note, you really should not insert form varibles directly into your sql. It is a huge security risk.
  10. The only way you are ever going to guarentee anything is if you have direct admin access to the server. Basicly, the software can only get the information that the server will let it access, unless you controll that server, there can be no guarantees.
  11. why do you have id and company_id/user_id fields in tables 2 and 3 and why oh why did you name a field with a reserved word (time)? Basicly what you want to do is pull it out the database without the grouping, and then run conditional formating against your "time" field that only shows actions from either table if it has been within a set period, and is not a duplicate of the last. There are a couple of ways of doing that in PHP, if that is what you are using. What are you using to display the results of the query and how comfortable are you with that language? That said, you could possably pull it off using a CASE clause in the select statement if you are really heart set on having it done in the SQL.
  12. what you want to do is a formatting issue, not a query issue. could you post up your table structures please?
  13. For better debuging change you code to be the following: $qry = "INSERT INTO ".$_GET["SteamID64"]." (defindex) VALUES (".$defindex.")" mysql_query($qry) or die ("ERROR!<br> $qry <br>Caused the following error when trying to create a new record:<br>".mysql_error()); } that should help you find out what's going wrong.
  14. and how many horses, adverage and maximum, do the players have?
  15. what does this "id <--- this will repeat records 4 columns across" actualy mean? could you maybe draw an example table in excel/word/whatever - screen cap it and attach it to your post so we can see exactly what layout you are looking for?
  16. I'm not sure what's going on here, but you shuld absoloutly NEVER suppress (use of @ symbol) any function call - ever. All your @'s that are in that code need to go - especialy the ones on the mysql_() functions - or you'll just be scratching your head when something goes wrong and you have nothing on screen to tell you what that is. Right, that said, could you give us all a clear breakdown of what you have in place just now and what you are looking for? Also an overview of the general design would probably help as well, although is not as important.
  17. yip, that's spot on, the problem is that you have no value in $_POST['ud_id'] I think we need to go back in the process to see what is coming out of this piece of code: $id = $_GET['id']; // Ask the database for the information from the orders table $query="SELECT * FROM orders WHERE id='$id'"; $result = mysql_query("SELECT * FROM orders"); if(!$result) { echo "Query failed<br>Query: {$query}<br>Error: " . mysql_error(); }else { //Create an update form for each order while($order = mysql_fetch_assoc($result)) { echo "<form action='updated.php' method='post'>\n"; echo "<input type='hidden' name='ud_id' value='{$order['id']}'>\n"; //---------------------<<<<<<<change this line echo "Name: <input type='text' name='ud_name' value='{$order['Name']}'><br>\n"; echo "Location: <input type='text' name='ud_location' value='{$order['Location']}'><br>\n"; echo "Fault: <input type='text' name='ud_fault' value='{$order['Fault']}'><br>\n"; echo "Completed: <input type='text' name='ud_completed' value='{$order['Completed']}'><br>\n"; echo "<input type='Submit' value='Update'>\n"; echo "</form>\n"; } } change the maked line to the following: echo "<input type='text' name='ud_id' value='{$order['id']}'>\n";
  18. is there a field in the images table that refferences the appartment table to show which apartment the image is of?
  19. ok, so I assume that your print_r($POST) proves that there is a value in $_POST['ud_id']. I musn't have maid myself clear in the last post, I just want you to remove any use of backticks/quotes entierly, not remove the WHERE entierly. Try adding this into the end of the query string, where you had your where before: WHERE id = {$_POST['ud_id']} nothing else, just copy and paste that into the query string and let me know what you get back.
  20. good lad It's attitudes like that that get people like me so many contracts
  21. now you have the id field refference in quotes (highlighted below in red), remove these entierly as well as the fact that $_POST['ud_id'] does not apear to contain any data. WHERE 'id'='' if you still can't get it to work, insert the following in the line directly above the mysql_query($query) in your code and then copy and paste the output for us to see as well as a copy and paste of your php for assigning $query= as it stands now. print_r($query); exit;
  22. Your LIMIT 1,1 is why you are only ever getting the first row every time. What exactly do you want to happen?
  23. this line is still a problem: $query="UPDATE orders SET Name='{$_POST['ud_name']}', Location='{$_POST['ud_location']}', Fault='{$_POST['ud_fault']}' WHERE `id`='{$_POST[`ud_id`]}'"; You have used backticks in the PHP POST call (highlighted blue) - these need to be changed to single quotes - and still have backticks around id even though you have taken them off the other field names (highlighted red). Please also remember that your field names in MySQL, unlike ACCESS or SQL SERVER are case sensitive, so id is not the same as ID, is not the same as Id and so on.
  24. I don't think there is unless you use AJAX, although CURL might be able to do what you need in a round about way: you could use CURL to pull the info from the page that is in the iframe into the php scripts of the host window.
×
×
  • 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.