Jump to content

Dathremar

Members
  • Posts

    169
  • Joined

  • Last visited

Posts 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. 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.

  3. 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

     

     

  4. 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?

  5. 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.

  6. 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

  7. 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

  8. 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 ;)

  9. 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
    

  10. 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.

  11. 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.

×
×
  • 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.