Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. you have extra space after & change echo '<a href="'.$_SERVER['PHP_SELF'].'?curPage='.($curPage+1).'& cat_id='.($row['cat_id']).'">Next ></a>'; to echo '<a href="'.$_SERVER['PHP_SELF'].'?curPage='.($curPage+1).'&cat_id='.($row['cat_id']).'">Next ></a>';
  2. usr SELECT * FROM (SELECT * FROM table ORDER BY field DESC LIMIT 10) ORDER BY field ASC
  3. change lines echo '<a href="'.$_SERVER['PHP_SELF'].'?curPage='.($curPage+1).'& cat_id='.($row['cat_id']).">> Next</a>'; to echo '<a href="'.$_SERVER['PHP_SELF'].'?curPage='.($curPage+1).'& cat_id='.($row['cat_id']).'>> Next</a>'; change last " to ' in lines 132 and 153
  4. <?php foreach ( $BuildArray as $Node => $Item ) { if (!$UnFinished) { $Element = $Item[0]; $Count = $Item[1]; $BuildTime = $Item[2]; //while (!$UnFinished ) { if ( $Count > 0 ) { $CurrentPlanet['b_hangar'] -= $BuildTime * $Count; $Builded[$Element] += $Count; $CurrentPlanet[$resource[$Element]] += $Count; $Count = 0; //if ($Count == 0) { // break; //} //} else { $UnFinished = true; //break; } //} } if ( $Count != 0 ) { $CurrentPlanet['b_hangar_id'] .= $Element.",".$Count.";"; } } ?>
  5. try <?php $test = Array ( 2=>'Inkognito', 6=>'TheKing', 9=>'Vister', 5=>'sasa', 1=>'Dummy', 'count'=>3 //is always there ); $edge = $test; unset($edge['count']); $edge = array_keys($edge); for ($i = 1; $i < count($edge); $i++){ $out .= "<fromID=".$edge[$i-1]." toID=".$edge[$i].">\n"; } echo $out; ?>
  6. try <?php $text = 'blah\\blah'; echo preg_replace('/\\\\/','xxx', $text); ?>
  7. are you try this <?php $text = '$my_array = array( \'key\' => "value", \'another_key\' => \'another_value\' );'; eval($text); print_r($my_array); ?>
  8. 2nd item from $my_array $keys = array_keys($my_array); echo $my_array[$keys[1]];
  9. look http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_subtime
  10. ups lines if ($count > 0) while ($count++ < 4) echo '<td>&nbsp:</td>'; echo "</tr>"; echo "</table>"; shoud be if ($count > 0) while ($count++ < 4) {echo '<td>&nbsp:</td>'; echo "</tr>";} echo "</table>"; add some {
  11. use LIMIT 12 in your query
  12. you can do all this job eith just one query $query = "UPDATE styles_template SET active = IF(form_name='$new_template',1,0)";
  13. try <?php $count = 0; $qry1="select * from product_table"; $result1 = mysql_query($qry1); if(mysql_num_rows($result1)>0) { echo "<table border=1>"; while($row1=mysql_fetch_array($result1)) { if ($count++ == 0) echo '<tr>'; echo "<td width=148>"; echo "<table border=1 bgcolor=#ffddee>"; echo "<tr>"; echo "<td width=125>" . "<img width=116 height=117 src='admin/uploads/" . $row1['image'] . "'/>" . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top width=125>". $row1['product_name'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top>". $row1['description'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top class=cut>". $row1['cutout_price'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top>". $row1['price'] . "</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; if ($count == 4){ $count = 0; echo '</tr>'; } } if ($count > 0) while ($count++ < 4) echo '<td>&nbsp:</td>'; echo "</tr>"; echo "</table>"; } ?>
  14. sasa

    Bad Logic.

    do not generate new $filename just use one gerenated befor
  15. you mast use seed with RAND() function and random array is same for same seed
  16. change $rez = "$w".$i; to $rez = '$w'.$i;
  17. does number 5.00 has decimal?
  18. try <?php $test = '<schedule> <employee name="Joe Smith"> <day date="10/13/2008"> <shift><descr>Sweeping</descr><starttime>7:45 AM</starttime><endtime>12:15 PM</endtime></shift> <shift><descr>Yodeling</descr><starttime>1:15 PM</starttime><endtime>6:00 PM</endtime></shift> </day> <day date="10/14/2008"> <shift><descr>Mopping</descr><starttime>7:45 AM</starttime><endtime>11:15 AM</endtime></shift> </day> </employee> <consultant name="Butternut McClintock"> <day date="10/13/2008"> <shift><descr>Cliff Diving</descr><starttime>7:45 AM</starttime><endtime>12:15 PM</endtime></shift> </day> <day date="10/14/2008"> <shift><descr>Chewing Food</descr><starttime>7:45 AM</starttime><endtime>11:15 AM</endtime></shift> <shift><descr>Crackin\' Wise</descr><starttime>1:15 PM</starttime><endtime>6:00 PM</endtime></shift> </day> </employee> </schedule>'; $patern = '|(\s*<day date="(.*?)">)(\s*<shift>.*?<starttime>)(.*?)(</starttime><endtime>)(.*?)(</endtime></shift>)|is'; $r = '$3$2 $4$5$2 $6$7 $1'; while (strpos($test, '<day')){ $test = preg_replace($patern, $r, $test); $test = preg_replace('|\s+<day[^>]*>\s+</day>|is', '', $test); } echo $test; ?>
  19. change line echo "<img src=\"./linegraph.php?v1=$checklist\">"; to echo "<img src=\"./linegraph.php?v1=".urlencode(serialize($checklist))."\">"; and in linegraph.php use $v1 = unserialize(urldecode($_GET['v1']));
  20. change line $feed="select * from feedback WHERE user_id=$userid and score=1 OR score=2"; to $feed="select * from feedback WHERE user_id=$userid and (score=1 OR score=2)";
  21. this line move internal pointer of mysql object to start in 1st loop script goes to the end of qyery object and if you want use it again you mast move to its start
  22. $wsxpl = "<?wsx version=\"1.0\"?>\r\n"; $wsxpl .= "<smil repeatCount=\"indefinite\">\r\n"; while ($count <= 120) { mysql_data_seek($content,0);// <-- insert this line while ($row = mysql_fetch_array($content)) { $exists[] = $row['slot'];
  23. try <?php $start =array(); array_push($start,array("ID" => 1, "Name" => Fish)); array_push($start,array("ID" => 2, "Name" => dog)); array_push($start,array("ID" => 5, "Name" => boat)); array_push($start,array("ID" => 4, "Name" => hat)); array_push($start,array("ID" => 3, "Name" => smurf)); array_push($start,array("ID" => 2, "Name" => toad)); array_push($start,array("ID" => 5, "Name" => princess)); //reorganize array $new_start = array(); foreach ($start as $elemen){ $new_start[$elemen['ID']][] = $elemen; } $out = array(); ksort($new_start); while (count($new_start) and $i++ <11){ foreach ($new_start as $id => $arr_elem){ array_push($out, array_shift($new_start[$id])); if (count($new_start[$id]) == 0) unset($new_start[$id]); } } print_r($out); ?>
  24. try <?php $a = 1234567; $a = "$a"; while ($a > 9) { $b = 0; for ($i = 0; $i < strlen($a); $i++) $b += $a[$i]; $a = "$b"; } echo $a; ?>
  25. look http://www.metacafe.com/watch/375517/how_to_remotely_shutdown_other_pcs_on_the_network/
×
×
  • 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.