|
From: Vix on 19 Jun 2008 04:17 Thank you! Gary White wrote: > On Wed, 18 Jun 2008 16:19:57 +0100, Vix <user(a)example.net> wrote: > >> function gen_username() { >> $username = substr($row_rsDeceasedList['LastName'],0,3); >> $username .= date('dmY', strtotime($row_rsDeceasedList['DateOfDeath'])); >> return $username; >> } >> >> <input name="Username" type="text" id="Username" size="32" value="<?php >> echo $u = gen_username(); ?>" /> >> >> My problem is that only the date part is being written in the form >> field. Why isn't isn't my function extracting the the first 3 >> characters of the LastName field in the database? > > You aren't getting the expected result because the > $row_rsDeceasedList['DateOfDeath'] is out of scope inside the > function. Try it this way: > > function gen_username($n) { > $username = substr($n,0,3); > $username .= date('dmY', > strtotime($row_rsDeceasedList['DateOfDeath'])); > return $username; > } > > And: > > <input name="Username" type="text" id="Username" size="32" > value="<?php echo gen_username($row_rsDeceasedList['DateOfDeath']); > ?>" /> > > Gary
From: Gary White on 19 Jun 2008 08:49 On Thu, 19 Jun 2008 09:17:22 +0100, Vix <user(a)example.net> wrote: >Thank you! You're welcome. Gary
From: yupieyi on 19 Jun 2008 09:11 My php skills are pretty limited.. thanks for helping me learn a little bit more!
From: DizzDizzy on 19 Jun 2008 09:20 can anyone tell me how to about that i am still not sure about the answers ?
|
Pages: 1 Prev: CSS problem w/ IE7 Next: Viewing in IE on a pc is messed up |