Php and mysql


#1

Hi
How can I create a page asking the user to input his ID for appear his information from database ?
(I created a date base has a table in local host)

Thanks…


#2

if you have the database and table, you can use PHP to connect to database. preferable use PDO for security:

http://php.net/manual/en/book.pdo.php

tools like xampp exist if you don’t want to configure everything manually (although configuring everything yourself can be good teaching)


#3

thank you this was helpful

but I want to know how I can create a page asked the user to input his id for appear his information specific by his unique ID and how I can uploaded all these in wep

thank you for your fast answer


#4

the page will be html with an input field

the user enters there ID, and then what should happen? You want a kind of user authentication system? Because just entering an ID without password, mean you could write a program to try randomly generated ID and see which ID’s exist


#5

great after input his unique ID and press the go button he will get his information that saved in data base with many other users
like this page ( user interface)


#6

so then you should make a form post request, on which you can specify an action which will be a .php file handling the logic


#7

you mean I should write my code in notepad ++ (html)
like this

<form action="my database location" method="POST">
<input type="password" name="password" value="Write your ID ..."/>
<input type="submit" name="submit" value="go"/>
</form>

I tried this way but when I in input and press go open my all data base page
how the information for this ID appearing ?
this really hard


#8

you mean I should write my code in notepad ++ (html)
like this

------------- I tried this way but when I in input and press go open my all data base page

this really hard


#9

You are constantly feeding me small parts, i can’t see oversee the bigger picture.

the action of form should be a php file:

<form action="getUser.php" method="POST">

then in getUser.php you can write the logic to connect to database, and retrieve the desired entries from the database and return a view/template with the retrieved data.


#10

this really Embarrassed all I need from user to input his ID and then appearing his information from data base (he can’t see other user information) because he did’t know ID for this user

I’m soooo grateful for your help
God protect you …


#11

so you will need to query the database:

// DONT USE THIS!!!!!
select * from table where user_id = id_entered_by_user

this is the simplest form of query you need, of course this query contains a massive security risk