Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. try $countr = count($asset); $cost= 0; for($i=0;$i<=$countr;$i++) { $cost = $cost + ($pricelist[$asset[$i]['typeID']] * $asset[$i]['quantity']); } echo ("cost: $cost<br><br>"); print("end");
  2. use guery SELECT `Topics`.topic, `Articles`.title, Topics.topic_id FROM `Topics` LEFT JOIN `ARTICLES` ON Articles.topic_id=Topics.topic_id ORDER BY Topics.topic_id and <?php $result = mysql_query($query); $row = mysql_fetch_assoc($result); $id = $row['topic_id']; echo $rov['topic']. "<br />\n"; do { if ($id != $row['topic_id']) { $id = $row['topic_id']; echo $rov['topic']. "<br />\n"; } echo ' - '.$row['title']."<br />\n"; }while ($row = mysql_fetch_assoc($result)); echo "</table>\n"; ?>
  3. in listing.php change code <a href="listing.php?gid=Abstract_Experimental">Abstract / Experimental</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Acoustic">Acoustic</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Ambient_Chillout">Ambient / Chillout</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Big_Band_Swing">Big Band / Swing</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Dance_Disco">Dance / Disco</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Film_Game_Scores">Film / Game Scores</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Hip_Hop_Rap_Urban">Hip Hop / Rap / Urban</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Jazz">Jazz</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Pop">Pop</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Reggae">Reggae</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Rock">Rock</a> <img src="images/dot.jpg"><br><a href="listing.php?gid=Trip_Hop">Trip Hop</a> <img src="images/dot.jpg"><br> with <?php $menu = '<a href="listing.php?gid=Abstract_Experimental">Abstract / Experimental</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Acoustic">Acoustic</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Ambient_Chillout">Ambient / Chillout</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Big_Band_Swing">Big Band / Swing</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Dance_Disco">Dance / Disco</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Film_Game_Scores">Film / Game Scores</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Hip_Hop_Rap_Urban">Hip Hop / Rap / Urban</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Jazz">Jazz</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Pop">Pop</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Reggae">Reggae</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Rock">Rock</a> <img src="images/dot.jpg"><br> <a href="listing.php?gid=Trip_Hop">Trip Hop</a> <img src="images/dot.jpg"><br>'; if ($_GET['gid']) $menu = str_replace('?gid='.$_GET['gid'], '?gid='.$_GET['gid'].'" style="color:red;',$menu); echo $menu; ?>
  4. or <?php $result = mysql_query('SELECT * FROM table_name'); $row = mysql_fetch_assoc($result); echo '<table><tr><td>'.implode('</td><td>', array_keys($row))."</td></tr>\n"; do { echo '<tr><td>'.implode('</td><td>',$row)."</td></tr>\n"; }while ($row = mysql_fetch_assoc($result)); echo "</table>\n"; ?>
  5. can you post structure of your db table(s)
  6. remowe one ' after = after click link in variable $_GET['id'] is value of id
  7. can you print_r($available); to see what is in it
  8. try <?php function supertruncate($text, $word, $characters_before, $characters_after){ $pos = strpos($text, $word); $start = $characters_before < $pos ? $pos - $characters_before : 0; $len = $pos + strlen($word) + $characters_after - $start; return substr($text, $start, $len); } $text = "This is some tekst. It has some keyword like banana. I want to truncate this and just get a part of it."; $word = "banana"; $characters_before="18"; $characters_after="20"; echo supertruncate($text, $word, $characters_before, $characters_after); //Wanted result: "some keyword like banana. I want to truncate" ?>
  9. change "</tbody></table>\n"; } } // Now, determine the longest reign and most defenses rsort($longestR); rsort($sucessfulD); to "</tbody></table>\n"; } // Now, determine the longest reign and most defenses rsort($longestR); rsort($sucessfulD); }
  10. change echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'"; to echo "<a href='?id=".$row['id']."'>".$row['name']."</a>'";
  11. or try <?php $string = "word-----word word 1+++2000???"; echo preg_replace('/([^\w])\1+/','\1',$string); ?>
  12. try $result = mysql_query("SELECT * FROM User WHERE Username='$_SESSION[username]'");
  13. try <?php $ok = array(); array_push($ok, "value1"); while ($value=each($ok) and $i++ <9) { array_push($ok, "value2"); print $value[1]; } ?>
  14. try <?php $_GET['urls'] = 'page/2/country/3/'; $tmp = explode('/',trim($_GET['urls'],'/')); for ($i = 0; $i < count($tmp); $i++){ $$tmp[$i++] = $tmp[$i]; } echo $page, ' - ', $country; ?>
  15. change if(isset($_POST['addVideoGameId'])) { print_r($_POST); //this prints nothing } to if(isset($_POST['addVideoGame'])) { print_r($_POST); //this prints nothing }
  16. <?php foreach($this->calcul as $calcul) : // take result from sql //$test= array(array($this->escape($calcul->week))) $last_week = false; foreach ($test as $x){ if ($last_week){ for ($i = $last_week + 1; $i < $calcul->week; $i++){ echo "Week$i : 0<br />\n"; } } echo "Week".$this->escape($calcul->week)." : ".$this->escape($calcul->total)."<br />\n"; $last_week = $calcul->week; end foreach ?>
  17. for output you need two values one is number of week and 2nd is sum what is value of variable $calcul->week
  18. look this <?php $test = array(array('week' => 1, 'sum' => 3), array('week' => 3, 'sum' => 5)); $last_week = false; foreach ($test as $x){ if ($last_week){ for ($i = $last_week + 1; $i < $x['week']; $i++){ echo "Week$i : 0<br />\n"; } } echo "Week".$x['week']." : ".$x['sum']."<br />\n"; $last_week = $x['week']; } ?>
  19. try preg_match_all('/href=["\'](\/download\/[^"\']+)["\']/', $line, $matches); echo "<pre>"; var_dump($matches); echo "</pre>";
  20. change $desc to $count[1]
  21. change $size = $min_size + ($count - $minimum_count) to $size = $min_size + ($count[0] - $minimum_count)
×
×
  • 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.