Jump to content

davidfattore

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by davidfattore

  1. @Ch0cu3r Thank you so much, I knew it had to be something trivial that I've obviously overlooked. Mate I'm not sure you know how much you've helped... I was without sleep for a good 24 hours consuming a boatload of coffee over that! LOL Again Thanks so much!
  2. Ok so I'm assuming it's staring me in the face but I currently have a scripting dilemma, which I need help with... Now before I get into it, I should inform you that the code itself is working perfectly; that's not the issue.... I have a set of users within my database all set up in thumbnail form on a page (CLICK HERE for example) The issue is for some reason, as per the code below, no matter which thumbnail I rollover my mouse over, it always displays the last user's name and not the name of the user associated with that particular thumbnail. Here is the Code <?php include "../../mysql/db_config.php"; //SQL Query $query = "SELECT userID, user_name, thumbnail, url FROM users WHERE city = 'Melbourne' ORDER BY order_city ASC"; $result = @mysql_query($query); $result2 = @mysql_query($query) or die($query."<br/><br/>".mysql_error()); if ($result) { // Build the Output Section Here $output = ''; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $uid = $row ["userID"]; $user = $row["user_name"]; $url = $row["url"]; $thumb = '<img src="' . $row["thumbnail"] . '" class="thumb" onmouseover="setUser()" onmouseout="removeUser()" </img>'; /*/////////////////////////////////////////////////////////////////////////////////////////// // SET UP USER DISPLAY MECHANISM // ///////////////////////////////////////////////////////////////////////////////////////////*/ $output .= '<div id="user_grid" class="user-grid"><a href="'. $url .'">' . $thumb . '</a></div>'; } } else { echo "Could not run query"; exit(); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="shortcut icon" type="image/x-icon" href="../assets/icons/icon.ico"> <link rel="apple-touch-icon" href="../assets/icons/apple-touch-icon.png" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type='text/javascript' src='http://code.jquery.com/jquery-1.4.4.min.js'></script> <SCRIPT LANGUAGE="JavaScript"> function setUser() { document.getElementById("user_label").innerHTML='<?php print $user ?>'; } function removeUser() { document.getElementById("user_label").innerHTML=''; } </SCRIPT> Any help of solving this would be appreciated... Thanks for your time!
  3. Ok miracle of miracles, I've figured it out, regarding the CSS it was the fact that the declaration block that I was referring it to within my CSS file had to be prefaced with a period rather than a hash symbol (which is rather odd given that the entity in question was an id for an AP Div Tag) Anyway now that that's done something else has popped up, more of a quandary than a problem but still nevertheless... For some reason no matter what the query is, in this case its //SQL Query $query = "SELECT user_name, thumbnail, url FROM users WHERE city = 'Melbourne'"; $result = @mysql_query($query); $row = mysql_fetch_array($result, MYSQL_NUM); $num_records = $row[0]; It never shows the first record of the block of users in the database, who are from Melbourne. I'm 87% sure that it's something really silly that I'm overlooking in the code but I just can't seem to find it! Here is my code <?php include "../../mysql/db_config.php"; //SQL Query $query = "SELECT user_name, thumbnail, url FROM users WHERE city = 'Melbourne'"; $result = @mysql_query($query); $row = mysql_fetch_array($result, MYSQL_NUM); $num_records = $row[0]; //$result2 = @mysql_query($query) or die($query."<br/><br/>".mysql_error()); if ($result) { // Build the Output Section Here $output = ''; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $character = $row["user_name"]; $url = $row["url"]; $thumb = '<img src="' . $row["thumbnail"] . '"</img>'; /*/////////////////////////////////////////////////////////////////////////////////////////// // SET UP CHARACTER DISPLAY MECHANISM // ///////////////////////////////////////////////////////////////////////////////////////////*/ $output .= '<div id="character_grid" class="character-grid"><a href="'. $url .'">' . $thumb . '</a></div>'; } } else { echo "Could not run query"; exit(); } ?>
  4. No I didn't realise that, so thanks for the update, but with all respect... it shouldn't be a stretch to consider that if I've posted a link to an external file, in my post that pertains to my question in the thread, that someone with common sense would open it to further understand what I hope to accomplish....
  5. below the php in the style tags, within the heads tags.... the php code is above everything on the page include the <DOCTYPE ......... >
  6. Ok, thank god, it's working.... this is the code <?php include "../../mysql/db_config.php"; //default Query String $queryString = "ORDER BY userID ASC"; //SQL Query $query = "SELECT user_name, thumbnail, url FROM users WHERE city = 'Melbourne' $queryString"; $result = @mysql_query($query); $row = mysql_fetch_array($result, MYSQL_NUM); //$result2 = @mysql_query($query) or die($query."<br/><br/>".mysql_error()); if ($result) { // Build the Output Section Here $output = ''; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $user = $row["user_name"]; $url = $row["url"]; $thumb = '<img src="' . $row["thumbnail"] . '"</img>'; /*/////////////////////////////////////////////////////////////////////////////////////////// // SET UP USER DISPLAY MECHANISM // ///////////////////////////////////////////////////////////////////////////////////////////*/ $output .= '<div id="character_grid">' . $thumb . '</div>'; } } else { echo "Could not run query"; exit(); } ?> The only problem I'm having now is with the output in that it's just a row of user icons in a vertical line.... How then would I go about altering the output to replicate this?
  7. Mate, this is driving me crazy, I've altered the PHP.ini file, that fine. But the problems arise when I try to adjust my logic, based off what I can extrapolate from your post... It's been a while since I've used PDO as in a 5 year window ... Anyway I've revisited my usual method of getting this done successfully but normally the output is of a tabular fashion rather than what I want here.... Regardless, this is the code pertaining to my usual method <?php include "../../mysql/db_config.php"; //default Query String $queryString = "ORDER BY userID ASC"; //SQL Query $query = "SELECT user_name, thumbnail, url FROM users WHERE city = 'Melbourne'"; $result = @mysql_query($query); //$result2 = @mysql_query($query) or die($query."<br/><br/>".mysql_error()); if (!$result) $row = mysql_fetch_array($result, MYSQL_NUM); { echo "Could not run query"; exit(); } // Build the Output Section Here $outputList = ''; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $character = $row["user_name"]; $url = $row["url"]; $thumb = $row["thumbnail"]; /*/////////////////////////////////////////////////////////////////////////////////////////// // SET UP USER DISPLAY MECHANISM // ///////////////////////////////////////////////////////////////////////////////////////////*/ $output .= '<div id="user_grid">' . $thumb . '</div>'; } ?> But now its displaying "Could not run Query"
  8. Thanks for the reply, regarding the alterations to the php.ini file I'm afraid that I don't have access to it. But in regards to the rest of your post, if you'd be so kind as to step me through it with the code I've provided... Sorry mate, it's been a while since I've used the PDO method...
  9. Ok I've been working on it and I have made some progress since my last post.... This is my logic so far from what has been posted here (thanks ginerjm) <?php include "../../mysql/db_config.php"; //default Query String $queryString = "ORDER BY userID ASC"; //SQL Query function SQL_Query() { $query = "SELECT user_name, thumbnail, url FROM users WHERE city = 'Melbourne'"; $result = $pdo->query($query); //$result2 = $pdo->query($query) or die($query."<br/><br/>".mysql_error()); if (!$result) $row = mysql_fetch_array($result, MYSQL_NUM); { echo "Could not run query"; exit(); } // Build the Output Section Here $output = ''; while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $user = $row["user_name"]; $url = $row["url"]; $thumb = $row["thumbnail"]; /*/////////////////////////////////////////////////////////////////////////////////////////// // SET UP USER DISPLAY MECHANISM // ///////////////////////////////////////////////////////////////////////////////////////////*/ $output .= '<div id="user_grid">' . $thumb . '</div>'; } } ?> and in the <body> section of my PHP document I have <?php print $output;?> but for some reason (probably something silly that I've overlooked) it's still not printing anything within the body of my page
  10. To be honest its getting there, thanks for the help so far..... Basically, this is what I'm after (this is my mock-up, sans the main CSS file) http://www.davidfattore.com/temp/index.php
  11. I've got the database locked down. .... Regarding the AP Div Tag as it stands in the mock up I have the thumbnails inside a 980px wide div tag, which is CSS basically positioning the thumbnails on the page.
  12. You kidding? I initially said that I had it mocked up using HTML and JavaScript. I need help on replicating it with PHP using a mysql database! Dude if I had it all figured out, I wouldn't have started the thread!
  13. yeah, an image (which is each user's display picture) ... 108px Wide by 108px high ... resting inside an AP Div Tag 980px wide The thumbnail images spread out evenly 8 thumbnails wide over a width of 950px with the 30px left over for my scrollbar.
  14. Hi Guys, I'm wondering if anyone knows how to design a users display page or can lead me to a tutorial on how to design a users display page that outputs the users in thumbnail form... So like for instance..... SELECT * FROM users WHERE state = Victoria; and then showing all the users that are from the State of Victoria in, say, 108px by 108px thumbnails .... eight thumbnails wide, with their username showing up in a separate label when you hover over the thumbnails .... I'll clarify it further if need be, but I've managed to mock it up in HTML and Javascript, I've just forgotten how to get it done using PHP. (I have the users my database already, just waiting there) Any help would be much appreciated! Cheers
  15. Hey guys, thank you immensely for all the support, the problem has been solved! It turns out it was a problem with the hosting provider, in that they had just recently upgraded there MySQL server version and PHP versions (don't ask why, as they clearly didn't provide any notice to any of their customers prior to the upgrade).
  16. Ok well I've reset everything to it's initial coding and now it still gives me the the Page Error but it also gives me this: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
  17. ok now the page doesn't display at all, the only thing is there is: Page ErrorThis page has been accessed in error.
  18. The code above is the entire code within my index.php file within the players directory
  19. <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="shortcut icon" type="image/x-icon" href="http://tournament.davidfattore.com/assets/icons/icon.ico"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>My Profile | Briscola Tournaments 2013</title> <link rel="stylesheet" href="../css/main.css" type="text/css"> <link rel="stylesheet" href="../css/profile.css" type="text/css"> <script type="text/javascript"> function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } </script> <style> #content_profile { position: absolute; width: 100%; height: 1306px; z-index: 2; background-image: url(../assets/background_profile.jpg); background-position:center; } #playerAvatar { position: absolute; width: 166px; height: 222px; z-index: 12; left: 2px; top: 2px; } #profile_header_badgeinfo { position: absolute; width: 268px; height: 201px; z-index: 2; left: 679px; top: 0px; } #profile_header_summary { position: absolute; width: 479px; height: 201px; z-index: 3; left: 184px; top: 2px; } #profile_header_username { position: absolute; width: 480px; height: 50px; z-index: 1; font-family: Nyala; font-size: 36px; } #profile_header_realname { position: absolute; width: 472px; height: 43px; z-index: 2; left: 4px; top: 54px; font-family: Tahoma; } #profile_header_blurb { position: absolute; width: 473px; height: 97px; z-index: 3; left: 4px; top: 104px; font-family: Tahoma; } #phpContent { position: absolute; width: 177px; height: 21px; z-index: 4; left: 3px; top: 178px; } #profile_header_level { position: absolute; width: 269px; height: 46px; z-index: 1; font-family: Tahoma; font-size: 24px; left: 3px; } #profile_header_favBadge { position: absolute; width: 262px; height: 102px; z-index: 2; left: 4px; top: 66px; background-image: url(../assets/players/favBadge.png); } #btnEditProfile { position: absolute; width: 200px; height: 38px; z-index: 3; left: 4px; top: 174px; } #profile_colomn_left { position: absolute; width: 672px; height: 825px; z-index: 1; top: 5px; left: 6px; font-family: Tahoma; font-size: 24px; color: #CCC; } #profile_colomn_right { position: absolute; width: 249px; height: 825px; z-index: 2; left: 683px; top: 5px; font-family: Tahoma; font-size: 24px; color: #CCC; } #badges_right { position: absolute; width: 250px; height: 136px; z-index: 1; font-family: Tahoma; } #apDiv3 { position: absolute; width: 250px; height: 295px; z-index: 2; top: 149px; } .profile_right_header_small { font-size: 18px; } .playerLevel { font-size: 20px; color: #FFFFFF; } #featBadge { position: absolute; width: 86px; height: 72px; z-index: 1; left: 9px; top: 4px; } #featBadge_name { position: absolute; width: 153px; height: 18px; z-index: 2; left: 95px; top: 23px; text-align: center; font-family: Tahoma; } #featBadge_XP { position: absolute; width: 106px; height: 20px; z-index: 3; left: 117px; top: 48px; text-align: center; font-family: Tahoma; } .xp_text { font-size: 12px; font-family: Tahoma; } #innerContent_1 { position: absolute; width: 655px; height: 223px; z-index: 1; background-image: url(../assets/players/innerContent_back.png); left: 8px; top: 5px; } #innerContent_1_header { position: absolute; width: 626px; height: 45px; z-index: 1; left: 12px; top: 12px; font-family: Tahoma; color: #4791c8; } .how_text { font-size: 11px; } a:link { color: #FFF; } a:visited { color: #FFF; } a:hover { color: #FFF; } a:active { color: #FFF; } </style> </head> <body> <div id="header"> <?php include ("../includes/header.php"); ?> <?php include ("../menu.php"); ?> </div> <div id="logo"> <?php include ("../welcome.php"); ?> <?php include ("../logo.php"); ?> </div> <div id="content_profile"> <div id="container_profile"><!-- BSA AdPacks code --> <script src="http://code.jquery.com/jquery-1.6.3.min.js"></script> <div id="profile_header"> <div id="profile_header_content"> <div id="phpContent"> <div align="center"> <?php if((isset($_GET['id'])) && (is_numeric($_GET['id']))) { //accessed through viewusers. $id = $_GET['id']; } elseif ((isset($_POST['id'])) && (is_numeric($_POST['id']))) { //form has been subbed. $id = $_POST['id']; } else { //print '<h2> Page Error </h2>'; //print '<p class=error> This page has been accessed in error. </p>'; } ?> <?php mysql_connect("localhost", "davidfat", "DsSkXq2n") or die(mysql_error()); mysql_select_db("davidfat_tournaments") or die(mysql_error()); // require ('mysql_connect.php'); //PROFILE QUERY $query = "SELECT userID, username, password, first_name, last_name, email, gender, blurb, points, games_played, games_won, badges_earned, tournaments_won, dob_day, dob_month, dob_year, dp, badgeID, badges, unlocked, feat_badge, feat_badge_name, feat_badge_xp, level, administration, registration_date FROM users WHERE userID = $id"; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result, MYSQL_NUM); ?> </div> </div> <div id="profile_header_summary"> <div id="profile_header_username"> <?php //USERNAME print '"'. $row[1] .'"'; ?> </div> <div id="profile_header_realname"> <?php print "" . $row[3] . " " . $row[4] .""; ?> </div> <div id="profile_header_blurb"><?php print '<i>'. $row[7] .'</i>'; ?></div> </div> <div id="playerAvatar"><div align="center"> <?php //DISPLAY PICTURE echo '<div class="style30" align="center"><img src="'. $row[16] .'"></img></div>'; ?> </div> <div id="profile_header_badgeinfo"> <div id="profile_header_level"> <table width="269" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="83" height="41">LEVEL:</td> <td width="42" align="center" background="../assets/players/levelCircle.png" class="playerLevel"><?php print $row[23]; ?></td> <td width="144" align="left"><table width="139" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="98" align="right" class="how_text">How do I earn XP?</td> <td width="27" align="right"><a href="#"><img src="../assets/help-icon.png" alt="" width="16" height="16" /></a></td> </tr> </table></td> </tr> <tr> <td height="5" colspan="3"><img src="../assets/divider.png" width="266" height="5" alt="" /></td> </tr> <tr> <td height="17" colspan="3" align="center" valign="bottom" class="xp_text">149 XP to Reach Level 11</td> </tr> </table> </div> <div id="profile_header_favBadge"> <div id="featBadge"> <div align="center"> <?php print '<img src="' . $row[20] . '"></img>'; ?> </div></div> <div id="featBadge_name"> <?php print $row[21]; ?> </div> <div id="featBadge_XP"> <?php print $row[22]; ?> </div> </div> <div id="btnEditProfile"><a href="#"><img src="../assets/players/btnEditProfile.png" width="105" height="35" /></a></div> </div> </div> </div> <div id="profile_content"> <div id="profile_colomn_left"> <div id="innerContent_1"> <div id="innerContent_1_header">Recent Game Activity</div> </div> </div> <div id="profile_colomn_right"> <div id="badges_right">Badges: <?php print $row[11]; ?> <br /> <hr width="99%" size="1" /> <?php print $row[18]; ?></div> <div id="apDiv3"> <table width="250" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="169" height="37" class="profile_right_header_small">Games Played:</td> <td width="67" class="profile_right_header_small"><?php print $row[9]; ?></td> </tr> <tr> <td height="34" class="profile_right_header_small">Games Won:</td> <td class="profile_right_header_small"><?php print $row[10]; ?></td> </tr> <tr> <td height="35" class="profile_right_header_small">Series Won:</td> <td class="profile_right_header_small"><?php print $row[12]; ?></td> </tr> </table> </div> </div> </div> </div> <p> </p> </div> </div> <?php include("../footer.php"); ?> </div> </body> </html>
  20. all that is in the players directory is the index.php and a players.php file, which lists the the players of the tournaments
  21. no there isn't a second .htaccess file within the players directory. It's strange because it was working 24 hours ago and that index page hasn't been altered, only the database info has and I do that remotely.
  22. its basically a subdomained website in a sub-directory under "davidfattore.com"... the directory is labled as "tournaments" and there is a directory within that labled "players"
  23. That is all that is in my .htaccess file # BEGIN WordPress <IfModule mod_rewrite.c> SetEnv TZ Australia/Melbourne RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
  24. At any rate I know the exact culprit; it IS the aforementioned code being that if I replace the "WHERE userID = $id" with "WHERE userID = 1" in the SQL query, it works perfect.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.