I need to create a database-driven website using PHP and MySQL. As database-driven sites go, I think this should be fairly simple. And I don't have much money, so I'm trying to figure out how to do it myself, or find someone who wouldn't charge much to help me.
I'm in the business of booking speakers for companies (like motiational speaker). I need to set up a web page template which will be used to display speaker information. Each speaker would have a page with about 15 fields including bio, topic list, fee, etc. (all numbers or text, plus one field that will be a photo -- I guess it could be a URL to the photo location)
I know how to set up a database. I also know how to create a form to enter info into the database. What I DON'T know how to do is set up a template that will pull info from my database.
There will be about 75-100 speakers on my site. More, eventually. Each needs an individual page.
I also need to create a search function where visitors can search for speakers within preset fee ranges, or search certain topics.
Any guidance would be much appreciated. You can see my current site at www thespeakersgroup com. Click on any one of the speaker pages and you'll get an idea for what my template needs to look like. This current site only has about 9 speakers and is not database driven. I'm working on a NEW site which will have the 75-100 speakers as noted above.
Last edited by bear; 02-13-2008 at 05:27 PM.
Reason: by request
*nuke and mambo and other CMS systems are overkill for this.
What you need to do is create a template page (in your favorite HTML editor) with all the styles/layout that you would like for your speaker page (you might also add sample text and an image to see how everything flows).
Once you have done that, then its very easy to plug the PHP in. Just take the template page, rename it to php.
Next, add some method to search for each speaker. For example,
would cause the script to pull out the information for the speaker that has the record id 2 in your database.
Really quite easy, and no one should charge you more than $10 to do it....assuming you have already created a template.
Some would also do it for free, since its such a simple task.
In order to understand recursion, one must first understand recursion.
If you feel like it, you can read my blog
Signal > Noise
I would be willing to give you pointers and even write part of it for free. Here is some sample code for a page to list all speakers...
$link = mysql_connect('localhost', 'user', 'pass');
die('Could not connect: ' . mysql_error());
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
$result = mysql_query("SELECT SpeakerName, SpeakerPic, SpeakerBio FROM SpeakerTable");
/* loop through all the speakers and do the following */
while ($row = mysql_fetch_array($result))
/* assign speaker name to myName variable */
$myName = $row['SpeakerName'];
/* assign picture URL to myPic variable */
$myPic = $row['SpeakerPic'];
/* assign bio text to myBio variable */
$myBio = $row['SpeakerBio'];
/* display the image... you will have to have it stored on your server already and know its name */
echo "<img src='$myPic' border=0><br>";
/* on the next line display the speaker name and a link to the speaker page with the speaker name as the name variable in the URL */
echo "<a href='speaker.php?name=$myName'>$myName</a><br>";
/* on the nexxt line put the first 60 characters of their bio */
echo substr($myBio, 0, 60);
On speaker.php (where you will go when you click on their name) you will need the following...
/* get the speaker name from the URL */
$speakerName = $_GET['name'];
/* all the database stuff from above */
Hope you find this helpful... (I wrote it off the top of my head in about 5 minutes so it might have spelling errors and whatnot)