Jump to content

zed420

Members
  • Posts

    160
  • Joined

  • Last visited

    Never

Everything posted by zed420

  1. Sorry madTechie same error mgs as before Warning: mktime() expects parameter 5 to be long, string given in C:\xampp\htdocs\calendar\test.php on line 16 error
  2. Sorry to bother you again this is what I'm getting if take off +1 Warning: mktime() expects parameter 5 to be long, string given in C:\xampp\htdocs\calendar\test.php on line 16 error
  3. Thank you MadTechie for your reply just one thing, I know it should give error on post date but its giving it on Todays date too. any thoughts??? Rest is fine Zed
  4. Hi All Can someone please help me with this code all I'm trying to do is book driving lessons online via Calendar. So if someone hits on passed date,month or year he/she gets message 'The date has passed' else they can book their lesson on clicked day. There are NO errors on script but it not working right. thanks Zed <?php $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; $today = date("j"); $month = date("n"); $year = date("y"); if (($day < $today)&&($cMonth <= $month)){ echo "<p>This date has Passed, Please choose another</p>"; }elseif (($cMonth < $month)&&($cYear <= $year)){ echo "<p>This date has Passed, Please choose another</p>"; }elseif (($cMonth >= $month)&&($cYear >= $year)){ echo "You are about to book a lesson for <div class=\"everyday\">$day $cMonth $cYear</div>"; }else{ echo "You are about to book a lesson for <div class=\"everyday\">$day $cMonth $cYear</div>"; } ?>
  5. Maq you're Star yes that worked. Thanks Zed
  6. Hi All Got some help with this calendar couple of days ago but I've got another problem now. This line below I'm trying to send it to another page with $_GET method but very unsuccessfully. Could someone help please. Thanks echo "<td align='center' valign='middle' height='20px'> <a href=\"test.php\" STYLE=\"TEXT-DECORATION: NONE\">". $day . "</a></td>\n"; This is how I'm using get method on test.php page $day = $_GET['day']; echo "$day"; <?php $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13 ) { $next_month = 1; $next_year = $cYear + 1; } ?> <div id="calendar_div" name="calendar_div"> <table width="400"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"> <a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <table width="100%" border="0" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; $today = date("j"); $month = date("n"); for ($i=0; $i<($maxday+$startday); $i++) { $day = ($i - $startday + 1); if(($day == $today)&&($cMonth == $month)){ $day = "<b>".($i - $startday + 1)."</b>"; } else { $day = ($i - $startday + 1); } if(($i % 7) == 0 ) echo "<tr>\n"; if($i < $startday) echo "<td></td>\n"; else echo "<td align='center' valign='middle' height='20px'> <a href=\"test.php\" STYLE=\"TEXT-DECORATION: NONE\">". $day . "</td>\n"; if(($i % 7) == 6 ) echo "</tr>\n"; } ?> </table> </td> </tr> </table> </div>
  7. Thank you phpSensei
  8. phpSensei I thank you ,I thank you and I thank you that was a great help Zed
  9. Hi All I've taken this simple calendar from net I'm trying to highlight Today's date I can NOT seem to work it out. Some help will be greatly appreciated. Thanks Zed <?php $monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n"); if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y"); $cMonth = $_REQUEST["month"]; $cYear = $_REQUEST["year"]; $prev_year = $cYear; $next_year = $cYear; $prev_month = $cMonth-1; $next_month = $cMonth+1; if ($prev_month == 0 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($next_month == 13 ) { $next_month = 1; $next_year = $cYear + 1; } ?> <div id="calendar_div" name="calendar_div"> <table width="400"> <tr align="center"> <td bgcolor="#999999" style="color:#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%" align="left"> <a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#FFFFFF">Previous</a></td> <td width="50%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" style="color:#FFFFFF">Next</a> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <table width="100%" border="0" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#999999" style="color:#FFFFFF"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td> </tr> <tr> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>M</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>W</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>T</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>F</strong></td> <td align="center" bgcolor="#999999" style="color:#FFFFFF"><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; for ($i=0; $i<($maxday+$startday); $i++) { if(($i % 7) == 0 ) echo "<tr>\n"; if($i < $startday) echo "<td></td>\n"; else echo "<td align='center' valign='middle' height='20px'> <a href=\"test.php\" STYLE=\"TEXT-DECORATION: NONE\">". ($i - $startday + 1) . "</td>\n"; if(($i % 7) == 6 ) echo "</tr>\n"; } ?> </table> </td> </tr> </table> </div>
  10. Thank you all you have been wonderfull. zed
  11. What if they want to pay by credit or debit card? Its Driving Instructor website, fairly simple.
  12. Thanks thats great help
  13. Hi All Can anyone please tell me how can I add payment methods to my site e.g. Paypal, Google etc.. Thanks Zed
  14. Thanks I'll try that
  15. I thought I was finished but unfortunately I have another problem now. I can not Decrease the item 'qty' or their 'price'. Increase is working fine. /********************************************* Amend customer's basket *****************************************/ function amendBasketqty(){ if($_POST['update']){ $item_id = $_POST["item_id"]; $qty=$_POST["qty"]; $price += ($_POST['price'] * $_POST['qty']); $sql = "UPDATE `basket` SET qty = '$qty', price = '$price' WHERE item_id = '$item_id'" or die(mysql_error()); $query = mysql_query($sql) or die(mysql_error()); if (mysql_affected_rows() > 0) { echo "<center><font color=red size=2>No. = $item_id has been Updated</font></center>"; showBasket(); balanceToPay(); } } } /******************************************** Show Customer's Basket ***********************************************/ function showBasket(){ $name = $_SESSION['name']; $query = "select basket_id,cat.cat_id,cat.name,item.cat_id,item.item_id,item_name,item.des,basket.price,basket.qty,basket.sname FROM cat,item,basket,user WHERE item.item_id = basket.item_id AND basket.sname = '$name' GROUP BY basket_id "; $result = mysql_query($query)or die(mysql_error()); ?> <form action="<?php echo $PHP_SELF ?>" method="POST"> <TABLE BORDER=0 WIDTH=100% CELLSPACING=1 CELLPADDING=3 ALIGN=CENTER bgcolor="#BBBBBB"> <TR> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Remove </b></font></TD> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Item ID </b></font></TD> <td width="25%" bgcolor="#F0C9BF"><font color=blue><b>Item Name</b></font></TD> <td width="35%" bgcolor="#F0C9BF"><font color=blue><b>Description</b></font></TD> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Price</b></font></TD> <td width="0%" bgcolor="#F0C9BF"><font color=blue><b>Qty</b></font></TD> </tr> <? while ($row = mysql_fetch_array($result)) { extract($row); echo "<tr class=\"td\"> <td><a href=detail.php?basket_id=" . $row['basket_id'] . ">Remove</a></td> <td>" . $row['item_id'] . "</td> <td>" . $row['item_name'] . "</td> <td><font size=2>" . $row['des'] . "</font></td> <td><input name=\"price\" type=\"text\" value=" . $row['price'] . " readonly=\"readonly\" /></td> <input name=\"item_id\" type=\"hidden\" value=" . $row['item_id'] . "> <td><input name=\"qty\" type=\"text\" size=\"2\" value=" . $row['qty'] . "></td> </tr>"; } ?> </table><input name="update" type="Submit" value="Update Cart"/> </form><? } //end of function showbasket
  16. Thank you all for helping me specially Maq, Soak, and meomike2000 Zed
  17. Here it is /********************************************* Amend customer's basket *****************************************/ function amendBasketqty(){ if($_POST['update']){ $item_id = $_POST["item_id"]; $qty=$_POST["qty"]; $query = "UPDATE `basket` SET qty = '$qty' WHERE item_id = '$item_id'" or die(mysql_error()); echo "$query"; $query = mysql_query($sql) or die(mysql_error()); if (mysql_affected_rows() > 0) { echo "<center><font color=red size=2>No. = $item_id has been Updated</font></center>"; showBasket(); balanceToPay(); } } } /******************************************** Show Customer's Basket ***********************************************/ function showBasket(){ $name = $_SESSION['name']; $query = "select basket_id,cat.cat_id,cat.name,item.cat_id,item.item_id,item_name,item.des,basket.price,basket.qty,basket.sname FROM cat,item,basket,user WHERE cat.cat_id = item.cat_id AND item.item_id = basket.item_id AND basket.sname = '$name' GROUP BY basket_id DESC"; $result = mysql_query($query)or die(mysql_error()); ?> <form action="<?php echo $PHP_SELF ?>" method="POST"> <TABLE BORDER=0 WIDTH=100% CELLSPACING=1 CELLPADDING=3 ALIGN=CENTER bgcolor="#BBBBBB"> <TR> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Remove </b></font></TD> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Item ID </b></font></TD> <td width="25%" bgcolor="#F0C9BF"><font color=blue><b>Item Name</b></font></TD> <td width="35%" bgcolor="#F0C9BF"><font color=blue><b>Description</b></font></TD> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Price</b></font></TD> <td width="0%" bgcolor="#F0C9BF"><font color=blue><b>Qty</b></font></TD> </tr> <? while ($row = mysql_fetch_array($result)) { extract($row); echo "<tr class=\"td\"> <td><a href=detail.php?basket_id=" . $row['basket_id'] . ">Remove</a></td> <td>" . $row['item_id'] . "</td> <td>" . $row['item_name'] . "</td> <td><font size=2>" . $row['des'] . "</font></td> <td>" . $row['price'] . "</td> <input name=\"item_id\" type=\"hidden\" value=" . $row['item_id'] . "> <td><input name=\"qty\" type=\"text\" size=\"2\" value=" . $row['qty'] . "></td> </tr>"; }// end of while ?> </table><input name="update" type="Submit" value="Update Cart"/> </form><? } //end of function showbasket
  18. Thanks James and Joe I'm so near but so far , when I'm printing the query I'm getting some thing like this, UPDATE `basket` SET qty = '6' WHERE basket_id = '3'Query was empty and it's NOT updating the record in Database. I've used the post method now thats why qty and basket_id is not empty. Thanks very much
  19. Hi All Can someone please help me out here, I can not seem to update this query. if I print out the query it has 'basket_id' and 'qty' empty. Where am I going wrong?? /********************************************* Amend customer's basket *****************************************/ function amendBasketqty(){ if($_POST['update']){ $basket_id = $_GET["basket_id"]; $qty=$_GET["qty"]; $query = "UPDATE basket SET qty='$qty' WHERE basket_id = '$basket_id'"; echo "$query"; if (mysql_affected_rows() > 0) { echo "<center><font color=red size=2>No. = $basket_id has been Updated</font></center>"; showBasket(); balanceToPay(); } } } /******************************************** Show Customer's Basket ***********************************************/ function showBasket(){ $name = $_SESSION['name']; $query = "select basket_id,cat.cat_id,cat.name,item.cat_id,item.item_id,item_name,item.des,basket.price,basket.qty,basket.sname FROM cat,item,basket,user WHERE cat.cat_id = item.cat_id AND item.item_id = basket.item_id AND basket.sname = '$name' GROUP BY basket_id DESC"; $result = mysql_query($query)or die(mysql_error()); ?> <form action="<?php echo $PHP_SELF ?>" method="POST"> <TABLE BORDER=0 WIDTH=100% CELLSPACING=1 CELLPADDING=3 ALIGN=CENTER bgcolor="#BBBBBB"> <TR> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Remove </b></font></TD> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Item ID </b></font></TD> <td width="25%" bgcolor="#F0C9BF"><font color=blue><b>Item Name</b></font></TD> <td width="35%" bgcolor="#F0C9BF"><font color=blue><b>Description</b></font></TD> <td width="10%" bgcolor="#F0C9BF"><font color=blue><b>Price</b></font></TD> <td width="0%" bgcolor="#F0C9BF"><font color=blue><b>Qty</b></font></TD> </tr> <? while ($row = mysql_fetch_array($result)) { extract($row); echo "<tr class=\"td\"> <td><a href=detail.php?basket_id=" . $row['basket_id'] . ">Remove</a></td> <td>" . $row['item_id'] . "</td> <td>" . $row['item_name'] . "</td> <td><font size=2>" . $row['des'] . "</font></td> <td>" . $row['price'] . "</td> <input name=\"qty\" type=\"hidden\" value=" . $row['basket_id'] . "> <td><input name=\"qty\" type=\"text\" size=\"2\" value=" . $row['qty'] . "></td> </tr>"; }// end of while ?> </table><input name="update" type="Submit" value="Update Cart"/> </form><? } //end of function showbasket
×
×
  • 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.