sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
<?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'; ?>
-
are you change your inbox script?
-
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']);
-
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; ?>
-
if two variables are same they have same length
-
<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>
-
<?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'; ?>
-
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"; } } */ ?>
-
Read rules! (16)
-
change || to and in if statemant
-
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
-
$_GET['id'] and $_GET['Id'] is NOT same
-
remove line $row_svcIssueCats = mysql_fetch_array($result_svcIssueCats); just before 2nd while loop
-
[SOLVED] Getting Certain Field From a Row Problems
sasa replied to Akenatehm's topic in PHP Coding Help
variable $amount is empty try to echo it before query -
<?php $test = 'Paths.Images.Icons'; $out = array(); foreach (array_reverse(explode('.',$test)) as $v) $out = array($v => $out); print_r($out); ?>
-
[SOLVED] Getting Certain Field From a Row Problems
sasa replied to Akenatehm's topic in PHP Coding Help
change lipn while ($results = mysql_fetch_array($findpoints, MYSQL_NUM)){ to while ($results = mysql_fetch_array($findpoints, MYSQL_ASSOC)){ -
No Get or POST data after submitting form to php
sasa replied to neal.pressley's topic in PHP Coding Help
you have 3 forms on your page which one don't work? -
can you post code where you call your function
-
are you shure that file med.dat exist? where you call your function?
-
<?php $pieces = explode("<br>", $bankinfo); foreach($pieces as $key => $value){ if($value == "" || $value == "UNIT QTY $ AMOUNT"){ unset($pieces[$key]); } echo $value . "<br />"; } ?>
-
WHERE name<'A'
-
[SOLVED] Displaying table results in multi column table
sasa replied to rvdb86's topic in PHP Coding Help
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>