Jump to content

boney alex

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

About boney alex

  • Birthday 05/31/1985

Profile Information

  • Gender
    Not Telling

boney alex's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, is it possible to use the GET method to gather more than one id from a link? Ive got a table of vehicles that have been displayed according to a search. The important variables that I need to take to my next page are: $makemodelID, $branchID, $collectiondate, and $returndate. <td><a href=\"bookthisvan.php?id=$makemodelID\branch=$branchID\collection=$collectiondate\returndate=$returndate\">Book this Van!!!</a></td> At the moment all this seems to do is set the id to "$makemodelID\branch=$branchID\collection=$collectiondate\returndate=$returndate". Are there any ways around this? Cheers
  2. Hi Barand, yeah Ive sorted my first problem, for some reason I rearranged the query and put the WHERE clause above all the sub-queries and it worked fine. BUT you are right about that fourth condition, how would you write that as a sub-query if you dont mind me asking? cheers
  3. Hi, Im trying to write a complicated query and Im almost there!! Im building a vehicle rental website and Im working on a search facility whereby users can select a branch location, a collection date and a return date, and all vehicles that are available between those dates, and at that branch are displayed. My vehicles are of different 'makesandmodels'. The query looks at whether there is AT LEAST one vehicle of a certain makeandmodel available between the dates. However, my query always throws a record of NULL fields for the first record. It seems to throw this record of NULL fields for the first makemodel that isnt available between those dates and at that location. For example, if vehicle 3 is the only vehicle with makemodel 1 and vehicle 3 isnt available between the dates, the query will display 3 1 NULL NULL NULL NULL etc. BUT work thereafter. "SELECT Vehicle.MakeModelID, Vehicle.VehicleID, MakeandModel.Make, MakeandModel.Model, MakeandModel.Specification, MakeandModel.Engine, MakeandModel.Load_Options, MakeandModel.Extras, MakeandModel.DailyRate FROM Vehicle LEFT JOIN MakeandModel ON Vehicle.MakeModelID = MakeandModel.MakeModelID AND VehicleID NOT IN (SELECT VehicleID FROM Reservation WHERE '$collectiondate' BETWEEN Collection_Date AND Return_Date) AND VehicleID NOT IN (SELECT VehicleID FROM Reservation WHERE '$returndate' BETWEEN Collection_Date AND Return_Date) AND VehicleID NOT IN (SELECT VehicleID FROM Rental WHERE '$collectiondate' BETWEEN Collection_Date AND Return_Date) AND VehicleID NOT IN (SELECT VehicleID FROM Rental WHERE '$returndate' BETWEEN Collection_Date AND Return_Date) AND VehicleID NOT IN (SELECT VehicleID FROM Reservation WHERE Collection_Date AND Return_Date BETWEEN '$collectiondate' AND '$returndate') AND VehicleID NOT IN (SELECT VehicleID FROM Rental WHERE Collection_Date AND Return_Date BETWEEN '$collectiondate' AND '$returndate') WHERE Vehicle.BranchID = '$branchID' GROUP BY MakeandModel.MakeModelID ORDER BY MakeandModel.DailyRate"
  4. Hi, Im trying to print out a table of vehicle information. Each vehicle record has an image (picture of the vehicle) associated with it. I have named each image the ID of the makemodel. Ive got a while loop which runs through the records and prints them out in a table, but Im struggling to display the image for each record. <table width="300" border="0" cellspacing="10"> <? while ($van = mysql_fetch_array($query)) { $makemodelID = $van['MakeModelID']; $make = $van['Make']; $model = $van['Model']; $spec = $van['Specification']; $vantype = $make. " " .$model. " " .$spec; $loadoptions = $van['Load_Options']; $engine = $van['Engine']; $extras = $van['Extras']; echo (" <tr> <td>Van:</td> <td>$vantype</td> <td rowspan="4"><img src="Images/$makemodelID.gif"></td> </tr> <tr> <td>Load Options:</td> <td>$loadoptions</td> </tr> <tr> <td>Engine:</td> <td>$engine</td> </tr> <tr> <td>Extras:</td> <td>$extras</td> </tr>"); } ?> </table> Obviously the problems lies somewhere around this line of code: <td rowspan="4"><img src="Images/$makemodelID.gif"></td> Any hints/ideas? Thank you.
  5. think ive sorted it, I just added a GROUP BY clause
  6. Hi, im in the process of writing a query but Im struggling to return the results Im after. Ive got two tables, vehicle and makeandmodel, and im trying to display a distinct row with regards to the make and model. For example, two vehicles may have the same make and model, but I only want to output one of those two records. My query so far is: SELECT Vehicle.VehicleID, Vehicle.MakeModelID FROM Vehicle LEFT JOIN MakeandModel ON Vehicle.MakeModelID = MakeandModel.MakeModelID The output Im gettin at the mo is VehicleID MakeModelID 1 3 2 3 3 1 4 2 5 4 6 4 Where two vehicles have the same make and model ( vehicles 1 and 2 AND 5 and 6), I only want the first record, so does LIMIT have to be used???
  7. Hi, I've got three buttons on a page and basically all I'm trying to do is put a BACK button as one of the three. But I'm having difficulties getting it to work. <form name="reservationinfo" action="reservationcollected.php" method="post"> <input type="hidden" name="reservationID" value="<? echo $reservationID; ?>"> <center> <table width="400" border="0" cellspacing="5"> <tr> <td><input type="submit" value= "Reservation Collected" class="button" name="submit"></td> <td><input type="submit" value='Cancel Reservation' onclick="reservationinfo.action='admincancelreservation.php'; return true;"></td> <td><input type="submit" value='Back' onclick="reservationinfo.action='history.go(-1)'; return true;"></td> </tr> </table> </center> </form> The solutions Ive been trying either take me to reservationcollected.php OR says history.go(-1) CANNOT BE DISPLAYED. Any ideas? Cheers
  8. Ive got this function which checks the username contains only letters and numbers and is between 6-12 characters long. How do I change this function to only allow letters and spaces and be of any length? <? function usernamecheck($username) { if (eregi ("^[[:alnum:]]{6,12}$", $username)) { return true; } else { return false; } } ?> Cheers
  9. I have a PHP calendar with each day as a link that the user can click on. To keep in line with the colours of my site I have made the links (dates) YELLOW and the background red. Below the calendar in the same page, I have a table which is populated by records from a table in my database. Each record has a reservationID which I have made a link aswell. Is there anyway to make these links in the table standard blue but keep my dates in yellow? I have made the dates yellow by using: <body bgcolor="#FFFFFF" link="#FFFF00" vlink="#FFFF00"> This is the line of code which shows the reservationID link: <td> <center><font face=Arial size=2><a href=\"reservationinfo.php?id=$reservationID\">$reservationID</a></font></center> Any ideas would be much appreciated.
  10. I have a PHP calendar with each day as a link that the user can click on. To keep in line with the colours of my site I have made the links (dates) YELLOW and the background red. Below the calendar in the same page, I have a table which is populated by records from a table in my database. Each record has a reservationID which I have made a link aswell. Is there anyway to make these links in the table standard blue but keep my dates in yellow? I have made the dates yellow by using: <body bgcolor="#FFFFFF" link="#FFFF00" vlink="#FFFF00"> This is the line of code which shows the reservationID link: <td> <center><font face=Arial size=2><a href=\"reservationinfo.php?id=$reservationID\">$reservationID</a></font></center> Any ideas would be much appreciated.
  11. Does anyone know how to highlight the current date in my calendar code?
  12. Ive found a simple calendar that displays all the days of the month as a link. I have saved the code below as eventcalendar.php and what I would like is when the user selects a certain day, that will take them to a page saved as eventinfo.php with the events for that day. I have managed to point each link to eventinfo.php, I'm just struggling to pass the actual date to that page, any ideas?? <?php mk_drawCalendar($_GET['m'],$_GET['y']); ?> </blockquote> </body> </html> <?php //********************************************************* // DRAW CALENDAR //********************************************************* function mk_drawCalendar($m,$y) { if ((!$m) || (!$y)) { $m = date("m",mktime()); $y = date("Y",mktime()); } /*== get what weekday the first is on ==*/ $tmpd = getdate(mktime(0,0,0,$m,1,$y)); $month = $tmpd["month"]; $firstwday= $tmpd["wday"]; $lastday = mk_getLastDayofMonth($m,$y); ?> <table cellpadding="2" cellspacing="0" border="1"> <tr><td colspan="7" bgcolor="#CCCCDD"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr><th width="20"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>"><<</a></th> <th><font size=2><?="$month $y"?></font></th> <th width="20"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m+1)>12) ? 1 : $m+1 ?>&y=<?=(($m+1)>12) ? $y+1 : $y ?>">>></a></th> </tr></table> </td></tr> <tr><th width=22 class="tcell">Su</th><th width=22 class="tcell">M</th> <th width=22 class="tcell">T </th><th width=22 class="tcell">W</th> <th width=22 class="tcell">Th</th><th width=22 class="tcell">F</th> <th width=22 class="tcell">Sa</th></tr> <?php $d = 1; $wday = $firstwday; $firstweek = true; /*== loop through all the days of the month ==*/ while ( $d <= $lastday) { /*== set up blank days for first week ==*/ if ($firstweek) { echo "<tr>"; for ($i=1; $i<=$firstwday; $i++) { echo "<td><font size=2> </font></td>"; } $firstweek = false; } /*== Sunday start week with <tr> ==*/ if ($wday==0) { echo "<tr>"; } /*== check for event ==*/ echo "<td class='tcell'>"; echo "<a href=\"eventinfo.php\" onClick=\"eventdate.value='$d-$m-$y';\">$d</a>"; echo "</td>\n"; /*== Saturday end week with </tr> ==*/ if ($wday==6) { echo "</tr>\n"; } $wday++; $wday = $wday % 7; $d++; } ?> </tr></table> Click on a date to select it and to populate the event date field on the left <br /> <?php /*== end drawCalendar function ==*/ } /*== get the last day of the month ==*/ function mk_getLastDayofMonth($mon,$year) { for ($tday=28; $tday <= 31; $tday++) { $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); if ($tdate["mon"] != $mon) { break; } } $tday--; return $tday; } ?> I think that the problem lies somewhere around this line: echo "<a href=\"eventinfo.php\" onClick=\"eventdate.value='$d-$m-$y';\">$d</a>"; Thanks for any help.
  13. Yeah, I've been trying that but they all seem to be large zip files that are downloaded and are fairly impossible to customised to your needs
  14. Hi, Im trying to add an event's calendar to my website. I have spent all day trying to get Obsidian's php event calendar to work but with no success at all. What I need is something very very similar to the birthday calendar available from the top nav bar of this forum. I have a reservation table with reservations that have a 'CollectionDate' and a 'ReturnDate'. I'd like to display each record on both of those dates. Any advice/tips/ knowledge of a good script and its whereabouts would be fantastic! Cheers
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.