sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
try SELECT * FROM `fragrances` WHERE sku IN(select sku from fragrances WHERE avail='true' GROUP BY sku HAVING COUNT(*) > 1) AND avail='true' ORDER BY sku
-
try <?php echo "<table>"; while($row = mysql_fetch_array($sql)){ $name = $row['name']; $a = $row['id']; echo "<tr><td><a href=browse.php?cat=" . $a . ">" . $name . "</a></td>"; for ($i = 1; $i<5; $i++){ $row = mysql_fetch_array($sql); if ($row){ $name = $row['name']; $a = $row['id']; }else { $name = ' '; $a = ' '; } echo "<td><a href=browse.php?cat=" . $a . ">" . $name . "</a></td>"; } echo "</tr>"; } echo '</table>'; ?>
-
try <?php function my_next($a, $car = '1234567890abcdefghijklmnopqrstuvwxyz'){ $num = strlen($car); $add = 1; $out = ''; for ($i = strlen($a); $i > 0;){ $x = strpos($car, $a[--$i]) + $add; $out = $car[$x % $num].$out; $add = floor($x / $num); } if ($add) $out = $car[0].$out; return $out; } $start = 'zx'; for ($i = 0; $i <20; $i++){ // or some other condition echo $start = my_next($start),"\n"; } // remember last $start and next time use it ?>
-
try <?php $a = 123.56; echo $b = sprintf('%+.2f', $a),"\n"; echo $c = sprintf('%+d', $a); ?>
-
change $query = "SELECT * FROM table LIMIT $limitvalue, $limit"; to $query = "SELECT * FROM `table` LIMIT $limitvalue, $limit";
-
ups try <?php function my_suffix($b){ if ($a<0) $a = -$b; else $a =$b; $s = array('th', 'st', 'nd', 'rd'); $su = $a % 10; if (((int)($a / 10)) % 10 == 1) $su = 0; if ($su > 3) $su = 0; return $s[$su]; } echo my_suffix(191); ?>
-
try <?php function my_suffix($b){ if ($a<0) $a = -$b; else $a =$b; $s = array('th', 'st', 'nd'); $su = $a % 10; if (((int)($a / 10)) % 10 == 1) $su = 0; if ($su > 2) $su = 0; return $s[$su]; } echo my_suffix(191); ?>
-
order is reserved Word try mysql_query("UPDATE type_size set `order`='".$order."' where id='".$id."'");
-
use just one query to pull data something like this SELECT shu_location.* FROM replenish_detail LEFT JOIN sku_location ON sku_location.sku=replenish_detail.sku AND sku_location.qty>0 LIMIT...
-
try //$next = $id+1; remove this line $sql3 = mysql_query("SELECT * FROM images WHERE id>'$id' ORDER BY id ASC LIMIT 1"); $row3 = mysql_fetch_array($sql3); etc. }
-
try <?php $t = time(); $t = floor($t/600)*600; for ($i = 0; $i < 24 * 6; $i++){ echo date('H:i', $t - $i * 600), "\n"; } ?>
-
look function round()
-
try to change if($w> $h) { to if($wm> $hm) { and so on
-
use ... ORDER BY shout/letters
-
try <?php // change $mnt from 1 to 12 for ($mnt = 1; $mnt <= 12; $mnt++){ $result = mysql_query("select show_id, month, day1, day2, year, location, details, venue from $database_table where month = '$mnt' order by year, month, day2",$db) or die_now("<h2>Could not select shows</h2>"); echo("<table class='guide'>\n"); echo("\t<tr>\n\t\t<td width='80'>date</td>\n\t\t<td width='140'>venue</td>\n\t\t<td width='100'>location</td>\n\t\t<td width='200'>details</td>\n\t</tr>\n"); echo("</table>\n"); echo("<table class='guide'>\n"); echo("\t<tr>\n\t\t<td width='80'>".date('F', mktime(1,1,1,$mnt,1,2000))."</td>\n\t</tr>\n"); echo("</table>\n"); while($row = mysql_fetch_array($result)){ $the_id = $row["show_id"]; $the_month = $row["month"]; $the_day1 = $row["day1"]; $the_day2 = $row["day2"]; $the_year = $row["year"]; $the_location = $row["location"]; $the_details = $row["details"]; $the_venue = $row["venue"]; // shows echo("<table class='guide'>\n"); echo("\t<tr>\n\t\t<td width='80'>$the_day1" . " - " . "$the_day2" . "/" . "$the_month" . "</td>\n"); echo("\t\t<td width='140'>" . "$the_venue" . "</td>\n"); echo("\t\t<td width='100'>" . "$the_location" . "</td>\n"); echo("\t\t<td width='200'>" . "$the_details" . "</td>\n"); echo("\t</tr>\n</table>\n"); } // select February shows in the database $result = mysql_query("select show_id, month, day1, day2, year, location, details, venue from $database_table where month = '2' order by year, month, day2",$db) or die_now("<h2>Could not select shows</h2>"); echo("<table class='guide'>\n"); echo("\t<tr>\n\t\t<td width='80'>February</td>\n\t</tr>\n"); echo("</table>\n"); while($row = mysql_fetch_array($result)){ $the_id = $row["show_id"]; $the_month = $row["month"]; $the_day1 = $row["day1"]; $the_day2 = $row["day2"]; $the_year = $row["year"]; $the_location = $row["location"]; $the_details = $row["details"]; $the_venue = $row["venue"]; // shows echo("<table class='guide'>\n"); echo("\t<tr>\n\t\t<td width='80'>$the_day1" . " - " . "$the_day2" . "/" . "$the_month" . "</td>\n"); echo("\t\t<td width='140'>" . "$the_venue" . "</td>\n"); echo("\t\t<td width='100'>" . "$the_location" . "</td>\n"); echo("\t\t<td width='200'>" . "$the_details" . "</td>\n"); echo("\t</tr>\n</table>\n"); } } ?>
-
$percent = (($shout/$letters)*100);
-
$i = $CurrentPage > 3 ? $CurrentPage - 3 : 1; means if($CurrentPage > 3) $i = $CurrentPage - 3; else $i = 1;
-
TRY For($i = $CurrentPage > 3 ? $CurrentPage - 3 : 1; $i <= ($CurrentPage + 3 < $TotalNumberOfPages ? $CurrentPage + 3 : $TotalNumberOfPages) ; $i++)
-
try for($i=1;$i<=5;$i++) { echo $_POST["something_$i"]; }
-
try echo '<input type="Button" value="View Proof" onclick="href=\'temp/'.$myflnm.'.pdf\'">';
-
try <?php while($row = mysql_fetch_array( $result )) { echo "<tr><td>"; echo $row['Name'] ? $row['Name'] : ' '; echo "</td><td>"; echo $row['Class'] ? $row['Class'] : ' '; echo "</td><td>"; echo $row['Grade'] ? $row['Grade'] : ' '; echo "</td><td>"; echo $row['Comments'] ? $row['Comments'] : ' '; echo "</td><td>"; echo $row['Pic'] ? $row['Pic'] : ' '; echo "</td></tr>"; } ?>
-
try /* Performing SQL query */ $query = "SELECT * FROM Address "; $first_one = 1; if($lastname != "") { if($first_one == 1) { $query = "$query WHERE"; $first_one = 0; $query = "$query lastname LIKE '%$lastname%'"; } else { $query = "$query AND lastname LIKE '%$lastname%'"; } } if($address != "") { if($first_one == 1) { $query = "$query WHERE"; $first_one = 0; $query = "$query address LIKE '%$address%'"; } else { $query = "$query AND address LIKE '%$address%'"; } } if($city != "") { if($first_one == 1) { $query = "$query WHERE"; $first_one = 0; $query = "$query city LIKE '%$city%'"; } else { $query = "$query AND city LIKE '%$city%'"; } } if($zipcode != "") { if($first_one == 1) { $query = "$query WHERE"; $first_one = 0; $query = "$query zipcode LIKE '%$zipcode%'"; } else { $query = "$query AND zipcode LIKE '%$zipcode%'"; } } if($territory != "") { if($first_one == 1) { $query = "$query WHERE"; $first_one = 0; $query = "$query territory = '$territory'"; } else { $query = "$query AND territory = '$territory'"; } } $query .= 'ORDER BY address'; $result = mysql_query($query) or die("Query failed"); /* Printing results in HTML */ $numresult = mysql_num_rows($result); print "<h4 align=center><font color=#3C94C4>"; print $numresult; print " results match your search<h4></font>\n"; print "<table cellpadding=6 border=0 align=center>\n"; print "\t<tr align=left bgcolor=#CCCCCC>\n\t\t<td width=30><strong>ID</strong></td>\n\t\t<td width=125><strong>Last Name</strong></td>\n\t\t<td width=125><strong>First Name</strong></td>\n"; print "\t\t<td width=175><strong>Address</strong></td>\n\t\t<td width=125><strong>City</strong></td>\n"; print "\t\t<td width=75><strong>Territory</strong><td width=40><strong>Delete</strong></td></tr>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { </script> <tr align="left"> <td><font size="1"><?php print "<a href='../address_edit.php?idx="; print $line["address_id"]; print "'target=_new>"; print $line["address_id"]; print "</a>";?></font></td> <td><font size="1"><?php echo $line["lastname"]; ?></font></td> <td><font size="1"><?php echo $line["firstname"]; ?></font></td> <td><font size="1"><?php echo $line["address"]; ?></font></td> <td><font size="1"><?php echo $line["city"]; ?></font></td> <td><font size="1"><?php echo $line["territory"]; ?></font></td> <td><font size=1><?php print "<a href='../delete_address.php?idx="; print $line["address_id"]; print "'target=_blank>"; print "<img src=../images/trash_icon.jpg border=0 alt='Delete Address' /img>"; print "</a></font></td>"; ?> </tr> <?php } print "</table>\n";