Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Project


  • Please log in to reply

#1
thenotch

thenotch

    Member

  • Retired Staff
  • 667 posts
OK, I am not much into creating a PHP code from bare scratch... I know just enough to be dangerous :whistling:

What I am trying to do is create something that will display, according to the date, a list of that days birthdays.

What I would also like is a simple, hassle-free front-end that will allow me to input the person, their birth date and their allegiance (it's for my Civil War site so this field would populate either Union or Confederate) and then that data would populate a mySQL database.

So, I use this coded front-end to enter the data, it populates the database, then I insert the code (an include I am guessing) into my website and it displays on the front page the appropriate birthdays.

Sounds simple enough I reckon, but like I said, I am better with HTML and CSS than PHP.

Any takers or does anyone know of a preexisting script that will do this?
  • 0

Advertisements


#2
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts
This might help you get started, I am too lasy to bug test it though. And I am not making the tables, if you need that I post that too. It not a great script, but it is a start.

connect.php
<?php

$user=""; //mysql user name
$password=""; //mysql password
$host="localhost";
$table="birthday"; //the table
$db=""; //database name

$con = mysql_connect($host,$user,$password);
mysql_select_db($db, $con);

?>

add.php

include('connect.php');

if(isset($_POST['person']){ //the person field has been filled in, so let process it.

$person = $_POST['person'];
$birth = $_POST['birth'];
$allegiance = $_POST['allegiance'];

mysql_query("INSERT INTO $table (person, birth, allegiance) VALUES ('$person', '$birth', $allegiance')");

echo('Person added');
}


<form method="post" action="">
<input type="text" name="person">
<input type="text" name="birth">
<input type="text" name="allegiance">
<input type="submit" value="Submit">
</form>

echo.php out put the result.
use
$date = "that date you want";
include('echo.php');

$result = mysql_query("SELECT person FROM $table WHERE birth LIKE '$date'");
while($row = mysql_fetch_array($result)) {
echo($row['person']);
}


Hope that helps.
  • 0

#3
thenotch

thenotch

    Member

  • Topic Starter
  • Retired Staff
  • 667 posts
Thanks Michael.. I am going to mess around with that today... I'll let you know what comes of it.
  • 0

#4
thenotch

thenotch

    Member

  • Topic Starter
  • Retired Staff
  • 667 posts
After looking this over I have a more precise idea of what I want.

Instead of the database thing, I think in this case a flat file will work just fine. This way there is no extra page to be loaded, I edit the flat file and the data is pulled from there.

I saw a really nice looking script at http://www.imdb.com (over on the right and down a bit). That is sort of how I would like this one to look... to display their birthday (if it is today) and their small photo with a link to click to change to the next birthday if it exists.
  • 0

#5
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts
I don't really like working with flat file databases, even though am OK when I want too. Have a go if you get stuck I am sure me (or some one else can help).
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP