# PHP+MySQL - random id in query string

**URL:** <https://forum.kirupa.com/t/php-mysql-random-id-in-query-string/217801>\
**Category:** programming\
**Created:** [March 1, 2007, 11:46pm UTC](https://forum.kirupa.com/t/php-mysql-random-id-in-query-string/217801 "2007-03-01T23:46:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [March 1, 2007, 11:46pm UTC](https://forum.kirupa.com/t/php-mysql-random-id-in-query-string/217801/1 "2007-03-01T23:46:33Z")

</div>

Im using query string appended to the URL eg “[www.site.com/page.php?id=1](http://www.site.com/page.php?id=1)” to pass an id so that the MySQL database selects relevant data and spits it out to the php. Its all working fine - but what im worried about is that the id in the URL is so easy to change - all someone with half a brain (or less) has to do is change the number to view other data that they shouldnt really be accessing…

so how can i make it so that the id is some abstract, untweakable number like “AE3324F3412” or something? obviously i will keep the primary key column “id” but use the new random ID column to select data - but how do i generate it?
