Jump to content

Getting information from mysql


ngreenwood6

Recommended Posts

Hello all

 

I am a noob to php and am trying to learn. I have created a database that looks like this:

 

Database: nicks

Table: users

 

Inside of the table are these values

 

id:auto increment(primary)

firstname: varchar

lastname: varchar

 

I created a script that inserts this data into my database and it is working properly.  However, what I am trying to accomplish now is to get the data from the database and display it. I am trying to let the user search by their last name.  Whenever I click submit it just goes to a blank page (get.php).

 

I have attached a zip file with my files in it. If you need anymore info please let me know.

 

Thanks to anyone who is willing to help a total noob.

 

[attachment deleted by admin]

Link to comment
Share on other sites

Just off the top of my head...I can't test this so lemme know if this helps:

 

In your form, I added a "value" attribute to the input field:

<input name="lastname" type="text" id="get_lastname" value="lastname">

 

in variables.php, change it to:

$get_lastname = trim(stripslashes($_POST['lastname']));

 

I was going to write out a loop that would retrieve the data from the database, but I just realized you're using mysqli, which I am not familiar with...so I'll stop here and let someone else answer...

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.