Jump to content

erok

Members
  • Posts

    62
  • Joined

  • Last visited

Posts posted by erok

  1. There is a little javascript. But unrelated, different part of the code. just to say good evening etc.

    Page suppose to retrieve information related to user. If, in previous visit user checked e.g. trans or short or long. That information suppose to appear at user personal page when he/she logged in. If user needs to make changes, he/she should be able make changes and keep the other informations unchanged as previous visit.

    Problem as i said before, CHROME and OPERA

    unable to retrive data from phpmyadmin. Actually when i use var_dump i see the variable values in there,

    Chrome unable hold onto it. Chrome unable to process it.

    INTERNET EXPLORER and FIREFOX able to.

  2. Hi all,

    i have php code working with INTERNET EXPLORER fine

    - able to insert, update, delete checkbox values.

    brief sections of code ;
    $bea=$dow['bea'];
    $dow1 = explode(",", $dow['len']);
    if(in_array(5,$dow1)) $che5="checked";
    else $che5="";
    if(in_array(10,$dow1)) $che10="checked";
    else $che10="";
    <input type="text" name="bea" value="<?php echo $bea ; ?>" />
    ..
    <input type="checkbox" name="len[]" size="9" maxlength="20" value="5" <?php echo $che5 ; ?> />
    <input type="checkbox" name="len[]" size="9" maxlength="20" value="10" <?php echo $che10 ; ?> />
    same code with GOOGLE CHROME
    unable to retrieve checkbox values
    able to upload checkbox values.
    I tried ...$che5="checked=checked";
    $che5="checked='checked'";
    $che5='checked' ;
    not helping.
    Anybody who has experience wih this kind of problem?
    directing , pointing kindly appreciated
    erok

     

  3. I got the following message with phpinfo() function
    when i tried to update second image. its picture id=2 in database
    Apache Environment
    REQUEST_METHOD POST
    QUERY_STRING no value
    REQUEST_URI /dakgooduy.php
    SCRIPT_NAME /dakgooduy.php
    HTTP Headers Information
    HTTP Request Headers
    HTTP Request POST /dakgooduy.php HTTP/1.1
    Accept text/html, application/xhtml+xml, */*
    PHP Variables
    Variable
    Value
    _REQUEST["title"] NEW HOPE 501
    _REQUEST["country"] USA
    .
    .
    _REQUEST["MAX_FILE_SIZE"] 2000000
    _REQUEST["caption"] Array
    (
    [0] => asli 328 211
    [1] => bill 328 502
    )
    _REQUEST["up"] Array
    (
    [0] => 2
    )
    _REQUEST["kitchen"] update
    _POST["title"] NEW HOPE 501
    .
    .
    _POST["MAX_FILE_SIZE"] 2000000
    _POST["caption"] Array
    (
    [0] => asli 328 211
    [1] => bill 328 502
    )
    _POST["up"] Array
    (
    [0] => 2
    )
    _POST["kitchen"] update
    _FILES["image"] Array
    (
    [name] => Array
    (
    [0] =>
    [1] => _70132432_vikingship.jpg
    )
    [type] => Array
    (
    [0] =>
    [1] => image/jpeg
    )
    [tmp_name] => Array
    (
    [0] =>
    [1] => C:xampptmpphp5153.tmp
    )
    [error] => Array
    (
    [0] => 4
    [1] => 0
    )
    => Array
    (
    [0] => 0
    [1] => 59725
    )
    )
  4. sorry i made it looks like a little bit ambiguous.

    following code is part of the for loop on the first post

    // use checkbox value="$nid" to transfer image id to to upload file.

    UPDATE:<input type="checkbox" name="up[]" value="<?php echo $nid=$row['id'] ; ?>" />

    I can updates two images no problem i got following message with var_dump function

    string(1) "9" string(2) "10"

    when i tried second image only i got following messege

    Notice: Undefined offset: 1 in C:xampphtdocsdakgooduy.php on line 166

    NULL

  5. " So then $_POST['up'] will be an array of checkbox values that were selected. You should start by looping through $_POST['up'] to get each ID value and process the uploaded file from there. "

    if i want to update two pictures i update both of the pictures. If i want to update first picture only i can update first picture only. I can not update second pictures only.

    if you look at my first post you can see my codes i m looping through already.

  6. Hi Ingolme

    I use checkbox value="$nid" to transfer image id to to upload file.

    UPDATE:<input type="checkbox" name="up[]" value="<?php echo $nid=$row['id'] ; ?>" />

    so it is coming from checkbox.

  7. Hi,

    I got the following errors. Sounds like i am able to bring (image id) $nid from the form page to here. Somehow this page does not recognize $nid

    I am trying to bring array $nid

    Warning: strlen() expects parameter 1 to be string, array given in C:xampphtdocsdakgooduy.php on line 149form ok false
    /* line 149 / if (!empty($_POST['up']) && isset($_POST['up']) && (strlen($_POST['up']) <= 3) && !empty($_FILES['image']) && isset($_POST['image']) || isset($_POST['caption']))
    {

     

    $formOk = true ;

     

    .

    .

     

    Notice: Undefined offset: 1 in C:xampphtdocsdakgooduy.php on line 166NULL

     

    /* line 166 / $nid=$_POST['up'][$i] ;

    /* line 167 / var_dump($nid) ;

     

    I defined $nid= array() ; earlier on the dakgooduy.php

     

    Any comment appreciated

  8. Hi all,

    I have two separate images in phpmyadmin database; files on xampp

    able to update

    first image alone ,

    able to update

    two images in two rows.

    But unable to update if i wanted to update second image alone.

     

    <form enctype="multipart/form-data" method="post" action="dakgooduy.php" >

    .
    .
    .
    $abc = "SELECT id, type, caption FROM dakimages WHERE pid=".$pid." ORDER BY id" or die();
    $rs = mysqli_query($con, $abc) ;
    $icount=mysqli_num_rows($rs) ;
    for($i=0;$i<$icount;$i++) {
    $row=mysqli_fetch_array($rs) ;
    $type=$row['type'] ;
    $nid= $row['id'] ;
    $caption=$row['caption'] ;

    echo $nid ;

    .

    .

    I use checkbox value="$nid" to transfer image id to to upload file.

    UPDATE:<input type="checkbox" name="up[]" value="<?php echo $nid=$row['id'] ; ?>" />

     

    In upload file "dakgooduy.php"

     

    $icount = 2 ;
    for($i=0;$i<$icount;$i++) {
    if (!isset($_POST['up'])) $formOk = false ;
    $path = $_FILES['image']['tmp_name'][$i] ;
    if (filesize($path) > 2000000 or filesize($path) < 1)
    {
    $formOk = false; //// something wrong here
    echo " form ok false " ;
    }
    else {
    $type = $_FILES['image']['type'][$i] ;
    $caption = $_POST['caption'][$i] ;
    $nid=$_POST['up'][$i] ;

     

    What might cause this problem?

    Any conceptual help greatly appreciated

     

  9. I am NOT saying i am doing the right thing. I have a problem and i am looking to solution.

    " if you have 2 SQL insert queries then it will insert 2 rows, with whatever data you have in each row. " i tried this and that way inserting the second picture twice.

    I also tried using array, giving error message. Do not insert any row at all.

    I tried PREPARE. it insert the row but give blob 0. Means no image inserted. Somehow prepare do not insert image. Maybe it is only for the string data.

    I need to insert each picture to separate rows.

    Any help appreciated

  10. with these codes second picture goes twice to database. I am unable to upload first picture. What am i doing wrong?
    Any help appreciated
    $pid = mysqli_insert_id($con) ;
    if (!empty($_FILES['image']) || !empty($_POST['caption']))
    { //1
    $formOk = true;
    //Assign Variables
    $path = $_FILES['image']['tmp_name'] ;
    $name = $_FILES['image']['name'] ;
    $type = $_FILES['image']['type'] ;
    $caption = $_POST['caption'] ;
    // check for file size.
    if (filesize($path) > 2000000)
    { //4
    $formOk = false;
    echo "Error: File size must be less than 2000 KB.";
    } //4+
    if ($formOk)
    {
    // read file contents
    $content2 = file_get_contents($path);
    $content = mysqli_real_escape_string($con, $content2);
    $caption = mysqli_real_escape_string($con, $caption) ;
    }
    }
    if (!empty($_FILES['image']) || !empty($_POST['caption']))
    { //1
    $formOk = true;
    //Assign Variables
    $path1 = $_FILES['image']['tmp_name'] ;
    $name1 = $_FILES['image']['name'] ;
    $type1 = $_FILES['image']['type'] ;
    $caption1 = $_POST['caption'] ;
    // check for file size.
    if (filesize($path1) > 2000000)
    { //4
    $formOk = false; //// something wrong here
    echo "Error: File size must be less than 2000 KB.";
    } //4+
    if ($formOk)
    {
    // read file contents
    $content2 = file_get_contents($path);
    $content1 = mysqli_real_escape_string($con, $content2);
    $caption1 = mysqli_real_escape_string($con, $caption) ;
    $sql = "insert into images (pid, name, type, content, caption) values ('{$pid}', '{$name}', '{$type}', '{$content}', '{$caption}'), ('{$pid}', '{$name1}', '{$type1}', '{$content1}', '{$caption1}')";
    $sql= mysqli_query($con, $sql) ;
  11. I faced a setback when i increase number of columns from 5 to 31 combination of radios, checkboxes and text, plus some images which are going to another table under the same form. I can not upload to database tables. No error messages. Is it because limitation of xampp? is it too much for xampp to able to handle?

  12. "The other option is to use a string data type instead of integer and then just store a list of the values, but the problem with a design like that is that you lose SQL's ability to quickly search for records if you're storing multiple searchable values in a single field. "

    I think i m willing to use a string data type instead of focusing on search speed.

  13. My question is ;
    How can i iterate into the same field different checkbox values? Implode function is good for displaying both values on the screen, but not inserting both values into same database field . Only inserting the first value in the checkbox to the field, ignores the the second or third...values.
    this code is able to
    if(!empty($_POST['period']))
    {
    $period=array() ;
    $period=implode(",", $_POST['period']) ;
    echo $period ;
    }

    echo out 100,200 on the screen when i checked both 100 and 200. But only insert value 100 to database. Values are integer not string.

     

    and looks like this;

    // insert into table

    $sql = "insert into dakdeneme (title, trans, length, period) values ('{$title}', '{$trans}', '{$length}', '{$period}')" ;
    $sql= mysqli_query($con, $sql) ;
    I want to display that particular boat is available for 100 days or 200 days or both 100 and/or 200 days depends on boat owner's preferences.
  14. True tinyint set. That is why excepts integer. But still " echo out ' 100,200 ' on the screen when i checked both 100 and 200. But only insert value 100 to database."

    how can i iterate in to the same field? implode helps only for displaying on the screen both values but not inserting into database.

  15. this code is able to
    if(!empty($_POST['period']))
    {
    $period=array() ;
    $period=implode(",", $_POST['period']) ;
    echo $period ;
    }
    echo out 100,200 on the screen when i checked both 100 and 200. But only insert value 100 to database.
    this code is able to insert into database phpmyadmin as value 0 or 1 whichever i check. Value "yes" or "no" unable to insert into database.
    if(!empty($_POST['trans'])) {
    $trans=$_POST['trans'] ;
    }
    echo $trans ;
    Yes  <input type="radio" name="trans" size="3" maxlength="3" value="1" /> instead of value="yes"
    No <input type="radio" name="trans" size="3" maxlength="3" value="0" /> instead of value="no"
×
×
  • Create New...