/    Sign up×
Community /Pin to ProfileBookmark

Need to integrate PHP & MySQL for entering data…

I know the title of this thread is very broad, that’s becuase i’m not sure what this should be under. Anyways, I’m creating a site that is a fan site of a television show. I have created a page that I call the character guide and for all the main characters in every episode I have made a small profile including, the character name, a small character description, the actor/actress, their date of birth, height, marital status, and the films/tv shows they have been on, made guest appearances on, and also a small bio on them. Now I have done over 100 of those and I went through and created lists for each individual one. I was thinking that it would be much much easier in the future if there was a way I could just create an outline of that, but one that i could just enter the data like height, birthdate, etc. into a database and it would output on the site in the format I was doing before by hand/html. Thank you for any help you can give.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@BeachSideJul 29.2005 — You may want to think about some sort of CMS (Content Management System) for that.

There are some good free ones available.

http://www.opensourcecms.com/

http://www.la-grange.net/cms#php
Copy linkTweet thisAlerts:
@NogDogJul 29.2005 — I like the idea of using a database (but I am a bit of a geek, after all). Initially, I see a couple tables, something like:
<i>
</i>cast
=======================
COLUMN TYPE
-------- -------------
character varchar(32) primary key
actor varchar(32)
descr text
birth date
height smallint (or float, depending on units)
marital varchar(1) [S,M,D,W, etc.]
bio text


roles
======================
COLUMN TYPE
-------- ------------
actor varchar(32) [provides relation to cast table]
title varchar(64)
character varchar(32)
notes text

Now let's say you want to display some info on character "John Doe":
[code=php]
<?php
$query = "SELECT * FROM cast WHERE character = 'John Doe'";
$result = @mysql_query($query);
if($result)
{
$row = mysql_fetch_assoc($result);
extract($row, EXTR_PREFIX_ALL, "q");
echo <<<EOD
<h3>$q_actor</h3>
<ul>
<li>Role: $q_character</li>
<li>Born: $q_birth</li>
<li>Description: $q_descr</li>
EOD;

$query2 = "SELECT * FROM roles WHERE actor = '$q_actor'";
$result2 = @mysql_query($query2);
if($result2 and mysql_num_rows($result2) > 0)
{
echo "<li>Other Film/TV Roles:</li>n<ul>n";
while($row2 = mysql_fetch_assoc($result2))
{
extract($row2, EXTR_PREFIX_ALL, "q2");
echo "<li>$q2_character, <i>$q2_title</i>";
if(!empty($q2_notes))
{
echo " ($q2_notes)";
}
echo "</li>n";
}
echo "</ul></li>n";
}
echo "</ul>n";
}
?>
[/code]

Now that may look like a lot of work; but, if you put that code into a function definition within an include file - let's say the function is called "display_cast_member", then all you would need in a given page is:
[code=php]
require("include_file.php"); # only need this line once per page
# for each character you wanted to display:
display_cast_member("John Doe");
[/code]

Caveat: I have not tested/debugged any of this. It's just presented as a guideline to give you some idea how to go about it and what it might entail.
×

Success!

Help @MyglyMP2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...