Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. sorry 15 teams break my code here is fix <?php $teams = array('team1', 'team2', 'team3', 'team4', 'team5', 'team6', 'team7', 'team8', 'team9', 'team10', 'team11', 'team12', 'team13', 'team14', 'team15'); $c = count($teams); $h = ceil($c/2); $d = $c % 2; if($d) array_push ($teams, 'free'); $c = count($teams); $nl = "<br />\n"; for($i=1; $i<count($teams); $i++){ $teams = array_values($teams); echo "Week $i<hr />\n"; for($j=0; $j<$h; $j++) echo $teams[$j],' - ',$teams[$c -$j -1],$nl; $t1 = array_shift($teams); $t2 = array_shift($teams); array_push($teams, $t2); array_unshift($teams, $t1); echo "<br /><br />\n"; } ?>
  2. for me it output Week 1 team1 - team9 team2 - team10 team3 - team11 team4 - team12 team5 - team13 team6 - team14 team7 - team15 team8 free Week 2 team1 - team10 team3 - team11 team4 - team12 team5 - team13 team6 - team14 team7 - team15 team8 - team2 team9 free Week 3 team1 - team11 team4 - team12 team5 - team13 team6 - team14 team7 - team15 team8 - team2 team9 - team3 team10 free Week 4 team1 - team12 team5 - team13 team6 - team14 team7 - team15 team8 - team2 team9 - team3 team10 - team4 team11 free Week 5 team1 - team13 team6 - team14 team7 - team15 team8 - team2 team9 - team3 team10 - team4 team11 - team5 team12 free Week 6 team1 - team14 team7 - team15 team8 - team2 team9 - team3 team10 - team4 team11 - team5 team12 - team6 team13 free Week 7 team1 - team15 team8 - team2 team9 - team3 team10 - team4 team11 - team5 team12 - team6 team13 - team7 team14 free Week 8 team1 - team2 team9 - team3 team10 - team4 team11 - team5 team12 - team6 team13 - team7 team14 - team8 team15 free Week 9 team1 - team3 team10 - team4 team11 - team5 team12 - team6 team13 - team7 team14 - team8 team15 - team9 team2 free Week 10 team1 - team4 team11 - team5 team12 - team6 team13 - team7 team14 - team8 team15 - team9 team2 - team10 team3 free Week 11 team1 - team5 team12 - team6 team13 - team7 team14 - team8 team15 - team9 team2 - team10 team3 - team11 team4 free Week 12 team1 - team6 team13 - team7 team14 - team8 team15 - team9 team2 - team10 team3 - team11 team4 - team12 team5 free Week 13 team1 - team7 team14 - team8 team15 - team9 team2 - team10 team3 - team11 team4 - team12 team5 - team13 team6 free Week 14 team1 - team8 team15 - team9 team2 - team10 team3 - team11 team4 - team12 team5 - team13 team6 - team14 team7 free
  3. try $i = 0; $query = mysql_query("SELECT ALU_7705_Statuses.StatusID, ALU_7705_Statuses.SiteID, Sites.SiteName FROM ALU_7705_Statuses LEFT JOIN Sites ON ALU_7705_Statuses.SiteID = Sites.SiteID WHERE ALU_7705_Statuses.Market = '$_SESSION[AllowedMarket]' AND ALU_7705_Statuses.CompleteIncomplete = 'Incomplete'", $a_link); $resultcount = mysql_num_rows($query); while ($row = mysql_fetch_assoc($query)) { $StatusID = ""; $SiteName = ""; $DateTimeOfStatus = ""; $Status = ""; $Statusor = ""; $Notes = ""; $subquery = mysql_query("SELECT Status_Reports.TechID, Status_Reports.DateTimeOfStatus, Status_Reports.Status, Status_Reports.Notes, Users.FirstName, Users.LastName FROM Status_Reports LEFT JOIN Users ON Status_Reports.TechID = Users.UserID WHERE Status_Reports.StatusID = '$row[statusID]' ORDER BY StatusReportID DESC LIMIT 1", $a_link); while ($subrow = mysql_fetch_assoc($subquery)) { $StatusID = $row['StatusID']; $SiteName = $row['SiteName']; $DateTimeOfStatus = $subrow['DateTimeOfStatus']; $Status = $subrow['Status']; $Statusor = $subrow['FirstName'].' '.$subrow['LastName']; $Notes = $subrow['Notes']; echo ' <tr><td><a href="sitestatrep.php?StatusID='.$row["StatusID"].'">'.$row["SiteID"].'</a></td> <td>'.$row["SiteName"].'</td> <td>'.date("M j, Y g:i a", strtotime($subrow["DateTimeOfStatus"])).'</td> <td>'.$subrow["Status"].'</td> <td>'.$subrow["FirstName"].' '.$subrow["LastName"].'</td> <td>'.substr($subrow["Notes"], 0, 22).' ';if($subrow['Notes'] != ""){echo'...';}echo '</td> </tr>'; $resultsarray[$i]["StatusID"] = $StatusID; $resultsarray[$i]["SiteName"] = $SiteName; $resultsarray[$i]["DateTimeOfStatus"] = $DateTimeOfStatus; $resultsarray[$i]["Status"] = $Status; $resultsarray[$i]["Statusor"] = $Statusor; $resultsarray[$i]["Notes"] = $Notes; $i++ } }
  4. you can't pres more then one button in time try some other type of input tags
  5. look this code <?php $teams = array('team1', 'team2', 'team3', 'team4', 'team5', 'team6', 'team7', 'team8', 'team9', 'team10', 'team11', 'team12', 'team13', 'team14', 'team15'); $c = count($teams); $h = ceil($c/2); $d = $c % 2; $nl = "<br />\n"; for($i=1; $i<count($teams); $i++){ $teams = array_values($teams); echo "Week $i<hr />\n"; for($j=0; $j<$h-1; $j++) echo $teams[$j],' - ',$teams[$j + $h],$nl; if($d == 0) echo $teams[$j],' - ',$teams[$j + $h],$nl; else echo $teams[$j], " free", $nl; $t1 = array_shift($teams); $t2 = array_shift($teams); array_push($teams, $t2); array_unshift($teams, $t1); echo "<br /><br />\n"; } ?>
  6. change } else $out1[]=$data; to[/code]} else $out1[]=array_shift ($data);[/code]
  7. look manuaql http://php.net/manual/en/function.include.php http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen
  8. try <?php $test = range(1, 49); $target = 123; function my_comb($target, $num, $array){ $out = array(); if($num == 1) if(in_array($target, $array)) return array(array($target)); else return FALSE; $a = $num * ($num - 1) / 2; $b = min($target - $a, max($array)); $c = min(max($array)-$num+1,max($target-(max($array)*2-$num+2)*($num-1)/2,1)); if($b < $num) return FALSE; if($c>max($array)) return false; for($i = $c; $i<= $b;$i++){ if($c = my_comb($target-$i, $num-1, range(1,$i-1))){ foreach ($c as $d){ array_push($d, $i); $out[] = $d; } } } return $out; } $a = my_comb($target, 6, $test); //print_r($a); echo count($a); ?>
  9. you must escape single qoutes in your echoed string (line 93)
  10. i gues that in your directori is some video files (video1.avi, video2.avi, video3.avi and so on) add sam files with descriptions (video1.des, video2.des etc.) video1.des is file with html for description of video1.avi and thumbnail in descriptions.php use <?php $files = glob('*.avi'); foreach ($files as $file){ $file =explode('.', $file); $f_name = $file[0]; if(file_exists($f_name.'.des')){ echo "<a href='play_video?title=$f_name'><div class='description'>\n"; include($f_name.'.des'); echo "</div></a>\n"; } } ?>
  11. <?php $test = Array( '0' => Array( 'feed_id' => 3, 'tag' => 'adidas', 'user_id' => 1, 'full_name' => 'admin', 'comment' => 'Axa', 'date_posted' => '2011-02-11 14:30:31' ), '1' => Array( 'feed_id' => 3, 'tag' => 'Nike', 'user_id' => 1, 'full_name' => 'admin', 'comment' => '', 'date_posted' => '2011-02-11 14:30:31' ), '2' => Array( 'feed_id' => 6, 'tag' => 'Puma', 'user_id' => 1, 'full_name' => 'admin', 'comment' => '', 'date_posted' => '2011-02-11 14:30:31' ) ); $out = array(); foreach ($test as $data) $out[$data['feed_id']][] = $data; foreach ($out as $k => $data){ if(count($data)>1){ $tmp = array(); foreach ($data as $k1 => $data1){ foreach ($data1 as $key => $v)$tmp[$key][]=$v; } foreach ($tmp as $key => $v){ $v = array_unique($v); if(count($v)==1) $out1[$k][$key] = array_shift ($v); else $out1[$k][$key.'s']=array_values ($v); } } else $out1[]=$data; } $out1=array_values($out1); print_r($out1); ?>
  12. put each description on separet file and include it in descriptions page in videos page include just description for chosen title
  13. 1st what is type of your db field 2nd what do you try to do with your preg_replace
  14. you look for some value $max befor this value is start of line (^ in patern) or comma and space (, ) in paterrn after values is end of line ($) or comma (,) php function file() load file in array i'm, for testing, define array directly and setup value of $max manualy if you want to use your code you must trim row before explode it and separator in your file is NOT ',' it's ', ' (comma and space)
  15. try <?php $test = array('HA11QS, 200, house1.jpg, 4', 'HA22BR, 280, house2.jpg, 10', 'HA33AB, 390, house3.jpg, 3', 'HA44CD, 320, house4.jpg, '); $max = 4; $nf = 'Not found'; foreach($test as $row){ $row = trim($row); if(preg_match('/(^|, )'.$max.'($|,)/i', $row)){ $item_array = explode (",", $row); echo("Post Code - " . $item_array[0]. "<br>"); echo("Price - " . $item_array[1]. ",000 <br>"); echo("Picture - " . $item_array[2]. "<br>"); echo("Number of Visits - " . $item_array[3]. "<br>"); echo("<br>"); $nf = ''; } } echo $nf; ?> i use test array for your text file
  16. are you realy except that somebody read all your code pleas remove irelevant part use code tag btw look http://www.w3schools.com/tags/att_form_method.asp
  17. <?php $test = array( 0 => Array( '@attributes' => Array( 'YourId' => '1082-1', 'Name' => 'Woodwards Metals', 'Description' => '' ) ) ); foreach($test as $a)echo $a['@attributes']['Name'], "<br />\n"; ?>
  18. look mysql CAST() function
  19. change $query = "SELECT * FROM 'boox' WHERE isbn='$deleted'"; to $query = "SELECT * FROM `boox` WHERE isbn='$deleted'"; change ' to `
  20. change to preg_match('/\<color\i*=\042[0-9A-Za-z]+?\042\s*>/i', $M); add modifer i
  21. change to while($row = mysql_fetch_array( $result )) { $array2[] = $row['name']; } are you shure that want to compare id in first array with name from database
  22. try <?php $LName = $_POST['LastName']; $FName = $_POST['FirstName']; $db="db"; $link = mysql_connect('localhost', 'root', 'pw'); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error()); $query = "INSERT INTO records (IDNumber, FirstName, LastName) SELECT *, '$LName', '$FName' FROM ( SELECT # id CONCAT( # Sequential number, incremented, zero-padded LPAD((SUBSTR(COALESCE(MAX(IDNumber), '0'), 1, 4) + 1), 4, '0'), # Two-digit year DATE_FORMAT(CURRENT_DATE, '%y'), # Literal hyphen '-', # Two random letters (AA-ZZ) CHAR( FLOOR(65 + RAND() * 26), FLOOR(65 + RAND() * 26) ) ) FROM records WHERE IDNumber LIKE CONCAT('____', DATE_FORMAT(CURRENT_DATE, '%y'), '-__') ) as a "; mysql_query($query) or die('Error, insert query failed'); ?>
  23. sorry i change the field name from cat to category and forget to change name in primary key CREATE TABLE job_num ( category varchar(11) NOT NULL, id int(11) NOT NULL AUTO_INCREMENT, name varchar(22) NOT NULL, PRIMARY KEY (category,id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; and inser query is INSERT INTO job_num (category, name) VALUES ('A', 'some text'), ('A', 'some text'), ('B', 'some text'), ('A', 'some text')
  24. If you need separate consequtive numbers for each category organize your table in this way CREATE TABLE job_num ( category varchar(11) NOT NULL, id int(11) NOT NULL AUTO_INCREMENT, name varchar(22) NOT NULL, PRIMARY KEY (cat,id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; use combinated primary key
  25. <?php $test = Array ( 'u' => Array ( '0' => Array ( 'row_id' => '1', '0' => 'Jn', '1' => 'Bo', '2' => 'do', '3' => 'jilcom', '4' => 'hocom' ), '1' => Array ( 'row_id' => 3, '0' => 'Jk', '1' => 'Kk', '2' => 'wd', '3' => 'jk', '4' => '' ), '2' => Array ( 'row_id' => 5, '0' => 'Jn', '1' => 'Bo', '2' => 'on', '3' => 'jm', '4' => 'hm' ) ), 'blog' => Array ( '0' => Array ( 'row_id' => 3, '0' => 'dk', '1' => '', '2' => '', '3' => '', '4' => '', ), '1' => Array ( 'row_id' => 9, '0' => 'rs', '1' => 'dee', '2' => '', '3' => '', '4' => '', ) ) ); echo "<table border=3>\n"; foreach ($test as $key => $test1){ echo "<tr><td colspan=6>$key</td></tr>\n"; $start = true; foreach ($test1 as $key => $row){ if($start){ echo "<tr><td>". implode('</td><td>',array_keys($row)),"</td></tr>\n"; $start = false; } echo "<tr><td>". implode('</td><td>',$row),"</td></tr>\n"; } } ?>
×
×
  • 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.