
prolife
Members-
Posts
20 -
Joined
-
Last visited
prolife's Achievements

Newbie (1/5)
0
Reputation
-
Hello please i dont know what went wrong ;this SQL is meant to count provided that this conditions are true. i want to count the total number of rooms that were booked for in a particular month. Please what is the right syntax to use when selecting from two different tables and then counting the total number of occurance. Here is the SQL i came up with but its messig up. SELECT (SELECT COUNT(*) FROM `rooms`) (SELECT COUNT(*) FROM `order`) AS `total_rooms` FROM `rooms` WHERE `order`.`checkin`>'$real_date' AND `rooms`.`cond` ='available'
-
Hello please i dont know what went wrong ;this SQL is meant to count provided that this conditions are true. i want to count the total number of rooms that were booked for in a particular month. Please what is the right syntax to use when selecting from two different tables and then counting the total number of occurance. Here is the SQL i came up with but its messig up. SELECT (SELECT COUNT(*) FROM `rooms`) (SELECT COUNT(*) FROM `order`) AS `total_rooms` FROM `rooms` WHERE `order`.`checkin`>'$real_date' AND `rooms`.`cond` ='available'
-
please i need your answers ASAP this error i delaying me. Thanks all
-
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>'; } } } ?>
-
along with the error above it also gave an uninitialised string error
-
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!
-
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!
-
after taking some time to think, it dawned on me that my approach was very wrong; i was just being unecessarilly complex. In brief all i did was to make some changes in my table, such that once a room is taken, the field with that particular "ROOMID" is autamatically updated as "UNAVAILABLE" meaning when making a search all i do is ("SELECT * FROM `rooms` WHERE `status`='AVAILABLE' "). Thats it very simple i guess?
-
Alright guys thanks for your efforts. Barrand and vinny42,thanks alot. I already sorted it out; I came up with an alternative. Thanks once again!
-
@vinny42 thanks, i now have a better understanding of what Join is all about,@ Barand thanks for your contribution too. Now the question is how do i get this solved? Here is a proper explanation of what i want to do maybe anyone could help me come up with an SQL to get the problem solved for the ROOMS table we have-: [roomid,room-name,price,catid,pics,rooom-descript,cond] For ORDER table we have-: [userid,orderid,room-id,catid,status,checkin,checkout,nokids,noadults,order-date,cond] This is exactly what i want to do (i want to check for the availability of a room) So i SELECT all from ROOMS, roomid from ORDERS provided checkin date and the checkout date provided by the user doesnt equal any checkin or checkout date already stored into the ORDERS table by another user and also display the rooms in ROOMS table whose roomid are not present in the ORDERS TABLE
-
actually the code is meant to check the availability of a room or rooms; such that once the user types the checkin and checkout date and clicks search, he gets a result of rooms that are avalable. I will also appreciate if anyone has a better code using the same fields. Thanks guys, you are the best!
-
Good day everyone, my SQL is giving yet another result i dont like, its duplicating results. Please anyone with an iidea on how to get this solved? Below is my sql: SELECT `rooms`.* , `order`.* FROM `rooms` INNER JOIN `order` ON `order`.`room-id`!=`rooms`.`roomid` AND `rooms`.`cond`='not taken' AND `order`.`checkin` !='$checkin' AND `order`.`checkout` !='$checkout'. In brief the results are to be displayed as long as the 'checkin' and 'checkout' dates are not already recorded or stored in the order table and also that the condition or maybe status of the room is 'not taken ' Thanks