-
Posts
837 -
Joined
-
Last visited
Everything posted by samshel
-
<?php $arrRecords = file("/filepath/filename.dat"); $intCount = count($arrRecords); $arrReferences = array(); $arrReferenceRecords = array(); for($i=0;$i<$intCount;$i++) { $arrColumns = explode("|", $arrRecords[$i]); if(isset($arrReferences[$arrColumns[3]])) $arrReferences[$arrColumns[3]] = $arrReferences[$arrColumns[3]] + 1; else $arrReferences[$arrColumns[3]] = 1; $arrReferenceRecords[$arrColumns[3]] = $arrRecords[$i]; } echo "Duplicate Rows...</br>"; foreach($arrReferences as $key=>$value){ if($value > 1) { echo $arrReferenceRecords[$key]."</br>"; } } ?> PS: Code is not tested...
-
[SOLVED] Get the smallest date out of 4 dates
samshel replied to ireneyee's topic in PHP Coding Help
$dtDate1 = "2005-09-13"; $dtDate2 = "2006-09-13"; $dtDate3 = "2007-09-13"; $dtDate4 = "2008-09-13"; $arrDates = array(strtotime($dtDate1), strtotime($dtDate2), strtotime($dtDate3),strtotime($dtDate4)); sort($arrDates); echo $arrDates[3]; // will display latest date "2008-09-13" echo $arrDates[0]; // will display oldest date "2005-09-13" PS: code not tested. -
sorry i am slightly confused.. the code for showing error is on "loginform.php", you are redirecting to "login.php" and you are expecting to see the error there? Sorry if i got it terribly wrong.
-
<?=$_SERVER['REMOTE_ADDR'];?> gives the IP used by APACHE, if you use localhost as the domainname, it will return 127.0.0.1. Try adding a virtual host and assing the IP of the machine to that.
-
on failure you are redirecting to login.php, where as index.php is one level up..you sure about the login.php path? try giving full URL, just to debug thats not causing the problem.
-
It is inserting '0x0' between each character for the encrypted password.. example: if encrypted password : Xakf12dszO $intTotal = X0x0a0x0k0x0f0x010x020x0d0x0s0x0z0x0O dont understand why it is done so though..may be a checksum or something like that not sure.
-
[SOLVED] Exclude column from php generated query
samshel replied to lindm's topic in PHP Coding Help
Try this line: added ")" at the end of condition if(!in_array($colname, $arrExclude)) { sorry the code was not tested properly. -
[SOLVED] Exclude column from php generated query
samshel replied to lindm's topic in PHP Coding Help
<?php include ('mysqlconnnection.php'); //include connection $arrExclude = array('col1', 'col2'); $result = mysql_query("SHOW COLUMNS FROM $table") or die("mysql error"); $numColumns = mysql_num_rows($result); $x = 0; while ($x < $numColumns) { $colname = mysql_fetch_row($result); if(!in_array($colname, $arrExclude) { $col[$colname[0]] = $colname[0]; } $x++; } $querycx = 'UPDATE '.$table.' SET '. implode( '=\'\', ', $col ) .'=\'\' WHERE `userName` = \''. $user2 .'\''; echo $querycx; ?> $arrExclude can contain all columns that need not be updated. -
what is endless pagination?
-
can you post some more code?
-
did you check http://in2.php.net/manual/en/function.preg-replace-callback.php OR you can use preg_match first, here you get an array of matches which also contains your match for "()", that you can later use to replace. hth
-
do you plan to have differente pages for different clients?? so if you have 100 users you will have 100 pages? or am i getting this terribly wrong.. i think you should have only one page and put the logic to display something or not in the if or switch conditions. PS: OR having different pages depending on type of users ( like admin, user etc) makes more sense to me.
-
<input type="text" name="username" maxlength="30" size="25" value="<? echo $input->setValue('username').' : '.$input->setError('username'); ?>"> perhaps something like this...?
-
Check this out.. http://in2.php.net/manual/en/function.imagecopy.php
-
[SOLVED] prefix a primary id with username
samshel replied to coolphpdude's topic in PHP Coding Help
pl mark as solved -
[SOLVED] prefix a primary id with username
samshel replied to coolphpdude's topic in PHP Coding Help
yes exactly -
[SOLVED] Validating a field - no invalid chars or spaces
samshel replied to JSHINER's topic in PHP Coding Help
this will give small case, upper case letters and numbers only <?php if (!preg_match('/^[a-zA-Z0-9]+$/',$data) { echo "FAIL - invalid username"; } ?> PS: added a + at the end to allow more than one charachters. i think you need that ? -
[SOLVED] prefix a primary id with username
samshel replied to coolphpdude's topic in PHP Coding Help
please provide table structures if possible, -
getting data to list box when fields are atleast two word
samshel replied to jkkenzie's topic in PHP Coding Help
First tip, always include strings used as array keys in double quotes <?php $result2 = mysql_query("SELECT DISTINCT `Current Residence` FROM `members` ORDER BY `Current Residence`"); echo "<select name='Current Residence'>"; while($nt=mysql_fetch_array($result2)){ echo "<option value='$nt[\"Current Residence\"]'>$nt[\"Current Residence\"]</option>"; } echo str_replace('"', '"', trim($row["Current Residence"])); echo "</select>"; ?> -
[SOLVED] php form Enquiry for: Array.. dont want Array
samshel replied to foevah's topic in PHP Coding Help
please mark as solved -
[SOLVED] prefix a primary id with username
samshel replied to coolphpdude's topic in PHP Coding Help
You can go for a combined primary key of auto id and teacher_id, strings should be avoided in primary keys.. -
anyways regex would be safe and fast...
-
[SOLVED] Can i add an image to my email php form???
samshel replied to craigtolputt's topic in PHP Coding Help
pl mark it solved. -
[SOLVED] prefix a primary id with username
samshel replied to coolphpdude's topic in PHP Coding Help
what is the problem you are worried about in existing structure ? running out of integers?