sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
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>';
-
usr SELECT * FROM (SELECT * FROM table ORDER BY field DESC LIMIT 10) ORDER BY field ASC
-
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
-
<?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.";"; } } ?>
-
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; ?>
-
try <?php $text = 'blah\\blah'; echo preg_replace('/\\\\/','xxx', $text); ?>
-
are you try this <?php $text = '$my_array = array( \'key\' => "value", \'another_key\' => \'another_value\' );'; eval($text); print_r($my_array); ?>
-
2nd item from $my_array $keys = array_keys($my_array); echo $my_array[$keys[1]];
-
look http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_subtime
-
ups lines if ($count > 0) while ($count++ < 4) echo '<td> :</td>'; echo "</tr>"; echo "</table>"; shoud be if ($count > 0) while ($count++ < 4) {echo '<td> :</td>'; echo "</tr>";} echo "</table>"; add some {
-
use LIMIT 12 in your query
-
you can do all this job eith just one query $query = "UPDATE styles_template SET active = IF(form_name='$new_template',1,0)";
-
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> :</td>'; echo "</tr>"; echo "</table>"; } ?>
-
do not generate new $filename just use one gerenated befor
-
Selecting random records and holding for pagination
sasa replied to poleposters's topic in PHP Coding Help
you mast use seed with RAND() function and random array is same for same seed -
Problem with incrementing variables in a loop...
sasa replied to jaxdevil's topic in PHP Coding Help
change $rez = "$w".$i; to $rez = '$w'.$i; -
does number 5.00 has decimal?
-
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; ?>
-
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']));
-
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)";
-
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
-
$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'];
-
Copy Machine-Esque Collation of an Array - Not Your Mother's Collation
sasa replied to cobraroll98's topic in PHP Coding Help
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); ?> -
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; ?>
-
look http://www.metacafe.com/watch/375517/how_to_remotely_shutdown_other_pcs_on_the_network/