Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. you can write string representation of array fwrite($textfile, serialize($array));
  2. try <?php $activetab=$_GET['countrytabs']; $atabname[0]='MY ADS'; $alink[0]='member/member.php?adminads=true&countrytabs=0'; $atabname[1]='ACCOUNT DETAILS'; $alink[1]='member/member.php?adminads=true&countrytabs=1'; $atabname[2]='TAGGED ADS'; $alink[2]='member/member.php?adminads=true&countrytabs=2'; foreach ($atabname as $key => $name){ if ($key != $activetab){ echo $name, ' - ', $alink[$key], "<br />\n"; } } ?>
  3. change variable name $result to $resul1 in this $sql = "INSERT INTO OFF_info(OFF_fname,OFF_lname,OFF_position,OFF_contact,BRGY_id,OFF_status)VALUES('$fname','$lname','$position','$contact','{$row['BRGY_id']}','$num')"; $result = mysql_query($sql) or die(mysql_error());
  4. try $insert_values .= "('". $_POST['course_date'.$key]."', '$id'), ";
  5. <?php echo '<p>Sort By:</p>'; $year = date("Y"); //get the current year $startDate = "1 january".$year; // set the end date to current year function printMonths($var) { $start = strtotime($var); //timestamp of the entered date $now = strtotime("Now"); //timestamp of now so it does not write anything in the future if (date('m', $now) % 2 == 0) $now = strtotime("-1 month", $now); while ($now > $start) //while the start is less than now { $now1 = strtotime("+1 month", $now); echo '<a href="news_archive.php?s=&id=' . get_id() . '&month=' . date("F", $now) .'">'.date("F", $now)."-".date("F", $now1).'</a>'; echo " | "; $now = strtotime("-2 month", $now); // subtract a month from the start timestamp } } printMonths($startDate); ?>
  6. in my local machine (php5) this code <?php $test = range(1, 50000); $test = array_merge($test, $test); echo count($test)," \n"; $t = array_unique($test); echo count($t); ?> output 100000 50000
  7. try <?php $query = "SELECT title, image, year, id, 'film' AS table1 FROM film UNION ALL SELECT name, img, id, occupation, 'people' AS table2 FROM people ORDER BY id DESC LIMIT 5 "; $result = mysql_query( $query ) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { extract($row); if ($result[table1] == 'film') { echo '<li><a href="filmography.php?title='.$title.'"><img src="images/thumbnails/'.$image.'.jpg" alt="" title="'.$title.' ('.$year.')"></a></li>'; } if ($result['table1'] == 'people') { echo '<li><a href="biography.php?name='.$title.'"><img src="images/thumbnails/'.$image.'.jpg" alt="" title="'.$title.' ('.$id.')"></a></li>'; }
  8. add ; to the end of line 8
  9. change Organization:."unserialize($row['organ']) to Organization:".implode(', ', unserialize($row['organ']))
  10. insert line $key = $field['payments'];[>/code]before 2nd loop
  11. you try to unserialize test_id which is number for 2nd error try to print_r($row);
  12. <?php $test = '<a href="http://www.mediafire.com/something">http://www.mediafire.com/something</a> text text text text text text text text text text text <a href="http://www.somelink.com"> text text text text text text text <a href="http://megaupload.com/something/blabla">Some link without WWW</a> text text text text text text text text text text text text text text <a title="somename" href="http://www.rapidshare.com/download" style="color:#000000" target="_blank">some confusing link</a> ...........more text here.......... <a href="http://www.microsoft.com"> ....more text........... <a href="http://www.4shared.com/download.php?file=myfile"><img src="a_link_with_an_image.gif"></a>'; $patern ='#(<a\s[^>]*href\="([^"]*(mediafire\.com|rapidshare\.com|megaupload\.com|4shared\.com)[^"]*)"[^>]*>).*?</a>#'; echo preg_replace($patern, '[DL]$1$2</a>[/DL]', $test); ?>
  13. try <?php function my_level($exp){ $levels = array(1 => 0, 83, 174, 276); $l = count($levels); while ($levels[$l] > $exp) $l--; return $l; } echo my_level(180); ?>
  14. change if ($row['BusinessCat'] != $lastcat) ; echo "<tr><td>" . $row['BusinessCat'] . " </td></tr>"; to if ($row['BusinessCat'] != $lastcat){ echo "<tr><td>" . $row['BusinessCat'] . " </td></tr>"; $lastCat= $row['BusinessCat'];} remove ; in if line
  15. SELECT a.statdef, COUNT(b.logid) as cnt FROM status AS a LEFT JOIN log AS b ON a.stat=b.stat GROUP BY b.stat
  16. <?php function nicetime($date){ if(empty($date)) return "No date provided"; $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); $lengths = array("60","60","24","7","4.35","12","10"); $now = time(); $unix_date = strtotime($date); if(empty($unix_date)) return "Bad date"; if($now > $unix_date) { $difference = $now - $unix_date; $tense = "ago"; } else { $difference = $unix_date - $now; $tense = "from now"; } $j = 0; $out = array(); while ($difference>0){ $x = $difference % $lengths[$j]; $difference = (int) $difference / $lengths[$j]; $s = $x > 1 ? 's' : ''; if ($x) $out[$periods[$j].$s] = $x; $j++; } $out = array_reverse($out); $out1 = ''; foreach ($out as $p => $v) $out1 .= " $v ($p)"; return "$out1 {$tense}"; } echo nicetime('3-11-2009 10:22:23'); ?>
  17. change line $eval = "test();"; to $eval = "return test();";
  18. in 1st loop you change 'TEST' and 'TEST2' in $_looparray['test_area.'] to 0 and $test2 in 2st loop you try to change 'TEST' and 'TEST2' in $_looparray['test_area.'] bat it's changed before
  19. try <?php $query="SELECT * FROM table ORDER BY `owner`'"; $myquery=mysql_query($query); $num=mysql_num_rows($myquery); $cur_name = ''; if(!empty($num)){ while($find=mysql_fetch_assoc($myquery)){ $stock = $find['stock']; $owner = $find['owner']; if ($cur_name != $owner){ $cur_name = $owner; echo "Record of stocks of $owner<br />\n"; echo "________________________________<br />\n"; } echo "Stock $stock<br />\n"; } } ?>
  20. change form to echo ' <tr> <td width="4%" bgcolor="#F7FAFD" class="blacktext"> <div align="center">'.$row['favid'].' <input name="favid" id="favid" type="radio" value="'.$row['favid'].'"> </div> </td> <td width="25%" bgcolor="#F7FAFD" class="blacktext">'.$pd['PartNum'].'</td> <td width="25%" bgcolor="#F7FAFD" class="blacktext">'.$pd['Name'].'</td> <td width="25%" bgcolor="#F7FAFD" class="blacktext">'.$finalsize['sizesname'].'</td> <td width="26%" bgcolor="#F7FAFD" class="blacktext"><input name="qty['.$row['favid'].']" type="text" class="tinyform" value ="'.$row['qty'].'" />'.$row['qty'].'</td> <td width="4%" bgcolor="#F7FAFD" class="blacktext"> <div align="center"> <input name="checked[]" id="checked" type="checkbox" value="'.$row['favid'].'"> </div> </td> and on next page do foreach ($_POST['qty'] as $favid => $qty){ ...
  21. can you post your form or print_r($_POST);
  22. change foreach (array_merge($_POST['qty'], $_POST['favids']) as $key => $value) { to foreach (array_combine($_POST['favids'] ,$_POST['qty']) as $key => $value) {
  23. remove @from begining and look the error
  24. in while loop you go to the end of $result resources when you change $d yoou must to reset $resource to begining
  25. insert mysql_data_seek($result,0); just before while loop
×
×
  • 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.