G&G Designing 1 Junior Poster in Training

Ok, so what im trying to make is an authentication system that gives the user the pin. I have all currently generated pins setup in a mysql database that looks like this..

[img]http://img847.imageshack.us/img847/3621/databaset.png[/img]

So now i need to display them, and then after its displayed on the page, i want it either removed from the database or the used variable changed to 0

Here is my php script for this so far...

<?php
// Echo random

$username="bryan_pin"; //enter your database username
$password="imsa1135"; //enter your db password
$database="bryan_pin"; //enter the name of your database

mysql_connect(localhost,$username,$password); 
@mysql_select_db($database) or die( "Unable to select database"); 
$query=	"SELECT * FROM pins WHERE used > 0 ORDER BY RAND() LIMIT 1"; 
$result=mysql_query($query);
$num=mysql_num_rows($result);

mysql_close(); 

$i=0; //declares that i has a value of zero 0
while ($i < $num) { 
$Pin=mysql_result($result,$i,"pin");
echo"$Pin"; 
$i++;
};

?>

Any help is apriciated! Also, the random row selection is working - http://bryansblog.co.cc/test_random.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.