Query issues
Posted on
16th Feb 2014 07:03 pm by
admin
I probably have this setup wrong well I know I do because nothing is showing up now. What I want is for it to show all the character names that are assigned to each user so yes than can be more than one. Can't figure out where at in my coding is my problem.
table efed_bio
id
charactername
table handler_characters
id
handler_id
bio_id
table efed_handler
id
default_character_id
login
forum_id
Code: <?php {
$query = "SELECT h.login, h.forumname,
bio.charactername AS charactername
FROM efed_bio AS bio, efed_handler_characters AS ech, efed_handler AS h
WHERE h.default_char_id = bio.id
AND ech.handler_id=h.id
AND ech.bio_id=bio.id";
$result = mysql_query ( $query ); // Run The Query
if ($result) {
print '<h1 class=backstage>Active Handler Directory</h1><br />';
print '<table width="100%" class="table1">';
print '<tr class="rowheading">';
print '<td>Name</td>';
print '<td>Forum Name</td>';
print '<td>Characters</td>';
print '</tr>';
// Fetch and print all records.
$i = 0;
while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
$sClass = 'row2';
if ($i ++ & 1) {
$sClass = 'row1';
}
printf ( "<tr class="%s">", $sClass );
printf ( "<td valign="top">%s</td>", $row [login] );
printf ( "<td valign="top">%s</td>", $row [forumname] );
printf ( "<td valign="top"><ul class="characters"><li>%s</li>", $row [charactername] );
print '</ul></td>';
print '</tr>';
}
print '</table><br />';
print '<h2 class=backstage><form method=POST><input type=hidden name=action value=mainmenu><input type=submit value="Return to Main Menu" class=button200></form></h2>';
}
}
?>
No comments posted yet
Your Answer:
Login to answer
282
20
Other forums
How to write on database when a link is clicked?
Hi,
I have a list of products in a gridview. When the link is clicked currently it takes to an ext
setcookie and isset($_COOKIE(name)) seem very finnicky.
I'm currently playing around with a user system with login and registration. I'm trying to use cooki
Auto fill in input value based on User_ID
Hello,
I'm looking form some input on the following problem.
User loads page ->
Switch letters in message (basic cryptology)...
I am trying to switch letters around in a message for an application on my site (see here). The prob
Strange Oracle Query problem
Ok So I have this PHP class that talks to a Javascript class that basically creates a table of infor
Need help adding a timestamp to my filename/variable
Hello,
I'm kind of stupid when it comes to php and I need a tiny bit of help. I've got a f
Record count of entire database
Does anyone know if there is a way to obtain the number of records in each table of the database usi
Weird problem with SELECT command..Help!
Hi!
It seems I'm having a really weird problem with SQL SELECT command....I have table into a
Need help with an email blocker for a guessbook
I am new with php and here is a simple guessbook page but I am being hit with spam from a group of t
SQL Injection
In my attempts to protect my database from mySQL injection I have created another problem for myself