prolife Posted September 23, 2013 Share Posted September 23, 2013 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! Quote Link to comment https://forums.phpfreaks.com/topic/282369-html-feedback-error/ Share on other sites More sharing options...
Love2c0de Posted September 23, 2013 Share Posted September 23, 2013 (edited) 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 . Kind regards, L2c. Edited September 23, 2013 by Love2c0de Quote Link to comment https://forums.phpfreaks.com/topic/282369-html-feedback-error/#findComment-1450784 Share on other sites More sharing options...
prolife Posted September 24, 2013 Author Share Posted September 24, 2013 along with the error above it also gave an uninitialised string error Quote Link to comment https://forums.phpfreaks.com/topic/282369-html-feedback-error/#findComment-1450973 Share on other sites More sharing options...
prolife Posted September 24, 2013 Author Share Posted September 24, 2013 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 clickedif(isset($_POST['save'])){// i verirify if file is an imageif(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>'; }}}?> Quote Link to comment https://forums.phpfreaks.com/topic/282369-html-feedback-error/#findComment-1450974 Share on other sites More sharing options...
prolife Posted September 24, 2013 Author Share Posted September 24, 2013 please i need your answers ASAP this error i delaying me. Thanks all Quote Link to comment https://forums.phpfreaks.com/topic/282369-html-feedback-error/#findComment-1450975 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.