Hi all, I need a textbox that I can enter a number (a primary key) and produce the corresponding data with that primary key. If not an error message comes up. Anyone got the code? thanks
What exactly do you need help with? This forum is for programmers who need help but we won't write scripts for you. Show us what you have so far and explain where you are having a problem and we will help you.
Thank you for the reply danx10, Basically what I want is: a textbox: [ ] enter a number [99] enter and whatever data is in the database where 99 is the auto incremented number, im not sure if thats called the primary key or what - but basically whatever is on line 99 will appear? I'm new to PHP, I hope I've explained myself sufficiently. Many thanks, Le007
Risoknop, I know this: I've been a member for quiet some time now and am an absolute expert at CSS, I've not only written code for people but have emailed them bespoke templates specific to them - I'm just looking for someone to do the same with this short script for me.
Number:<input type='text' name='number' value=''> $sql = mysql_query("SELECT * FROM `TABLE` WHERE id = '".$_POST['number']."' "); $show = mysql_fetch_array($sql); echo"".$show[id]."<br> ".$show[name]."<br>"; something like this maybe?
<form method="post"> <input type="text" name="key" > <input type="submit" name="submit" value="Enter"> </form> <?php if(isset($_POST['submit']) && ctype_digit($_POST['key'])){ $row = mysql_fetch_array(mysql_query("SELECT * FROM your_table_name WHERE id={$_POST['key']}")); echo $row['the_column_name']; } ?> PHP:
whats the purpose of this? *ctype_digit* , it performs the search action without clicking the button? am I right? thanks anyways for this share.