mdnghtblue
Members-
Posts
47 -
Joined
-
Last visited
Never
Everything posted by mdnghtblue
-
You could try creating a class for that td cell and setting the height in CSS...that's what I'd do, anyway. =/
-
http://ict.cas.psu.edu/Training/instrmats/dreamweaver/ImageProp.html Look at the heading called "Src".
-
Um, it doesn't sound like you've looked at the code yet. With PHP, most of the action happens behind the scenes, so there isn't much you can do without going through the code. There should be a button near the top of the page for "Code View" on Dreamweaver...from then on, just search Google for tutorials on PHP and come back if you have more questions.
-
Question regarding pulling info from a database...
mdnghtblue replied to mcclellanfsu's topic in PHP Coding Help
I'm not sure what all the "$sql->" stuff is, but this is how I would write it: if ($action == "main" || $action == "") { $width = "width:100%"; $text .= " <div style='text-align:center'> <table style='".$width."' class='fborder' cellspacing='0' cellpadding='0'> <tr> <td style='width:80px' class='forumheader3'>".UM_LANG_RANK."</td> <td style='width:200px' class='forumheader3'>".UM_LANG_AANAME."</td> <td style='width:150px' class='forumheader3'>".UM_LANG_UNIT."</td> <td style='width:150px' class='forumheader3'>".UM_LANG_POSITION."</td> <td style='width:100px' class='forumheader3'>".UM_LANG_STATUS."</td> <td style='width:80px' class='forumheader3'></td> </tr>"; $query = mysql_query("SELECT * FROM tbl_team_roster ORDER BY soldier_id;"); $ranks = mysql_fetch_array(mysql_query("SELECT rank_obr FROM tbl_rank_assignment ORDER BY rank_id;")); while($row = mysql_fetch_array($query)){ $text .= " <tr> <td style='width:80px' class='forumheader3'><img src='images/smrank/".current($ranks)."' alt = 'Rank'></img></td> <td style='width:100%' class='forumheader3'>".$row['soldier_aaname']."</td> <td style='width:80px' class='forumheader3'>".$row['soldier_combat_unit']."</td> <td style='width:100%' class='forumheader3'>".$row['soldier_cposition']."</td> <td style='width:80px' class='forumheader3'>".$row['soldier_status']."</td> <td style='width:100%' class='forumheader3'><a href='index.php?details.".$row['soldier_id']."'>".UM_LANG_DETAILS."</a></td> </tr>"; next($ranks);} $text .= "</table> </div>"; $ns -> tablerender("3rdSFG Roster", $text); require_once(FOOTERF); I'm not completely sure that'll work though. >.< -
Heh, no problem. Should've noticed that myself...>.<
-
Why doens't my script work? Help much appreciated
mdnghtblue replied to DeepakJ's topic in PHP Coding Help
Just a note: if ($boolean=false){ echo "The customer does not have enough licenses."; should probably be if (!$boolean){ echo "The customer does not have enough licenses."; -
I don't see a field called "answer" in the above code...
-
if (!sqleval("SELECT * FROM buddies WHERE uid='$uid' AND bid='$bid';")) { // No records updated, so add it $query = mysql_query("INSERT INTO buddies (uid, bid) VALUES ('$uid', '$bid')"); print "Buddy Added"; } Hope that works.
-
I'm not sure you can pass variables like that...I might be wrong. If you want to pass the variable with a URL, I think it has to be part of the URL. Otherwise, put the input field in a form, and use a submit button. That will definitely work.
-
if ( $errorcodes[$i] == "ok" && $error == "0" ) { Don't put quotes around the 0, it thinks you mean a string, when it's an integer.
-
I'll try putting in some test code in to see how it works. The code that stops "com" from being used has got to be in the code I posted above. I couldn't find it in the swearwords array, so I thought it was hidden in one of the regular expressions. The filter thinks "com" is "cum", so when someone tries to use an email address or URL with "com" in it, they'll get the following error message: Profanity (even words like 'cum') is not allowed in the game!
-
bump
-
bump Anyone have any ideas or explanations? I've been trying to understand this on my own, not working. =/
-
Still kind of a newbie to this stuff....I've been trying to figure this out for a while. This is what I want to do: 1. pull a query from the database, "ORDER BY disabled ASC, networth DESC" 2. check every user's info from the query, to see if they have a certain "ability" enabled 3. if they do, perform a calculation on networth, and put it back into the array/query (not sure what to call it at this point) 4. reorder the array/query by "disabled ascending, networth descending" This has been driving me nuts, I feel like it's got to be possible. I'm running into a couple problems, which is due to lack of complete knowledge of how PHP works. =/ First, the "calculations" I'm performing on those certain users aren't being stored, and I'm pretty sure the sorting isn't working either. I tried to use array_multisort, but I'm not sure it's working. $users = dbquery("SELECT disabled, networth, num, rank, ability, abilitytime FROM $playerdb ORDER BY disabled ASC, networth DESC;"); mysql_data_seek($users, 0); while($user = mysql_fetch_assoc($users)) { if($user[ability] == 50) { $fakenw = $user[networth]; for($i=0; $i < $user[abilitytime]; $i++) $fakenw -= ($fakenw * 0.01); $user[networth] = round($fakenw,0); } } mysql_data_seek($users, 0); $user = mysql_fetch_assoc($users); foreach($user as $key => $row) { $disabled[$key] = $row['disabled']; $networth[$key] = $row['networth']; } array_multisort($disabled, SORT_ASC, $networth, SORT_DESC, $user); I don't think I have any idea what I'm doing. =(
-
Amazing.... can you explain what was wrong before? I just didn't call the loop the right way?
-
Very simply: $my_query = mysql_query("SELECT * FROM churchinfo;"); while($info = mysql_fetch_array($my_query)) { print "$info[name]<br>"; print "$info[email]<br>"; print "$info[age]<br><br>"; } The first line sends a query to the database, to select all info from a table called "churchinfo". This is stored in $my_query. Right now, $my_query is kind of like a two-dimensional array, holding rows of arrays with your information. To get the information for each row, use a while loop and mysql_fetch_array(); So if your database table is something like this: Name Email Age John john@blah.com 24 Mary mary@blah.com 35 Bob bob@blah.com 27 Your output from the while loop will look like this: John john@blah.com 24 Mary mary@blah.com 35 Bob bob@blah.com 27 Hope that explains something. >.< Someone out there can probably do a better job.
-
I have a form with a list of items on a "market", and users can choose which and how many items to buy by filling in any of the fields and then clicking the submit button. Every input field is coded like this: <input type="text" name="buy[<?=$item[id]?>]" size="6" value="0"> In the form handler function, I go through each value in buy[]: $i = 0; foreach($buy as $val) { print "amount $i = $buy[$i]"; // debug if($buy[$i] != 0) buyItems($i, $buy[$i]); $i++; } The problem is that it doesn't go through every value, it stops after about 20 array values or less. (the first time I noticed this, it only went through about 20 array spots, right now it's at about 12, it keeps going down) I checked to see if those other array values are just not going through the foreach loop, but those array spots don't exist. How come those fields aren't being put into the array?
-
Which PHP-Editor do you think is the best?
mdnghtblue replied to briananderson's topic in Miscellaneous
Eh, I do all my Java and PHP stuff on Textpad. Haven't really bothered looking around for a better editor. -
18, female, college student in Florida, majoring in Computer Science. Yep, rare. =p I started learning HTML when I was 13, and started programming when I was 15. I know how to program in C, Java, PHP, Flash/Actionscript and know a bit about Javascript, C++, Ruby, VB and ASP. A lot of people don't expect me to be interested in computers or programming, but my dad's a programmer and my mom's Asian, so I got the best of both. =p
-
I don't know much about regular expressions, and I'm trying to figure something out. I didn't write the following code: $altbegin[] = "/([^\^\.\+\[\] ])/i"; $altend[] = "(\\\*|#|\\\^|\\1)([\.\_\~\`\+\=\* \-]*)"; $altbegin[] = "/uc/i"; $altend[] = "(uc|u|cu|\*|\*c|u\*)"; $altbegin[] = "/a/i"; $altend[] = "[a@ÁÂÃÄÅàáâãäå]"; $altbegin[] = "/b/i"; $altend[] = "[bß]"; $altbegin[] = "/c/i"; $altend[] = "[c©Çç\(\{\[]"; $altbegin[] = "/d/i"; $altend[] = "(d|Ð|ð|\|\))"; $altbegin[] = "/e/i"; $altend[] = "[eÆÈÉÊËèéêë3]"; $altbegin[] = "/f/i"; $altend[] = "[fƒ]"; $altbegin[] = "/g/i"; $altend[] = "[g9]"; $altbegin[] = "/h/i"; $altend[] = "(\|-\||[h])"; $altbegin[] = "/l/i"; $altend[] = "(£|i)"; $altbegin[] = "/i/i"; $altend[] = "[il|\\\/!ÌÍÎÏìíîï]"; $altbegin[] = "/j/i"; $altend[] = "(_\||[j])"; $altbegin[] = "/k/i"; $altend[] = "(\|\(|\|\(|[k])"; $altbegin[] = "/m/i"; $altend[] = "n"; $altbegin[] = "/n/i"; $altend[] = "(\|\\\\\\\\\||[mnÑñ])"; $altbegin[] = "/o/i"; $altend[] = "u"; $altbegin[] = "/u/i"; $altend[] = "[ou0ÒÓÔÕÖòóôõöÙÚÛÜØøùúûüµ]"; $altbegin[] = "/r/i"; $altend[] = "[r®]"; $altbegin[] = "/s/i"; $altend[] = "[s\$§]"; $altbegin[] = "/y/i"; $altend[] = "[yÿýÝ]"; $altbegin[] = "/^\(\\\\\\*\|#\|\\\\\\^\|/i"; $altend[] = "("; $swear_words = Array([insert swear words here]); function swearCheck(&$str) { global $config, $altbegin, $altend, $swear_words; $str = ereg_replace("\"",""",$str); $str = strip_tags($str,"<em><b><i><u><font><strong><h3><p><li><ul>"); $str2 = "- ".stripslashes(strip_tags($str))." -"; $fs = "(".preg_replace($altbegin,$altend,"fucker").")*(".preg_replace($altbegin,$altend,"sucker").")*"; for ($i = 0; $i < count($swear_words); $i++) { $word = preg_replace($altbegin,$altend,$swear_words[$i]); if (eregi("(.+[^A-z])($word)$fs([^A-z].+)",$str2,$vars)) { TheEnd("Profanity (even words like '$swear_words[$i]') is not allowed in $config[servname]!<BR><b>Profanity found in the following context:</b><p>...".substr($vars[1],-100)."<b>$vars[2]</b>".substr($vars[count($vars)-1],0,100)."..."); } } } I know it's the swear filter, but I'm not really sure how it works. (and not sure what exactly is contained in the altbegin and altend arrays. The previous maintainer of this code added "com" to the filter (to prevent spamming), and now I want to take it out, but I didn't see in the $swear_words array. How do I remove it from the filter?
-
Truthfully, I think it looks nicer with the space there than without, since it's even on all sides...though I guess if you really really wanted it without the space, you could do margin-top: -2px on div#holder...not sure if there's a better way to fix it.
-
Okay, first of all, you're probably thinking why I'm creating a PHP forum when I can just download any of the hundreds of forums already out there. I'm maintaining a Promisance game (text/turned-based game) and recently implemented "in-game clan forums". The features are very simple, because it doesn't need anything really fancy, it just has to allow clan members to communicate with each other. I've been wanting to add the whole unread topics feature to the forums, but I have no idea how. I couldn't find any tutorials on PHP forums or anything close to what I'm looking for. I just want to know what the best and/or most efficient way is for coding unread topics. This place is pretty cool, I'm bookmarking it. =D