Jump to content

duttydea

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by duttydea

  1. How can i adapt this cade to pull the times from my mysql database? Fields: Start (Start Time) eg. 06:00:00 Finish (Finish Time) eg. 16:00:00 Lunch ([Either Yes or No] Yes ill deduct an hour from the overall calculation) <? $lunchflag = false; //true if lunch taken echo "date 1:" . $datebegin . "<br />"; echo "date 2:" . $dateend . "<br />"; $diff = $dateend - $datebegin; $hours = floor($diff / (60 * 60)); $minutes = ($diff % (60 * 60)) / 60; //for nice round minutes you can round(), floor() or ceil() $hours = $lunchflag?$hours - 1:$hours; echo $hours . ":" . $minutes; ?> Thanks In advance
  2. sorry!! Im a noob! how do i do that?
  3. I have a Table that store my start & finish time for Work. Work_Date Start Finish Lunch 2008-08-09 07:00:00 14:00:00 Yes 2008-08-11 07:00:00 17:00:00 Yes I have tried the code below and get $elapsed = ($row["Finish"]) - ($row["Start"]); echo date("H:i", $elapsed); ?> Can someone help? Thanks in advance
  4. seen this:http://www.sitepoint.com/article/image-resizing-php <?php function imageResize($width, $height, $target) { //takes the larger size of the width and height and applies the formula accordingly...this is so this script will work dynamically with any size image if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); //returns the new sizes in html image tag format...this is so you can plug this function inside an image tag and just get the return "width=\"$width\" height=\"$height\""; } ?> <?php //get the image size of the picture and load it into an array $mysock = getimagesize("images/sock001.jpg"); ?> <!-using a standard html image tag, where you would have the width and height, insert your new imageResize() function with the correct attributes --> <img src="images/sock001.jpg" <?php imageResize($mysock[0], $mysock[1], 150); ?>> how can i adapt it to get the image url from mysql? thanks in advance
  5. What is the difference between the two paths? My pictures are stored on the manufacturers websites, this reduces our bandwidth but eans that the pictures come in various sizes.
  6. Got this error: 32. list($width, $height) = getimagesize($row["Product_picurl"]);
  7. Thanks for the help. I tried to set the image size in the script andcame across a Problem: Some of my images are different sizes and just resizing it to 150 x 150 will only mess up the pictures. Is there a script outthere that will rescale the picture on loading or willi have to resize all the pics manually? Thanks in advance
  8. Great Stuff, Cheers for the help, i do have one other related question!! Can the iamges be resized / reporportioned? Some of the images are Hi quality, when the user clicks on it it will display thanks in advance
  9. I am trying to create a HTML table that is a max of 4 cells accross & an unspecified amount down. In each of these cells there will be an image taken from a Mysql Server. The code below only shows 1 cell accross, How can i get the code to put a picture in each cell? <?php $Sql = "SELECT * FROM `prod_listing` WHERE Product_ID = '$id'"; $picresult = mysql_query($Sql); ?> <table width="30%" border="0" cellpadding="1" cellspacing="0" bordercolor="#FFFFFF"> <?php while ($row=mysql_fetch_array($picresult)) { ?> <td height="32"><img name="" src="<?php echo $row["Product_picurl"];?>" alt=""></td> <?php } //end of loop ?> </table> thanks in advance
  10. Im a Newcommer to PHP.. The Code was provided by a user on another forum. As a newbie i not sure how to include the mysql_query() in this script. Thanks in advance
  11. The following code fails to display the data in the html table. I have tried to change a database field to a name that is not present in the database table No PHP errors are shown, i dont even think the script is even connecting to the database.. What am i doing wrong? <?php //--------------- Connection Script ----------------------------\\ $username = "********"; $password = "********"; $hostname = "********"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); //------------------- Select Database --------------------------\\ $selected = mysql_select_db("dutty_dp",$dbh) or die("Could not select first_test"); ?> </head> <body> <? $query = "SELECT `Product_picurl`, `Product_Name`, `Product_Description`, `Product_price`, `Product_Category`, `Product_Pdf`, `Product_Cart`, `Product_Features`, `Product_subcat`, `Key` FROM `prod_listing` where `Product_subcat` = 'Absorption Panels'"; ?> <table width="42%" cellpadding="1" cellspacing="0"> <? while ($row=mysql_fetch_array($query)) { ?> <tr> <td height="16" colspan="2" valign="top"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <?php echo $row["Product_Name"];?> / Product ID <?php echo $row["Product_Id"] ;?></font></div></td> </tr> <tr> <td width="19%" height="108"><div align="justify"><?php echo $row["Product_picurl"];?> <p align="center"> £<?php echo $row["Product_price"];?></div></td> <td width="81%" valign="top"><?php echo $row["Product_Description"];?></td> </tr> <tr> <td height="25" colspan=2><p align="center"><a href="#">Add to Cart</a></p> </td> </tr> <? } //end of loop ?> </table> Can some one please help? Thanks in advance
×
×
  • 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.