Jump to content


Photo

HTML feedback error

html php

  • Please log in to reply
4 replies to this topic

#1 prolife

prolife

    Member

  • Members
  • PipPip
  • 18 posts

Posted 22 September 2013 - 10:52 PM

I have yet another error guys,im currently working on an hotel App i'm almost done so i'm doing some debugging. I have a page where the hotel administrator can edit gallery, now when i was done editing i clicked save, it actually updated and stored it into the database but it displayed the error below in the text field

 

 

<br />
<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Uninitialized string offset: 0 in C:\wamp\www\hot\apps\admin-edit-gallery.php on line <i>53</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0038</td><td bgcolor='#eeeeec' align='right'>391904</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='C:\wamp\www\hot\apps\admin-edit-gallery.php' bgcolor='#eeeeec'>..\admin-edit-gallery.php<b>:</b>0</td></tr>
</table></font>
 

 

Do you guys know what could have gone wrong? Cheers everyone!



#2 Love2c0de

Love2c0de

    Advanced Member

  • Members
  • PipPipPip
  • 366 posts
  • LocationThe Pleiades
  • Age:23

Posted 23 September 2013 - 06:20 AM

Good afternoon,

 

Can you provide us the code from the edit gallery script?

 

When counting the length of strings, it returns the actual number of characters but when accessing each individual character of the string it is 0 based, so $str[0] for example would return the first character.

 

I'm sure you know that but clearly an offset issue. I'd start by echoing each variable/value at different points of the script leading up to line 53 to see what values you are actually getting. Hard to really suggest anything with no code apart from it's an offset issue ;D .

 

Kind regards,

 

L2c.


Edited by Love2c0de, 23 September 2013 - 06:20 AM.


#3 prolife

prolife

    Member

  • Members
  • PipPip
  • 18 posts

Posted 23 September 2013 - 10:29 PM

along with the error above it also gave an uninitialised string error



#4 prolife

prolife

    Member

  • Members
  • PipPip
  • 18 posts

Posted 23 September 2013 - 10:31 PM

Here is the code

 

 

 

 

<div id="admin-vert-div"></div>
    <a href="<?php echo' '.ADMIN_INDEX.' '; ?>"><div id="admin-page-name"> Admin|Manage Rooms</div></a>
    <div id="admin-welcome">Welcome Chinaka</div>
    <div id="admin-body">
        <div id="admin-manage-news">
           <form action="" method="post" enctype="multipart/form-data">
           <table height="10" width="800" >
                
                <tr>
                    <td height="50" width="50" align="left" class="admin-ttl1"><b>Edit Gallery</b></td>
                </tr>


                <?php
                  // i checked if  the edit button was actually clicked
                  if(isset($_POST['edit'])){
                      $object->database();

                   // if the edit button wa clicked then i carry out my query
                      $object->set_sqlstr("SELECT * FROM `gallery` WHERE `picsid` = '".$_GET['picsid']."' ");
                      $object->querydata();
                     
                  }

                ?>        
                         // Now i start displaying results from the quary above in form textarea so it can be edited
                <tr>
                    <td height="50" width="50" align="left"><textarea name="pics_name" cols="50" rows="1"><?php echo''.$object->data['pics-name'] .''; ?></textarea></td>
                </tr>

                <tr>
                    <td height="50" width="50" align="left" class="admin-details-form"><b>description</b></td>
                </tr>
                <tr>
                    <td height="50" width="50" align="left"><textarea name="pics_descript" cols="50" rows="4"><?php echo''.$object->data['pics-descript'] .''; ?></textarea></td>
                </tr>

                <tr>
                    <td height="10" width="50" align="left" class="admin-details-form"><b>Select Avater</b></td>
                </tr>

                <tr>
                    <td height="10" width="50" align="left"><input type="file" name="image" value="" class="inputbox" size="30" /></td>
                </tr>
                <tr>
                <td height="10" width="50" align="left"><input type="hidden" name="picsid" value="<?php echo''.$object->data['picsid'].'';  ?>"/></td>
                <tr/>
                    <td height="10" width="50" align="center"><b><input type="submit" name="save" Value="Save"/></b></td>
                </tr>

         </table>
         </form>
       </div>

       </div>  
    </div>
<?php

//when i'm done editing i check if save has been clicked
if(isset($_POST['save'])){
// i verirify if file is an image
if(isset($_FILES['image'])){
        if($_FILES['image']['tmp_name'] == 'none') {
            echo "<b>File did not successfully upload. Check the file size. File must be less than 500K.<br>";
        }
        if("image/jpeg" != $_FILES['image']['type']){
            echo '<div id="query_report_admin_od"> File is not a picture. Please try another file.<br></div>';    
                        
        }
        else {
            
            $pix = $_FILES['image']['name'];
            $destination = $_SERVER['DOCUMENT_ROOT'].'hot/images/gallery_upload'.'/'.$pix."";
            $temp_file = $_FILES['image']['tmp_name'];
            move_uploaded_file($temp_file,$destination);
            $pix = $_FILES['image']['name'];

               $title=""; $body="";
               $pics_name=$_POST['pics_name']; $pics_descript=$_POST['pics_descript'];
               $object->database();

               // query to update gallery
               $object->set_sqlstr(htmlspecialchars(" UPDATE `gallery` SET  `pics-name`='$pics_name', `pics-descript`='$pics_descript', `pics-avatar`='$pix' WHERE `picsid`= ".$_POST['picsid']."  ")) ;
               $object->ex_scalar();
               echo'<div id="query_report_admin_od">succesful</div>';

    }

}
}

?>



#5 prolife

prolife

    Member

  • Members
  • PipPip
  • 18 posts

Posted 23 September 2013 - 10:36 PM

please i need your answers ASAP this error i delaying me. Thanks all






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com