Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. $new_array = implode("','", $array); and WHERE P.id NOT IN ('$new_array') AND .....ect;
  2. try <?php // conect to db $result = mysql_query('SELECT * FROM table-name ORDER BY username'); $row = mysql_fetch_array($result); echo $row['username'],'<br />'; $name = $row['username']; do{ if($row['username'] != $name){ echo $row['username'],'<br />'; $name = $row['username']; } echo $row['messages'],'<br />'; } while ($row = mysql_fetch_array($result)) ?>
  3. try <?php ... $i=1; echo "<table border='0' ALIGN='center' cellpadding='5' cellspacing='0'>"; while($row = mysql_fetch_array($result)){ $itemnumber = $row['itemnumber']; $name = $row['name']; $image = $row['image']; echo "<tr>"; echo "<td><a href='http://autolpg.com.au/oldworld/item.php?itemnumber=$itemnumber'><img src='$image' alt='$name' width='200' height='170'></a> <form action='item.php' method='post' width='200'> <input type='hidden' name='itemnumber' value='$itemnumber'> <input type='submit' VALUE='click here for more details' class=namesbtn> </form> row count is $i</td>"; for ($i = 1; $i < 3; $i++){ $row = mysql_fetch_array($result); if ($row){ $itemnumber = $row['itemnumber']; $name = $row['name']; $image = $row['image']; echo "<td><a href='http://autolpg.com.au/oldworld/item.php?itemnumber=$itemnumber'><img src='$image' alt='$name' width='200' height='170'></a> <form action='item.php' method='post' width='200'> <input type='hidden' name='itemnumber' value='$itemnumber'> <input type='submit' VALUE='click here for more details' class=namesbtn> </form> row count is $i</td>"; } else echo '<td> </td>'; } echo "</tr>"; } echo "</table>"; ?> </body> </html>
  4. try <?php $input = "-----MMMMM------IIIII----MMM---OOOO---I---MMMM-----"; $trash_char = '-'; $results = array(); //$current_char = false; //$a_index = 0; for( $i =0; $i < strlen($input){ if ($input[$i] != $trash_char){ $char = $input[$i]; $start = $i + 1; while ($input[$i] == $char) $i++; $end = $i > $start ? '-'.$i : ''; $results[] = $start.$end.':'.$char; } else $i++; } print_r($results); ?>
  5. try <?php function compare_len($a, $b){ return strlen($b)-strlen($a); } $arr = array('a','aaa','aa','bbb'); usort($arr, 'compare_len'); print_r($arr); ?>
  6. change order of if statemans 1st check is biger the 100 If ($number > 100) { /* "if" $number is greater than $cpu_number do the following: */ echo "Please enter a number between 0 and 100"; } elseif ($number > $cpu_number) { echo "Your Number Is Bigger! CPU's number is $cpu_number"; }
  7. try <?php class a{ } class b{ } $x = new b; if ($x instanceof a) echo 'is a'; else echo 'it is not a'; ?>
  8. pull all data with one query $query_all=$db->execute("select players.*, Jobs.Pay from `players` LEFT JOIN Jobs ON players.Players_Job_ID=Jobs.Job_ID");
  9. SELECT maingame, COUNT(ID) as count FROM Members GROUP BY maingame ORDER BY maingame
  10. can you post your SQL statement
  11. sory i just copy 1st query and miss to change * in field name $sql3 = mysql_query("SELECT * FROM dregusers WHERE drid IN (SELECT drid FROM downer WHERE lid = '$lgs') GROUP BY uid");
  12. use one query SELECT * FROM dregusers WHERE drid IN (SELECT * FROM downer WHERE lid = '$lgs') GROUP BY uid
  13. try $result = mysql_query("SELECT * FROM ufm_form_data") or die(mysql_error()); // store the record of the "ufm_form_data" table into $row $current = ''; //echo "<table border='1' width='800'>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { $id = $row['id']; if (!$current) { echo "<table border='1' width='800'>"; $current = $id; } elseif ($current != $id){ echo "</table><table border='1' width='800'>"; $current = $id; } // Print out the contents of each row into a table echo "<tr><th>Company</th><td> {$row['company']}</td><tr>"; echo "<tr><th>FirstName</th><td> {$row['firstName']}</td><tr>"; echo "<tr><th>LastName</th><td> {$row['lastName']}</td><tr>"; echo "<tr><th>Email</th><td> {$row['email']}</td><tr>"; echo "<tr><th>Address</th><td> {$row['address1']}</td><tr>"; echo "<tr><th>City</th><td> {$row['city']}</td><tr>"; echo "<tr><th>State</th><td> {$row['state']}</td><tr>"; echo "<tr><th>Zip Code</th><td> {$row['postalCode']}</td><tr>"; echo "<tr><th>Phone</th><td> {$row['phone']}</td><tr>"; echo "<tr><th>Info</th><td> {$row['info']}</td><tr>"; echo "<tr><th>Quote</th><td> {$row['quote']}</td><tr>"; echo "<tr><th>Comments</th><td> {$row['comments']}</td><tr>"; } echo "</table>";
  14. are you lookig for strrpos() function
  15. try <?php function remove_final($url){ $u = explode('/', $url); $c = count($u) - 1; if ($u[$c] == ''){ unset($u[$c]); $c--; } unset($u[$c]); return implode('/', $u); } echo remove_final('c:/a/b/c/d/'); ?>
  16. try $username= get_username($_SESSION['user_id']);
  17. change echo "<td align=center>$row[itemDes]</td>\n"; to echo "<td align=center><a href='link_to_diferent_page'>$row[itemDes]</a></td>\n";
  18. <form name="frmCurrencyType" method="post"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td> <?php $select_currency = "SELECT ncurrency_id,vcurrency_name FROM ".$tableprefix."currency_master WHERE vactive = 'Y'"; $result_currency = mysql_query($select_currency) or die(mysql_error()); while($currency_row = mysql_fetch_array($result_currency)){ if($_SESSION['SESS_currency_type'] == $currency_row['ncurrency_id']){ $currency_selected = ' style="background:olive;"'; }else{ $currency_selected = ""; } ?> <input type="submit" <?php echo $currency_selected?> name="<?php echo $currency_row['ncurrency_id']?>" value="<?php echo $currency_row['vcurrency_name']?>"/> <?php } ?> </td> </tr> </table> </form> in submit script incurency_id value is key of $_POST variable!
  19. $i=1; $final = 10; for($i; $i>$final; $i++) { ${'name'.$i} = $_POST['name.$i']; ${'number'.$i} = "$_POST['number.$i']; } echo $name2; echo $name3;
  20. <?php class test{ var $local_preferences = array('l1','l2','l3'); var $remote_preferences = array('r1','r2','r3'); function get($k, $array){ return $this->{$array.'_preferences'}[$k]; } } $a = new test(); echo $b = $a->get(1,'remote'); ?>
×
×
  • 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.