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
https://forums.phpfreaks.com/topic/117543-getting-information-from-mysql/
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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.