Jump to content

Dathremar

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by Dathremar

  1. I will try to explain the problem as much as I can before posting the code. I have a div which's width is determined by the size of the content. It contains two div's, one is the div which contains the picture and the second one is the div that has the description of the picture: date of upload and name of the file (this needs to be glued to the right side of the div). Here is the html code for it: <div class="box"> <div class="picture"> <img src="path/to/img" alt="" /> </div> <div class="description"> <span id="date">date of upload</span> <span id="picture_name">picture_name</span> </div> </div> And the problem here is when I have small pictures the "description" row can't get the width I need without breaking (because I am putting float right on the picture name). The file name goes on other row. The question is how to stretch the row, so the date and picture name are on the same row?
  2. Yeah the SELECT ... FOR UPDATE is used for different purpose. I guess I need to do application level synchronization for this. Thanks for the effort gizmola
  3. I will look into the SELECT ... FOR UPDATE thing. It looks like it might help me. If that is the case I will close the thread. Thanks gizmola.
  4. Sorry about not the explicit question, because I was thinking about it at the time I *thought* it was very clear :S Let me try to elaborate more. The problem is that I want to have one table for signals, if another table had changes. This table will be updated from two scripts. One that will update when there is a change and another script which will update when the changes are read. So what I want to do is to make sure the signal table does not get updated again while I am reading with the second script from the data table. That's why I want to lock the signal table, but only one row in it (so other rows can get updated). I pointed out InnoDb, because that's the table type for both tables. Maybe it doesn't make much difference in my case, but I know that MySql uses different locking mechanisms for different types, so I just wanted to let You guys know that the table is InnoDB.
  5. Hello all, I was wandering if it is possible to lock just a single table row on a MySql DB with InnoDB? What I want to do, is lock manually one row in a table while I read from other table and then release the lock so the row can be updated from another point. Many Thanks
  6. See http://www.php.net/manual/en/function.array-count-values.php for explanation of how array_count_values works. As if You need the number of elements in the array just use count($array);
  7. It looks fine to me, if these are multiple requests. It is defined by the "`message_id` > $last" thingy, so it outputs => 4 -3 -2 -1 then 4 - 3 - 2 => 4 - 3 => 4 ... Are You changing the $last in every request?
  8. I recommend You print out the sql string b4 you execute it, something like: $string = "SELECT ".$_SESSION['currentgig'." FROM $gigstable"; echo $string; Just to see what's the query and what are You missing.
  9. ELECT a.name, a.type_id, b.title, b.description, b.content_date, b.create_date, b.created_by, b.last_upd_date, b.last_upd_by, c.name as dept_name, content_id FROM (Content_Type a, Department c) LEFT OUTER JOIN Content b on a.type_id = b.content_type and a.type_id = b.content_type and b.dept_id = $dept_id and b.content_type = $type_id WHERE c.dept_id = $dept_id ORDER BY content_date DESC True. You need to put the table names in "( table name1 as a, table_name2 as b) LEFT JOIN ....." when you use join's.
  10. If You mean the going out of bottom border of the page, then You need to make something like a fixed number of post per page and put them in a fixed size boxes. In the box put if the text is longer then (lets say) 100 chars then make it a link to a new page.
  11. Make sure the table "Content_Type" has a column named type_id
  12. I created those 2 tables and I assume that game_cat is foreign key of cat_id from the game_cat table and run that sql and I get expected results
  13. Try this: "SELECT GC.cat_id, G.game_name, GC.cat_name FROM game G, game_cat GC WHERE G.game_cat = GC.cat_id GROUP BY GC.cat_id"
  14. Well If You don't want specific games on your home page then: "Select distinct(game_cat), game_name from game" , will do the trick.
  15. That is because all your fields have the same name and the last variable overwrites the all other. You better make them arrays like: <input type="text" size="25" maxlength="200" name="linkname"[] value="' . $row ['linkname'] .'"> <input type="text" size="25" maxlength="200" name="url[]" value="' . $row ['url'] .'"> So then in the $_POST['linkname'] and $_POST['url] You will have arrays with the the info from all the fields
  16. if($status=="1"){ $result="$sql = 'SELECT * FROM `email_table` where `email`=$email"; if(mysql_num_rows($result) > 0) { echo('The email address '.$email.' is already subscribed to the Maypole Juniors newsletter'); } } // missing bracket else { You are missing a bracket
  17. "Select distinct(category_id), game_name from table_name" This will give You one of each category. Not sure if that is what You need. Post the table structure if you want more help
  18. The problem is this: mysqli_stmt_bind_param($stmt, 'isdsss', $pn, $p, $d, $i); The second parameter determines the type of the bind parameters, see this., also this should match the number of bind parameters. You should change it to: mysqli_stmt_bind_param($stmt, 'isds', $pn, $p, $d, $i); I haven't check whats the actual type of your variables so please revise that
  19. If You are sure that the script just needs more time to execute use: set_time_limit() function
  20. I would suggest creating an array of the errors and pass them as a single variable through the URL something like: $error_array = array(); if ($key=='gender' && empty($val)) { $error_array[] = "Gender" ; } if ($key=='address' && empty($val)) { $error_array[] = "Home address" ; } $togourl ="../errors.php?missing1=".serialize($error_array); header("Location: $togourl"); And in the errors.php $error_array = unserialize($_GET["missing1"]); // Then do a loop to print out the items in the array
  21. Well You can join them all if You have to join them by something, but as it sounds I think You need UNION of all tables. Try something like: ( SELECT col1, col2, col3 FROM item1 WHERE conditions ) UNION ( SELECT col1, col2, col3 FROM item2 WHERE conditions ) UNION ( SELECT col1, col2, col3 FROM item3 WHERE conditions ) . . . ( SELECT col1, col2, col3 FROM item40 WHERE conditions ) Have in mind that the number of columns selected should be the same in all selects. Try reading this for more info.
  22. Why do You have 40 tables for stores? Make one table and name it store, another table name it items (items in stock) and make a table between to tell which store has which items. At least that sound's more logical to me. Joining 40 tables for a report really sounds too much.
  23. You need to create the database 1st. Then select the database and use the sql file in the SQL menu
×
×
  • 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.