Jump to content

Database entry form


Rogue3

Recommended Posts

I made a form so that I can add entries into my database, and I need help tweaking the end result a bit. Everything works just fine, the only part I can't figure out is when I enter an item in the database and click my submit button, the page that comes up shows all entries in the database. I'd like it to only show the one I JUST put in (for verification purposes).

Here is my code:

[code]mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM mytable";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<b><center>JTA Database Entry</center></b><br><br>";

$i=0;
while ($i < $num) {

$series=mysql_result($result,$i,"series");
$type=mysql_result($result,$i,"type");
$mfg=mysql_result($result,$i,"mfg");
$year=mysql_result($result,$i,"year");
$name=mysql_result($result,$i,"name");
$link=mysql_result($result,$i,"link");[/code]

Link to comment
Share on other sites

I added LIMIT to my query. I now get 1 result, however it is the first result in my table. How do I make it show the one I just entered? Here is what I changed:

[code]$query="SELECT * FROM guides LIMIT 1";[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.