This is a discussion on "Php Question" within the PHP Forum section. This forum, and the thread "Php Question are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Php Question
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Php Question
I have a form that users input data by selecting options from list menus & entering data into text boxes, the data goes into mysql database.
I then use php code to echo the information from the database onto a profile page, for instance name address email and so on! The problem is that i have to manually type the name of the person who inserted the record (same name as entered into the name column when the record was submit or the record will not display in the profile page).. Below is a code example of what i am talking about, notice the name in the code says MR Andrew Lloyd, and my record will show up from my database into the profile page, if i dont type the name of the person that submit the record then there record will not be displayed in the profile page, So if i had the website online and all different people were inputting records, what code would i need so the profile page automatically displays that users record when they enter the site, my site does require users to login to use the site, but the signup\ login database is seperate from my profile database. Could anyone give me any suggestions Cheers.
Below is my database CREATE DATABASE IF NOT EXISTS dblearn; USE dblearn; CREATE TABLE employees (name VARCHAR(30), email VARCHAR(30), phone VARCHAR(30), photo VARCHAR(30)) Thanks |
|
|
|
||||
|
Re: Php Question
How the profile page works ? I mean users should login to system and see their profiles, or everyone can see users profiles ?
One way to do this is to use post or get methods to pass the name and select it from database...
__________________
Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
|
|
|||
|
Re: Php Question
Cheers i will try that!!! Thanks 4 the repley
|
|
||||
|
Re: Php Question
In your database you need to create a column that is the primary index and give it an auto increment value
CREATE TABLE employees (ID INT NOT NULL AUTO_INCREMENT,name VARCHAR(30), email VARCHAR(30), phone VARCHAR(30), photo VARCHAR(30), PRIMARY_KEY(ID)) Now every time you insert a record the row will get a unique id that you can use to access records. You could pass the records on the $_GET string and re-write the code like
So accessing the page with mypace.com/index.php?id=1 will retrieve the user with the ID of 1
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: Php Question
Cheers Rakuli!!! Great advise.
I had the feeling that was the problem, see my sign up database users Unique Id so i have decided to run the profile creation page of the same database in a seperate table, instead of the preveious one am using now that is without "ID INT NOT NULL AUTO_INCREMENT" this should solve my problem. Should save records over writing each other aswell!!! Cheers m8t. This sql code seems to work well on the advice you have given me. CREATE DATABASE IF NOT EXISTS dbclients; USE dbclients; CREATE TABLE `tbl_area` ( `areaid` int(10) unsigned NOT NULL auto_increment, `areaname` varchar(45) NOT NULL, PRIMARY KEY (`areaid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Take care. |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| another question please....... | napstar | Starting Out | 3 | Feb 20th, 2007 22:28 |
| css question | Daniel | Web Page Design | 29 | Feb 16th, 2007 12:13 |
| Question!! | JacobHaug | JavaScript Forum | 5 | Dec 28th, 2006 18:22 |