Hi all,
I’m a newbie to php/mysql but am getting there… I’ve managed to be able to pull some codes from my database… BUT what I want to try and do is to be able to type into a text box, get a result e.g. Yes, the code is in the databse or No, try again… If anyone can give me some ideas on how to do this that’d be great!
[code=php]
<?php
if(empty($_SESSION[‘session_started’]))
{
session_cache_expire(120);
session_start();
$_SESSION[‘session_started’] = “TRUE”;
}
//connect to the mysql database
include ‘configure.php’;
include ‘opendb.php’;
$query = “SELECT Code FROM tblcodes”;
$result = mysql_query($query);
echo ‘<table class=”main” width=”700″ border=”0″ cellspacing=”0″ cellpadding=”0″>
<thead>
<tr>
<th scope=”col” class=”twenty”>CODE ID</th>
<th scope=”col” class=”twenty”>CODE</th>
</tr>
</thead>’;
if (mysql_num_rows($result) < 1) {
echo ‘<tr valign=”top”>
<td colspan=”4″>There are no members that match the query. Please go back and try again</td>
</tr>’;
}
else {
while ($qry = mysql_fetch_array($result)) {
//create the layout
?>
<tr valign=”top”>
<td><?php echo $qry[‘CodeID’]; ?></td>
<td><?php echo $qry[‘Code’]; ?></td>
</tr>
<?php
}
}
echo ‘</table>’;
include ‘closedb.php’;
?>