Jump to content

ll87

Member
  • Posts

    36
  • Joined

  • Last visited

Posts posted by ll87

  1. What is the best way to deal with the gap between the left edge of an inline unordered list, and the first list item when there is no list style type.

     

    i am making a tabbed navigation bar and this blank space messes up my position of the items.

     

    i have tried putting margins and padding to 0 but clearly, just doing list-style : none simply removes the symbol and not the space it holds.

     

    any help appreciated.

     

    thanks, Alex :)

  2. I have a form which displays users notes that they have saved. I want a textarea to display the main note text when they select the title from a select box.

     

    I am trying to insert a value into a textarea depending on the option chosen from a select box. This i am obviously trying to do in Javascript.

     

    This ISN'T trying to put the same text into the textarea that is in the select box (this i can do easily).

     

    I have brought values from a MySQL database and stored the titles in a select box, and the main text (that i want in the text area) in hidden input variables.

     

    I have tried to 'id' both the titles and the main text that corresponds to them in the same way, thinking that i can get to the main text id by saying 'if title id == main text id set textarea value to main text value', but i cant work out how to do it!

     

    this may not be very clear. here is my html/php:

     

    <?php
    
       session_set_cookie_params(30*60,"/");
       session_start();
       include 'database.php';
    
       $id = $_SESSION['id'];
       $queryNotes = "SELECT title,note FROM notes WHERE member_id = $id";
       $result = mysql_query($queryNotes);
       $result1 = mysql_query($queryNotes);
       $rows = mysql_num_rows($result);
    
    ?>
    
    
    Note:
    
    
    
               <?php
                   for($i=0;$i<$rows;$i++){
                       $array = mysql_fetch_array($result1);
                       $note = $array['note'];
                       echo '';
                   }
               ?>
    
    
    
    
    Choose a note:
    
                   <?php
                       for($j=0;$j<$rows;$j++){
                           $array = mysql_fetch_array($result);
                           echo ''.$array['title'].'';
                       }
                   ?>
    
    
    

     

    if any one can offer a way of doing this it would end my headache! javascript is a pain in the arse but looks like im stuck with it as a means of client side scripting.

  3. every time you refresh it resends the query and im guessing ID is auto_increment so it just creates a new record.

     

    edit: as far as solving it goes, i'm afraid im not awake enough to take a proper look (and im pretty much a beginner)

  4. well i was correct to use MEDIUMBLOB as it can hold upto 16MB i think, where BLOB didnt hold enough, so that was the first problem.

     

    i was mistaken when i thought that hadn't fixed it, i was simply trying to upload a file too large and hadnt set up error checking adequately enough.

     

    now i have checks for the image dimensions as well.

     

    thanks for the help, that print_r is quite handy.

  5. ok so i found that i needed to use MEDIUMBLOB instead of BLOB for my 'img' field in my database as MEDIUMBLOB holds more. i thought 'bingo!' but no joy, nothing is being inserted at all.

     

    and i'm not getting any error messages to work from, does it think it is working?

     

    im using mysql query browser to check whether there's any data going in, and nothing

  6. well i started without the real escape string but ive tested your code with it there and with it not there. visibily nothing altered:

     

    and i took the round() off for now.

     

    
    Array
    (
       [image_upload] => Array
           (
               [name] => vIWDkn2wMI.gif
               [type] => image/gif
               [tmp_name] => /private/var/tmp/php932pd0
               [error] => 0
               [size] => 1563
           )
    
    )
    
    vIWDkn2wMI.gifimage/gif1563/private/var/tmp/php932pd0
    
    

     

    nothing unexpected there right?

  7. if im understanding you correctly, you mean take off the conditionals and just leave:

     

    $insertQuery = "INSERT INTO images(img_name,img_type,img_size,img,member_id) VALUES('$fileName','$fileType','$fileSize','$content','$id')" or die('something wrong?');
                   $insertImage = mysql_query($insertQuery);
    

     

    this still uploads nothing

  8. Hey guys, first off I am new to PHP and everything im doing is new to me. Ive read all the arguments for and against storing Images as BLOBs in a MySQL database, but i have to and i won't be having that many images anyways.

     

    I have a script (constructed after looking at many examples) but it appears nothing is uploading, so surely it must be something wrong with my queries?

     

    If i just run it with echo'ing the $_FILES data it displays that correctly so it's a problem with my queries.

     

    Here's my upload code:

     

    <?php
       session_start();
    
       include 'database.php'; //connects, works fine.
    
       $id = $_SESSION['id']; //user id.
    
       echo $fileName = $_FILES['image_upload']['name'];
       $fileType = mysql_real_escape_string($_FILES['image_upload']['type']);
       $fileSize = round($_FILES['image_upload']['size'] / 1024); //store size in KB.
       $fileTempPath = mysql_real_escape_string($_FILES['image_upload']['tmp_name']);
    
       /* Make sure image is of the type gif or jpeg and no more than 250KB */
       if($fileType == 'image/gif' || $fileType == 'image/jpeg' && $fileSize < 250){
           if($_FILES['file']['error'] > 0){
               echo 'Error: ' . $_FILES['image_upload']['error'];
           }
           else{
               $fp = fopen($fileTempPath,'r'); //open temporary file.
               $content = fread($fp,filesize($fileTempPath)); //start at start of file, read until end of file.
               fclose($fp);
    
               /* check to see if user already has an image */
               $checkForImage = mysql_query("SELECT member_id FROM images WHERE member_id = '$id'") or die(mysql_error());
               if(mysql_num_rows($checkForImage) != 0){
                   $updateQuery = "UPDATE images SET img_name='$fileName',img_type='$fileType',img_size='$fileSize',img='$content' WHERE member_id='$id'";
                   $updateImage = mysql_query($updateQuery);
               }
               else{
                   /* else insert new image with id of the user stored in member_id column in images table */
                   $insertQuery = "INSERT INTO images(img_name,img_type,img_size,img,member_id) VALUES('$fileName','$fileType','$fileSize','$content','$id')" or die('something wrong?');
                   $insertImage = mysql_query($insertQuery);
    
               }  
           }
       }
    
    
    
    ?>
    

     

    i have read tons of forums and this is my first time posting to find some help, so any would be great!

     

    Thanks

×
×
  • Create New...