Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. <?php function chek_sum($num){ $sum = 0; $mult = 1; $num = str_split(trim($num)); if (count($num) != 9) return false; foreach ($num as $n) { $n *= $mult; $mult = 3 - $mult; $sum += (int) ($n/10) + $n % 10; } return $sum % 11 == 0; } $number = '123456786'; if(chek_sum($number)) echo 'OK'; else echo 'no'; ?>
  2. change <input type="checkbox" name="<?=$row[employee_id]?>" id="<?=$row[employee_id]?>" value="<?=$row[employee_id]?>"/> to <input type="checkbox" name="employee_id[]" id="<?=$row[employee_id]?>" value="<?=$row[employee_id]?>"/> and on page2 try to print_r($_POST['employee_id']);
  3. try <?php session_start(); require("../db/db.php"); //include database file require("../db/config.php"); //include configuration file require("../db/util.php"); require("../db/settings.php"); isloggedin(); accessneeded("C"); $user = $_SESSION['username']; //We do not have a user check on this page, because it seems silly to, you just send data to this page then it directs you right back to inbox //We need to get the total number of private messages the user has $sql = mysql_query ("SELECT pm_count FROM users WHERE username='$user'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; foreach ($_POST['pms'] as $pm_id){ //Delete the PM from the database mysql_query("DELETE FROM `messages` WHERE `messages`.`id` = '$pm_id' AND reciever='$user' LIMIT 1"); //Subtract a private message from the counter! YAY! $pm_count = $pm_count - mysql_affected_rows(); } //Now update the users message count with the new value mysql_query("UPDATE users SET pm_count='$pm_count' WHERE username='$user'"); header("Location:inbox.php"); exit; ?>
  4. if two variables are same they have same length
  5. <select name="DateOfBirth_Year"> <option> - Year - </option> <?php $start_year = date('Y'); $end_year = $start_year - 80; for ($year = $start_year; $year >= $end_year; $year--){ echo "\t<option value=\"$year\">$year</option>\n"; } ?> </select>
  6. <?php if ($password == $repassword && strlen($password)>= 4){ echo 'password is OK'; } else echo 'bad password'; // or if ($password != $repassword or strlen($password) < 4){ echo 'bad password'; } else echo 'password is OK'; ?>
  7. try <?php /* $namesarray = array(); foreach(range('a', 'z') as $value) { $namesarray[$value] = array(); } $names = array(); */ $query = "SELECT * FROM $dbBiographyTable WHERE approval = 1 ORDER BY title ASC"; $result = mysql_query( $query ) or die ( "Error on db query biographies.php" ); mysql_close( $session ); $num_rows = mysql_num_rows( $result ); if(mysql_num_rows($result) == 0) { echo("Nothing to Display!"); } else { $letter = 'A'; while($row = mysql_fetch_array($result)) { $letter1 = strtoupper(substr($row['title'],0,1)); while ($letter <= $letter1) echo $letter++,"<br />\n"; echo '--', $row['title'],"<br />\n"; } while (strlen($letter) < 2) echo $letter++,"<br />\n"; } /* foreach($names as $value) { $namesarray[$value[0]][] = $value; } foreach($namesarray as $letter => $names) { echo "$letter \n"; foreach ($names as $name) { echo "$name \n"; } } */ ?>
  8. SELECT * FROM (SELECT masterdata.masterdataid, masterdata.companyname, masterdata.contactname, IF( resultsnotations.prospectrating IS NULL , 'no value', resultsnotations.prospectrating ) AS prospectrating, masterdata.lastactivity FROM masterdata LEFT JOIN resultsnotations ON masterdata.masterdataid = resultsnotations.masterdataid ORDER BY masterdata.masterdataid, resultsnotations.lastactivity DESC) AS a GROUP BY masterdataid
  9. $_GET['id'] and $_GET['Id'] is NOT same
  10. remove line $row_svcIssueCats = mysql_fetch_array($result_svcIssueCats); just before 2nd while loop
  11. variable $amount is empty try to echo it before query
  12. <?php $test = 'Paths.Images.Icons'; $out = array(); foreach (array_reverse(explode('.',$test)) as $v) $out = array($v => $out); print_r($out); ?>
  13. change lipn while ($results = mysql_fetch_array($findpoints, MYSQL_NUM)){ to while ($results = mysql_fetch_array($findpoints, MYSQL_ASSOC)){
  14. you have 3 forms on your page which one don't work?
  15. look in_array() function
  16. can you post code where you call your function
  17. are you shure that file med.dat exist? where you call your function?
  18. <?php $pieces = explode("<br>", $bankinfo); foreach($pieces as $key => $value){ if($value == "" || $value == "UNIT QTY $ AMOUNT"){ unset($pieces[$key]); } echo $value . "<br />"; } ?>
  19. clean up table part must be // clean up table - makes your code valid! if($i > 0) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; echo "</tr>"; } ?> </table>
×
×
  • 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.