ryanzroost Posted November 21, 2006 Share Posted November 21, 2006 I am trying to insert a simple randomly generated key into a database and for some reason I can't get it to work. I have provided the code below. Help me please! <input type="hidden" name="Userhc15_ProjectNumber" id="Userhc15_ProjectNumber" value="<?php echo KT_escapeAttribute($row_rshavecopy15['Userhc15_ProjectNumber']);function randomkeys($length){ $pattern = "1234567890abcdefghijklmnopqrstuvwxyz"; for($i=0;$i<$length;$i++) { if(isset($key)) $key .= $pattern{rand(0,35)}; else $key = $pattern{rand(0,35)}; } return $key;} ?>"/> Quote Link to comment Share on other sites More sharing options...
taith Posted November 21, 2006 Share Posted November 21, 2006 [code]<?function randomkeys($length){ $pattern = "1234567890abcdefghijklmnopqrstuvwxyz"; for($i=0;$i<$length;$i++){ $key .= $pattern{rand(0,35)}; } return $key;}?>[/code] Quote Link to comment Share on other sites More sharing options...
ryanzroost Posted November 21, 2006 Author Share Posted November 21, 2006 I tried to insert the code but it still didn't work. Would it help if I sent you all of the code, or is there anything else you need to know about what I am doing? I am fairly new at this. Quote Link to comment Share on other sites More sharing options...
taith Posted November 21, 2006 Share Posted November 21, 2006 [code]<?function randomkeys($length){ $pattern = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; for($i=0;$i<$length;$i++){ $key .= $pattern{rand(0,62)}; } return $key;}?><input type="hidden" name="Userhc15_ProjectNumber" id="Userhc15_ProjectNumber" value="<?=KT_escapeAttribute($row_rshavecopy15['Userhc15_ProjectNumber'])?>"/><?=randomkeys(10)?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.