Little lost here!
Moderator: General Moderators
Little lost here!
Hi Everyone!
I need some help, but I think it will be a cake walk for most of you.
I'm looking to build a web page that just contains a list of people who sign the list. You write your name and perhaps location in a box, summit and then it shows up on the list. Very simple. Maybe about 200 names on the list with pages for other names.
Example;
3. Kevin Pereira San Jose, Ca (Last person to submit name)
2. Timmy Parker Las Vegas, NV
1. John Doe New York, NY
Also, I would like a box to for everyone to enter in an email address that I keep without the email showing up on the list.
Can anyone help me? I am a little lost here! I have php my admin in my hosting package.
I need some help, but I think it will be a cake walk for most of you.
I'm looking to build a web page that just contains a list of people who sign the list. You write your name and perhaps location in a box, summit and then it shows up on the list. Very simple. Maybe about 200 names on the list with pages for other names.
Example;
3. Kevin Pereira San Jose, Ca (Last person to submit name)
2. Timmy Parker Las Vegas, NV
1. John Doe New York, NY
Also, I would like a box to for everyone to enter in an email address that I keep without the email showing up on the list.
Can anyone help me? I am a little lost here! I have php my admin in my hosting package.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Little lost here!
We can guide you, but we can't (won't) do it for you. You need to create a table with four columns: ID, name, location, and email.
http://php.about.com/od/learnmysql/ss/create_tables.htm
Next, create a form containing the fields you want (name, location, email).
http://w3schools.com/html/html_forms.asp
Lastly, create a script that takes the data from the form, and inserts it into the database.
http://w3schools.com/php/php_forms.asp
http://w3schools.com/php/php_mysql_insert.asp
Additionally, you can get the most recent names (like you showed) on the page with the form:
http://w3schools.com/php/php_mysql_select.asp
http://php.about.com/od/mysqlcommands/g/Limit_sql.htm
http://php.about.com/od/learnmysql/ss/create_tables.htm
Next, create a form containing the fields you want (name, location, email).
http://w3schools.com/html/html_forms.asp
Lastly, create a script that takes the data from the form, and inserts it into the database.
http://w3schools.com/php/php_forms.asp
http://w3schools.com/php/php_mysql_insert.asp
Additionally, you can get the most recent names (like you showed) on the page with the form:
http://w3schools.com/php/php_mysql_select.asp
http://php.about.com/od/mysqlcommands/g/Limit_sql.htm
Re: Little lost here!
Thanks so much for that!! I've been working very hard on this.
I'm a little stuck on this. When I submit the forum, the table in the database shows an empty box. The information is not showing up, but Its obviously connecting to the database. Any help here? What could be wrong?
I'm a little stuck on this. When I submit the forum, the table in the database shows an empty box. The information is not showing up, but Its obviously connecting to the database. Any help here? What could be wrong?
Re: Little lost here!
Impossible to guess without seeing your code.WFPS wrote:Thanks so much for that!! I've been working very hard on this.
I'm a little stuck on this. When I submit the forum, the table in the database shows an empty box. The information is not showing up, but Its obviously connecting to the database. Any help here? What could be wrong?
Re: Little lost here!
I actually got it going. Thanks though!
Re: Little lost here!
Ok new problem I can't get around,
I can only list two fields on my website and can not display the 3rd from the database, (location)
Right now I am only displaying id and name, how do I add location?
I can only list two fields on my website and can not display the 3rd from the database, (location)
Right now I am only displaying id and name, how do I add location?
Code: Select all
$result = mysql_query("SELECT * FROM people");
while($row = mysql_fetch_array($result))
{
echo $row['id'] . " " . $row['name'];
echo "<br />";
}
mysql_close($con);
?>scottayy wrote:Added PHP Code formatting tags.
Re: Little lost here!
All of your information is now available in $row.
So you would have $row['id'], $row['name'], $row['location'], and $row['email'] available to you
$row is an array with the table field names as keys.
So you would have $row['id'], $row['name'], $row['location'], and $row['email'] available to you
$row is an array with the table field names as keys.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: Little lost here!
Mind helping me with the code? I can't seem to get it right! So frustrating. Although I only started working with php yesterday
Re: Little lost here!
You just need to echo $row['location'] along with the rest of the information.WFPS wrote:Mind helping me with the code? I can't seem to get it right! So frustrating. Although I only started working with php yesterday
Re: Little lost here!
Got it working! Thanks Everyone!
One last question, how do I get the last entrees to show on the top instead of the bottom? Also, how do I create pages for people to scroll through earlier entrees?
One last question, how do I get the last entrees to show on the top instead of the bottom? Also, how do I create pages for people to scroll through earlier entrees?
Re: Little lost here!
You can modify your query to sort them: "SELECT * FROM people SORT BY id DESC"
As far as paging the results, that's something you should probably Google - there's a few tutorials out there on it. Good luck!
As far as paging the results, that's something you should probably Google - there's a few tutorials out there on it. Good luck!