Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Everything posted by phpretard

  1. If they need help there are some great forums out there
  2. Well that solved it. but i don't see a "solved" option THANK YOU!
  3. I need to echo the "reward.id" $sql = "select reward.id, reward.location, reward.industry, reward.title, reward.stamp, industry.id, industry.label, industry.location FROM reward LEFT JOIN industry ON industry.id = reward.industry where (industry.label = '".$_GET['ind']."' and industry.location = '".$_GET['loc']."')"; $result = mysql_query($sql) or die(mysql_error()); while($info = mysql_fetch_assoc($result)){ echo $info['HOW TO I PRINT reward.id']; }free($result ); Any thoughts?
  4. To be able to edit a particular page one of the comma separated numbers stored in your row must match the page number you may be trying to edit. The check boxes are for the primary site admin to populate / edit / update the different users rows. I could store the numbers in sessions but the session values still have to be populated somehow. [attachment deleted by admin]
  5. Unfortunately I usually do make it too difficult. I have to compare arrays because with the checkboxes as displayed as they are how else will I know which ones to take away from permissions or add? Can you send me refer me to a site regarding relational DB's. Here is the hacked up code that makes it work properly (for now). if(isset($_POST['save'])){ $existforthis = $_POST['existforthis']; $existforthis_array = explode(",", $existforthis); $impnewpages = $_POST['page']; // This is an array $expexisting = explode(",", $_POST['existing']); $permissionsremoved = array(); foreach ($expexisting as $EXPSR){ if (!in_array($EXPSR, $existforthis_array)) { $permissionsremoved[] = $EXPSR; } } if(empty($_POST['page'])){ // do nothing }else{ $permissionskept = array(); foreach ($expexisting as $EXPSK){ if (in_array($EXPSK, $impnewpages)) { $permissionskept[] = $EXPSK; } } } if(empty($_POST['page'])){ $combinedPs = $permissionsremoved; }else{ $combinedPs = array_merge($permissionsremoved, $impnewpages); } connect(); $newaccess = implode(",",$combinedPs); $sql = "update access set pid='$newaccess' where pw = '".$_POST['access']."'"; $update = mysql_unbuffered_query($sql) or die(mysql_error()); }// close if submitted
  6. So it works to a point. I cant figure which value(s) to use when updating...when. Here is my elaboration: I am basically updating the same row for one user (will be multiple eventually). This user will have access to certain pages where in this case the pages are numbered. The numbers are stored (comma separated) in a mysql text field. I call the data base for the numbers and explode them into check boxes with the value (of the check box) being the page number. Then it is determined whether or not the box should be checked or not checked. This code is working assuming there are comma separated numbers in the aforementioned text field. Updating the text field is where the problem starts. I would like to simply delete and update BUT because each page display a different range of numbers / check boxes this proposes the problem. I have gotten the code far enough along so that I can actually update the field however storing the information on the page and comparing it on submission is difficult I read the code and understand it about 85% could you maybe elaborate? if(empty($_POST['page'])){$array1 = array();}else{$array1 = $_POST['page'];} $array2 = $_POST['page_array']; $array3 = explode(",", $_POST['existing']); foreach($array1 as $v) { if(in_array($v, $array2)) { $findIt = array_search($v, $array2); unset($array2[$findIt]); } if(in_array($v, $array3)) { $findIt = array_search($v, $array3); unset($array3[$findIt]); }else{ $array3[] = $v; } } if(empty($array3)){/*do nothing to avoid implode errors*/}else{$newaccess = implode(",",$array1);} connect(); $sql = "update access set pid='$newaccess' where pw = '".$_POST['access']."'"; $update = mysql_unbuffered_query($sql) or die(mysql_error());
  7. Why do you make it look so easy??? Thank you!
  8. Yes and so far: if(empty($_POST['page'])){ // if no checkboxes are submitted $array1 = array(); $array3 = array(); $newaccess = ""; }else{ // begin problem $array1 = $_POST['page']; //OK $array2 = $_POST['page_array']; //OK $array3 = explode(",", $_POST['existing']); //OK $array4 = array_diff($array2,$array1); //HMM $newaccess = implode(",",$array4); // AH SH@@#$# } So ... if $array4 has a value then I need to add or delete it from $array3
  9. What I need is to: - take the information from array 1 - remove it from array 2 - then ADD it OR take from array 3 (this of course depends on array 1) I also have to keep in mind that array 1 could be empty thus needing to empty array 2 and IF the information is in array 3 then remove it array 3 is the main array that I will update the database row which will in turn display the correct check boxes checked or not Thank you for reading, I hope you can help me. Array //#1 this is the submitted information ( [0] => 103100000 [1] => 103200000 [2] => 103400000 [3] => 103500000 [4] => 103700000 ) Array //#2 all possible choices ( [0] => 103100000 [1] => 103200000 [2] => 103300000 [3] => 103400000 [4] => 103500000 [5] => 103600000 [6] => 103700000 ) Array //#3 currently stored in database / marks the check boxes "checked" ( [0] => 103100000 [1] => 103200000 [2] => 103300000 [3] => 103400000 [4] => 103500000 [5] => 103600000 [6] => 103700000 ) [attachment deleted by admin]
  10. This worked: $infosplit=explode("\n", $information); $array=array(); for($i=0; $i<count($infosplit); $i++) { $infosplit[$i]=trim($infosplit[$i]); if(!empty($infosplit[$i])) { $temp=explode("-", $infosplit[$i]); $temp_array=array(0=>$temp[0],1=>null,2=>null,3=>null,4=>$temp[(count($temp)-1)]); for($a=1; $a<(count($temp)-1); $a++) { $temp_array[$a]=$temp[$a]; } $array[]=$temp_array; } } print_r($array); ?>
  11. I will try that for sure... Will that be good enough to insert into? inset into table (0,1) values([0], [1], ect...) I need that in some find of foreach loop I only have a page of this...how can I grab these separately? 105-Athletics <<-- separate and explode 105-1-Eagle Sports <<-- separate and explode 105-2-Programs <<-- separate and explode 105-2-1-Boys <<-- separate and explode 105-2-1-1-Football <<-- separate and explode 105-2-1-2-Cross Country <<-- separate and explode 105-2-1-3-Golf <<-- separate and explode and so on... I am ultimately trying to echo this (without the $_GET['pg']): <li><a class="active" href="athletics.php#nfc">Athletics</a> <ul class="sub_menu"> <li><a href="page.php?pg=55#nfc">Eagle Sports</a></li> <li><a href="page.php?pg=56#nfc">Programs</a> <ul class="sub_menu"> <li><a href="page.php?pg=57#nfc">Boys</a> <ul class="sub_menu"> <li><a href="page.php?pg=58#nfc">Football</a></li> <li><a href="page.php?pg=59#nfc">Cross Country</a></li> <li><a href="page.php?pg=60#nfc">Golf</a></li> <li><a href="page.php?pg=61#nfc">Basketball</a></li> <li><a href="page.php?pg=62#nfc">Baseball</a></li> <li><a href="page.php?pg=63#nfc">Track</a></li> <li><a href="page.php?pg=64#nfc">Tennis</a></li> </ul> </li> <li><a href="page.php?pg=65#nfc">Girls</a> <ul class="sub_menu"> <li><a href="page.php?pg=66#nfc">Volleyball</a></li> <li><a href="page.php?pg=67#nfc">Golf</a></li> <li><a href="page.php?pg=68#nfc">Cheerleading</a></li> <li><a href="page.php?pg=69#nfc">Basketball</a></li> <li><a href="page.php?pg=70#nfc">Softball</a></li> <li><a href="page.php?pg=71#nfc">Track</a></li> <li><a href="page.php?pg=72#nfc">Tennis</a></li> </ul> </li> </ul> </li> <li><a href="page.php?pg=73#nfc">Coaches</a></li> <li><a href="page.php?pg=74#nfc">FHSAA</a></li> <li><a href="page.php?pg=75#nfc">Game Directions</a></li> </ul> </li>
  12. I am trying to separate this information by the "-" symbol so that I can insert it. This output would be ideal. Any help today? 105-2-2-3-Cheerleading $value[0] should = 105 $value[1] should= 2 $value[2] should= 2 $value[3] should= 3 $value[4] should= Cheerleading I have tried many approaches and come up with notta 105-Athletics 105-1-Eagle Sports 105-2-Programs 105-2-1-Boys 105-2-1-1-Football 105-2-1-2-Cross Country 105-2-1-3-Golf 105-2-1-4-Basketball 105-2-1-5-Baseball 105-2-1-6-Track 105-2-1-7-Tennis 105-2-2-Girls 105-2-2-1-Volleyball 105-2-2-2-Golf 105-2-2-3-Cheerleading 105-2-2-4-Basketball 105-2-2-5-Softball 105-2-2-6-Track 105-2-2-7-Tennis 105-3-Coaches 105-4-FHSAA 105-5-Game Directions Thank you for looking.
  13. <?php $year = date('Y'); if ($handle = opendir("results/$year/Boys")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<li><a href=\"javascript:void(0)\">$file</a> <ul> "; if ($handle2 = opendir("results/$year/Boys/$file")) { while (false !== ($file2 = readdir($handle2))) { if ($file2 != "." && $file2 != "..") { echo "<li><a href=\"javascript:void(0)\">$file2</a>"; } } } echo "</ul></li>"; } }closedir($handle);closedir($handle2); } ?>
  14. I am using 2 because I first need to get the set of folders to build the first menu then go into the folder and display the files as the sub menu. Does the code below clarify the question? <?php if ($handle = opendir("results/$year/Girls")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<li><a target=\"_blank\" href=\"javascript:void(0)\">$file</a> <ul> <li><a href=\"#\">NEED FILE 1 FROM FOLDER $file</a></li> <li><a href=\"#\">NEED FILE 2 FROM FOLDER $file</a></li> <li><a href=\"#\">NEED FILE 3 FROM FOLDER $file</a></li> <li><a href=\"#\">NEED FILE 4 FROM FOLDER $file</a></li> </ul> </li>"; } }closedir($handle); } ?>
  15. I almost have it but can't figure why the code below only shows one file per folder. I think it is showing the last file. I need $ul somehow looping to show all the files in $file. <?php $year = date('Y'); if ($handle = opendir("results/$year/Boys")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if ($handle2 = opendir("results/$year/Boys/$file")) { while (false !== ($file2 = readdir($handle2))) { if ($file2 != "." && $file2 != "..") { $ul = "<li><a href=\"#\">$file2</a></li>"; $li = "<li><a target=\"_blank\" href=\"javascript:void(0)\">$file</a> <ul> $ul </ul> </li>"; } // close if file2 }echo $li; } } } }closedir($handle);closedir($handle2); ?>
  16. My DB is holding time as "11:00 AM" "10:00 AM" ect... Is there a way to convert these to time() after I have queried the DB for results? <?php connect(); $query = "SELECT * FROM party WHERE year(DOP) = '2011' order by PTIMES asc"; $qt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($qt)){ echo " <tr height='30'> <td id='label'>".$nt['NOC']."</td> <td id='labeloff'>".$nt['CFN']." ".$nt['CLN']."</td> <td id='labeloff'>".$nt['type']."</td> <td id='label'>".birthday($nt['DOB'])."</td> <td id='label'>$DOP</td> <td id='labeloff'>".$nt['PTIME']."</td> <td id='labeloff'>".$nt['act1']."</td> <td id='labeloff'>".$nt['act2']."</td> <td id='label'>".$nt['pizza']."</td> <td id='label'>".$nt['fc']."</td> </tr> "; }free($qt); ?> Thank you.
  17. I though this might help explain -- Image Attached I was able to shorten the function as well: function taken($theType, $theTime){ connect(); $sql = "select * from party where DOP = '$day_view' and type = '$theType' and PTIME = '$theTime' and confirmed !='' "; $result = mysql_query($sql) or die(mysql_error()); $day_count = mysql_num_rows($result); while($info = mysql_fetch_assoc($result)){ echo "<a href='party_booked.php?view=".$info['confirmed']."'>RESERVED</a>"; }free($result); } [attachment deleted by admin]
  18. I think a switch break will help in this situation but I am definitely open to suggestions The problem I am have is that if there are 2 "Funner" or "Funnest" in the database then it displays duplicates in the in the column. I know that is what the code is telling it to do. If you look at the first row it should split them if there are 2 and display one in each column. In one time slot there is only allowed: - 1 Fun - 1 Funner or Funnest - 1 Funner or Funnest The case I am working with is there is 1 Fun and 2 Funners. The 2 Funners should split and display one in each "Funner/Funnest" column. There are planty of unique identifiers if someone has an idea for me. function taken($theType, $theTime){ $day_view = $_GET['date']; $DOP = explode("-", $_GET['date']); $topDOP = date("M", mktime(0, 0, 0, $DOP['1']))." ".$DOP['2'].", ".$DOP['0']; $dayDOP = date("l", mktime(0, 0, 0, $DOP[1], $DOP[2], $DOP[0])); connect(); $sql = "select * from party_times where dates = '$day_view' and paidID ='paid' and times = '$theTime'"; $result = mysql_query($sql) or die(mysql_error()); $day_count = mysql_num_rows($result); while($info = mysql_fetch_assoc($result)){ if($info['type'] == "$theType" && $info['times'] == "$theTime"){ $conID = "select DISTINCT confirmID from party_receipt where partyID = '".$info['partyID']."'"; $conqu = mysql_query($conID) or die(mysql_error()); while($con = mysql_fetch_assoc($conqu)){ $cid = $con['confirmID']; echo "<a href='party_booked.php?view=$cid'>RESERVED</a>"; }free($conqu); } }free($result); } Call the function: <tr> <td width="25%"></td> <td width="25%" align="center">Fun</td> <td width="25%" align="center">Funner / Funnest</td> <td width="25%" align="center">Funner / Funnest</td> </tr> <tr> <td>11:00 AM</td> <td class = "res"><?php taken("Fun", "11:00 AM"); ?></td> <td class = "res"><?php taken("Funner", "11:00 AM"); ?></td> <td class = "res"><?php taken("Funnest", "11:00 AM"); ?></td> </tr> Thank you!
  19. I have a form that you can add email boxes and recipients to. when you add the boxes it actually submits. I did it this way to change the session that determines how many boxes you get. The problem is if I (as a web user) have entered X number of emails and recipients then submit to add another set of text fields then how can I keep the 3 already entered populated? <?php $start = $_SESSION['NOCStart']; $stop = $_SESSION['NOCStop']; for($m = $start; $m < $stop; $m++){ echo " <tr> <td>$m: <input id='text' type='text' name='invEmail[]' value='WHATS GOES HERE??' /></td> <td><input id='text' type='text' name='invName[]' value='WHATS GOES HERE??' /></td> </tr> "; } ?> The submitted info is captured with the following code: For testing it simply outputs the info... if (isset($_SESSION['NOC']) && $current_page == "invitations.php"){ if(isset($_POST['addemail'])){ $impEmail = implode(",", $_POST['invEmail']); $expEmail = explode(",", $impEmail); $impName = implode(",", $_POST['invName']); $expName = explode(",", $impName); $sendit = array_combine($expEmail, $expName); foreach ($sendit as $key => $value) { echo "$key belongs to $value<br />\n"; } if ($_SESSION['NOCStop'] == $_SESSION['NOC'] + 1){ $message = "<script>alert('Max Emails Reached')</script>"; }else{ $_SESSION['NOCStart'] = 1; $_SESSION['NOCStop'] = $_SESSION['NOCStop'] + 1; } }else{ $stopper = $_SESSION['NOC'] * .5; $rounder = round($stopper) + 1; $_SESSION['NOCStart'] = 1; $_SESSION['NOCStop'] = $rounder; } } Thank you for your help!
  20. I don't get it...every other day but Sunday is shows up correct? $VDOP = "2011-12-04"; $exp = explode("-", $VDOP); echo "$VDOP is on a " .date("l", mktime(0, 0, 0, $exp[2], $exp[1], $exp[0])); Any thoughts on this (besides Jesus doesn't like PHP ).
  21. $Half = $GrandTotal * .5; $Deposit = round($Half, 2); This works. Thank you all!
  22. The deposit is half of the $GrandTotal. Where should I do that math?
  23. What could I be doing wrong then? // do some math $PZTotal = "17.97"; $FCTotal = "56.97"; $CHTotal = "65.7"; $GrandTotal = $PZTotal + $FCTotal + $CHTotal; $Deposit = round($GrandTotal , 2) * .5; [attachment deleted by admin]
×
×
  • 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.