Jump to content

dubc07

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

Everything posted by dubc07

  1. Here is the updated code with the style set in it. It will style one of the days but. if i rap the rest within the while loop it will still echo the days how ever many times there are rows on the db. <?php for ($i=0; $i<($maxday+$startday); $i++) { $curday= $i - $startday + 1; if(($i % 7) == 0 ) echo "<tr>\n"; if($i < $startday) echo "<td></td>\n"; else if($curday == $dy && $mn == $strmn && $yr == $cYear){ echo "<td><a href=\"javascript:pulltask()\"><span class=\"blockss\">". ($i - $startday + 1) . "</span></a></td>\n"; }else{ //echo $cMonth; $realMonth=str_replace(",","",$cMonth); $t=mysql_query("SELECT * FROM table WHERE id='$id' AND month='$realMonth' AND year='$cYear'"); while($s=mysql_fetch_array($t)){ $dt=$s["dt"]; if($dt==($i - $startday + 1)){ $style='blocksstsks'; }else{ $style='blocker'; } } //echo "<td><a href=\"javascript:pulltask()\"><span class=\"blocksstsks\">". ($i - $startday + 1) ."</span></a></td>\n"; echo "<td><a href=\"javascript:pulltask()\"><span class=\"$style\">". ($i - $startday + 1) . "</span></a></td>\n"; } if(($i % 7) == 6 ) echo "</tr>\n"; } ?> any help is good Thanks
  2. Hello All, I have a calendar script that get the current days in month and outputs the days of month and then places a css style on the current day. Im trying to also place a different css on the days i have tasks or events on. I can run a while loop and grab the day which have events and echo them. however This creates duplicate days for $startday and dt. Can anyone help me figure out a different way of going about this so it only outputs one day not duplicates See Script below. <?php error_reporting(0); $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 class="cal_hld"><div class="cal_brd" id="calendar_div" style="width:207px; height:auto;"name="calendar_div"> <table width="200"> <tr> <td height="115" align="center"> <table width="100%" border="0" cellpadding="2" cellspacing="2"> <tr align="center"> <td colspan="7" bgcolor="#C4E1F3" style="color:#FFFFFF"><div style="width:190px; height:19px; float:left;"><strong></strong> <div style="width:19px; height:19px; float:left; margin-right:3px;"><a href="javascript:retrv(<?php echo "$prev_month , $prev_year"; ?>)"><img src="images/prev_mnt.png" width="19" height="19" border="0" /></a></div><div id="monthText" style="float:left; width:100px; font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000; margin-left:22px;"><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></div><div style="width:19px; height:19px; float:right; margin-left:15px;"><a href="javascript:retrv(<?php echo "$next_month , $next_year"; ?>)"><img src="images/next_mnt.png" width="19" height="19" border="0"/></a></div> </div></td> </tr> <tr class="days_st" style="padding-bottom:5px"> <td height="23" ><strong>S</strong></td> <td ><strong>M</strong></td> <td ><strong>T</strong></td> <td ><strong>W</strong></td> <td ><strong>T</strong></td> <td ><strong>F</strong></td> <td class="days_st" ><strong>S</strong></td> </tr> <?php $timestamp = mktime(0,0,0,$cMonth,1,$cYear); $maxday = date("t",$timestamp); $thismonth = getdate ($timestamp); $startday = $thismonth['wday']; $dy=date('d'); $mn=date('m'); // echo $mn; $strmn= preg_replace('/[\,]/', '', $cMonth); $resd=str_replace(",","",$cMonth); $yr=date('Y'); //echo "$resd $cYear"; for ($i=0; $i<($maxday+$startday); $i++) { $curday= $i - $startday + 1; if(($i % 7) == 0 ) echo "<tr>\n"; if($i < $startday) echo "<td></td>\n"; else if($curday == $dy && $mn == $strmn && $yr == $cYear){ echo "<td><a href=\"javascript:pulltask()\"><span class=\"blockss\">". ($i - $startday + 1) . "</span></a></td>\n"; }else{ //echo $cMonth; $realMonth=str_replace(",","",$cMonth); $t=mysql_query("SELECT * FROM table WHERE id='myid' AND month='$realMonth' AND yyear='$cYear'"); while($s=mysql_fetch_array($t)){ $dt=$s["dt"]; if($dt==($i - $startday + 1)){ echo "<td><a href=\"javascript:pulltask()\"><span class=\"blocksstsks\">". ($i - $startday + 1) . "</span></a></td>\n"; }else{ }} if($dt==($i - $startday + 1)){ }else{ //echo "<td><a href=\"javascript:pulltask()\"><span class=\"blocksstsks\">". ($i - $startday + 1) ."</span></a></td>\n"; echo "<td><a href=\"javascript:pulltask()\"><span class=\"blocker\">". ($i - $startday + 1) . "</span></a></td>\n"; } } if(($i % 7) == 6 ) echo "</tr>\n"; } ?> </table></td> </tr> </table> </div></div> ;
  3. Thanks for all your help this function works great.
  4. Wish i could say that this worked but it only gave me a single value
  5. I'm trying to get the total for each product and add them for a Grand Total to list outside the loop or only echo once I can do the addition but it will echo 5 time in the loop. How would I go about doing this? Thanks in advance for your help. <?php $cart2="SELECT * FROM products WHERE pro_indid='glass'"; $res2 = mysql_query($cart2) or die('Error, query failed 2'); while($cr2=mysql_fetch_array($res2)){ $totrow=$cr2["total"]; ///the $totrow will echo below 5 time each price in database 5.67 which the total should be 28.35 // echo $totrow; } ///Output of total would be $28.35 ?> The output I'm looking for would be like so 5.67 5.67 5.67 5.67 5.67 GrandTotal:28.35
  6. Ok basically i have a database with news titles on it. The Group By Function works if i have at least 2 of every type of title In the post above you will notice that there are multiple records of latest news, The group by function does what it needs to do, however it does not pull the row headline news from the database because Group by does not allow that. the out put im looking for is the following. <option value="latest news">latest news</option> <option value="headline news">headline news</option> Just once for each. if i run a regular loop it it will continue to spit out latest news however many i have on the database. so this is why i tried the Group by. But it will not pull a single listing in the database.
  7. Basically i was just wanting to see if there is another method to do a while loops to grab all the news but if there are more than one with the same title it would just out put it once. Anyone?
  8. In the database set your type id fields to "INT" "auto increment" This will help individualize your images in the database and allow multiple uploads for images with same name. If you are wanting to set the images to an id use the copy rename function on upload.
  9. I have a database with several rows on it with subjects like so. latest news | name | subject latest news | name | subject headline news | name | subject latest news | name | subject I'm using a dropdown menu onSelect via javascript and ajax to list the news. However i'm currently using the group query to only pull (latest news) once. The group function will only select rows on the database that have multiple listings. This query will not pull headline news as there is only one in the database. my query is like so: <?php $query = "SELECT * FROM news WHERE title = '$group' GROUP BY title"; $result = mysql_query($query) or die('Error, query failed'); ?> Does anyone have a solution to this problem. I have tried doing else loops and so forth.. any help is appreciated.
  10. What i'm trying to do is pull from a table the amount for each record associated to an id number and add them together. Below shows what i have so far which is not even a start. <?php $sub = mysql_query('SELECT * FROM guestpayment WHERE sponsorid="'.$_SESSION['sponsorid'].'"'); while($subrow = mysql_fetch_array($sub)) { $amount= $subrow['amount']; $fname=$subrow['fname']; $totamount=$amount + $amount; echo "Firstname: $fname Total Amount: $totamount<br><br>"; } ?> I have two rows in the table with the same user "Jane" The above code will output the following: Firstname: Jane Total Amount: 60.00 <----This adds 30.00 twice which is not what im needing to do. Firstname: Jane Total Amount: 240.00<------This adds 120.00 Twice The output im looking to get is the following: Firstname: Jane Total Amount: 150.00<-------This would just add the two numbers from each table 30.00 and 120.00 and this would just echo one row instead of 2 for each entry on he table. Any help is appreciated Thanks
  11. What im trying to do is this, I have the code working on the current function below, however what I'm wanting to do is if $width greater than $height by 200 I have no idea how this would be done. Any help is appreciated. <?php if($height > $width || $height == $width ){ $dosomthing; } ?>
  12. That Solved it for now THANKS ALOT!!!!
  13. I currently have 2 tables on my database 1service and 2subs I have been trying to use a while loop function to pull the category's and the subcategory's But when it pulls them it echo like this cat1 sub1 cat1 sub2 cat1 sub3 and so forth..... I'm just wondering of it is possible to echo each category once and then list each subcat that associated with the main category. Like this cat1 sub1 sub2 sub3 cat2 sub1 sub2 sub3 Any help is appreciated... Thanks This is what i have so far but it doesn't work. it will echo Services1 - sub1 Services2 - sub1 Services1 - sub2 Services2 -sub2 Services1 - sub1 Services2 - sub1 <?php $query = "SELECT service, subserv "."FROM services, subserv "; $result = mysql_query($query) or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ echo $row['service']. " - ". $row['subserv']; echo "<br />"; } ?>
  14. The above array would work but it only limits 3 subs after main service. There has to be some loop feature that can pull data as it is in the database There are an unlimited amount of subs on the table
  15. How could i put the query into an array? I'm pretty new too all this, So sorry for the dumb questions!
  16. Currently i have two tables on the DB One which name is service and the other which is subcategory I'm wanting to pull the service name and list it's subcategory's under it my code is here <?php $query = "select * from servicelink "; $result = mysql_query($query) or die('Error, query failed'); //run the while loop that grabs all the news scripts while($r=mysql_fetch_array($result)) { $cat=$r["type"]; $magsset=$r["servicename"]; $query2 = "select * from subcategory WHERE cat=$cat"; $result2 = mysql_query($query2) or die('Error, query failed'); //run the while loop that grabs all the news scripts while($s=mysql_fetch_array($result2)) { $magsset=$r["servicename"]; $info=$r["subs"]; $fuls="$info<br /> <br />"; //$people = array($pics); //$trycount= count($people); $apples='<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="46">'.$magsset.'</td> </tr> <tr> <td height="47">'.$fuls.'</td> </tr> </table>'; echo $apples; } } ?> This will pull from both but when it does it, it supplies the servicename twice Like this Product1 sub1 Product1 sub2 Product1 sub3 I was just wondering if someone could help me make it just pull the service 1 and list all the subcats with out supplying the service on each one Like this Product1 sub1 sub2 sub3 Thanks for all your help.
  17. Is there any way of overwriting a file name if it exists. Basically i have a program which deletes a file name image3 or whatever, but i need to rename all images in the folder in line LIKE image1 image2 image3 image4 image5 but the files already exists. this is the error i get [function.rename]: File exists in C:\wamp\www\folder1\fin1_picedit.php on line 106
  18. i know how to pull a total count, but not to denote each query and echo. Still kinda new to php. Thanks for your response.
  19. So i wanting a code that will pull a certain query and then number each pull. The echo output would look like this. 1 row 2 row 3 row 4 row This would not be based on the id of the table. Just a count function that doesn't give just the total but denote each with a number.
  20. understandably Java and Javascript are two different things, HOWEVER they can both interact with each other. SO basically what i was trying to say, is that since most mobile phones nowadays have JAVA!!!!! you could develop an interface that would access a HTML SERVER (Where all your accessible files would be kept ) SO FORTH AND SO ON!!!
  21. JavaScript would be the way to go with this. Since just about all phones now days have java systems. You could develop a java interface to hit a html server with php as the side.
  22. <?php ///try this $string = str_replace('end',' '); //if you need to cut down more of the script try putting content after the end into a variable ///example $end='posted content'; $string1 = str_replace('$end',' '); $string = "test/another-test/here/$string1"; ?>
  23. To follow up on the answer provided by PFMaBiSmAd I have a php script that access's the ftp via ftp servername, username and password The scripts pulls the data by directory using the php function ftp_nlist. This script that i have is successful at connecting to the ftp server and displaying directory and files listed on the server. However there is no function for grabbing and downloading to a pc via browser header example: header('Content-Type: application/octet-stream'); There are functions for copy and write to local and remotes on the server but i was just wondering if any of you brilliant developers out there had a means of downloading via headers.
  24. By looking at your script the only means of display is to echo $fileHandle i see no way of putting the listed lines of city's into a variable.
×
×
  • 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.