-
Posts
476 -
Joined
-
Last visited
Everything posted by xProteuSx
-
I've got a navigation, that looks something like this: <table width="1200px" cellspacing="0" cellpadding="1"> <tr style="height: 40px;"> <td class="nav_home"><a href="index.html"><img src="images/btn_overlay.png" /></a></td> <td class="nav_gallery"><a href="money_gallery.html"><img src="images/btn_overlay.png" /></a></td> <td class="nav_articles"><a href="banknote_news.html"><img src="images/btn_overlay.png" /></a></td> </tr> </table> In the CSS, I have something like this: td.nav_home { background-image: url(images/btn_home.png); } td.nav_home:hover { background-image: url(images/btns_home.png); } td.nav_gallery { background-image: url(images/btn_gallery.png); } td.nav_gallery:hover { background-image: url(images/btns_gallery.png); } td.nav_articles { background-image: url(images/btn_news.png); } td.nav_articles:hover { background-image: url(images/btns_news.png); } So, the navigation is in a table with buttons being images, and when a column is being mouse-overed then the image changes to another, giving the navigation the appearance of a mouseover effect. Ofcourse, this works in every browser except for IE (God damn you microsoft!). Any ideas on how to get it to work? Cheers.
-
I've always had a hard time with this regex stuff! Thank you SO VERY MUCH for your help. I can't believe that its a 2 line function. I'm a little embarassed ... Thank you.
-
I have a really weird thing that I have to do, and I can't figure it out. I've tried about 1 million nested loops, and just can't get this to work. What I need to do is get the longest number from a string. So, for example, take the following: $string = "asdfasd234kjljlkjlj34659823423sadfasdadasdfasdfasd3242sdasddsda2"; function getNumber($a) { //do something with $string and return the longest number from it } so that ... echo getNumber($string); will return '34659823423' Thanks in advance, fellas! I've really been racking my brain there.
-
I ended up accomplishing what I needed by creating an array and producing a series of while, if, and for loops to sum and populate that data. However, I would still love to figure out how to accomplish the same task using SUM and GROUP BY. I tried, but I have never used SUM or GROUP BY before, and I could not get my query to work.
-
Actually, I could also use the child count as well for the parent account. So, in this case, the resulting query data should read like this: Record 1: 1 | 1 | 0 | NULL | 22 | 2 (sum of 22 from records 2 and 3, field[2], and count of 2 records where field[3] is equal to USR_ID from original table) Record 2: 1 | 1 | 12| NULL | NULL | NULL Record 3: 1 | 1 | 10 | NULL | NULL | NULL ???
-
I have a database, that contains two kinds of member accounts: primary, and secondary accounts (parents and children). All the info for both classes are stored in the same table, with a field called usr_parent = 0 for children and usr_parent = 1 for parents. Also, each user has a primary id field called usr_id. Each user also has, in the same table, a column called usr_money. However, only children can have a positive balance, and all parent accounts stay at a default value of 0. Also, each child has a field called usr_family with the usr_id of the parent (primary account) being stored here as a foreign key. So, for example: table1 USR_ID | USR_PARENT | USR_MONEY | USR_FAMILY 1 | 1 | 0 | NULL = parent account with primary id 1, 0 money, and a null family field 2 | 0 | 12 | 1 = child account with primary id 2, 12 money, and parent id 1 (first child of usr_id 1) 3 | 0 | 10 | 1 = child account with primary id 3, 10 money, and parent id 1 (second child of usr_id 1) What I am trying to do is to get all of the info from the table, as well as a SUM of all sub-account balances for anyone who is a parent! Something like this (???): SELECT * FROM table1 SUM(USR_MONEY) WHERE USR_ID = USR_FAMILY AND USR_PARENT = 1 Essentially, this is what I would like returned: Record 1: 1 | 1 | 0 | NULL | 22 Record 2: 1 | 1 | 12| NULL | NULL Record 3: 1 | 1 | 10 | NULL | NULL Records 2 and 3 do not contain the 5th field, because they are child accounts (USR_PARENT = 0) but Record 1 has the sum of the USR_MONEY fields for all users where USR_FAMILY is equal to the USR_ID of the parent account. Thanks in advance.
-
chriscloyd, You're right. This is what I've had to do. However, I am going to implement PFMaBiSmAd's fix, which seems more logical. However, this will affect my current data, as there are now several entries that contain the \ character. I will edit these by hand, as there are not that many. I have turned off get_magic_quotes_gpc() using an entry in my .htaccess file: php_flag magic_quotes_gpc Off So far it works on my XAMMP install. Hope I don't run into any BS on the actual site server. Thanks for the help.
-
PFMaBiSmAd, You are absolutely correct, the data is coming from a form, method=get. That having been said, there is definitely a '\' character in the database field. Now, you mentioned something about magic_quotes_gpc ... what is that? I don't know if its on, but by the sound of it, it is. What's that all about?
-
OK, let me make this more simple: How can I determine, using PHP, the date of the last Monday???
-
My reason for not using it is that I would have to go through my code, some 40+ pages, and thousands of lines of code to mysql_real_escape_string() and stripslashes() all pertinent data. Its a lot of work, plus inevitable I will miss some, and have to fix these issues as they come up ... Long story short, I want everything to work 100% right off the bat.
-
I am having trouble, because I am trying to enter a string, such as this into a database field: $string = "There's trouble ahead because they're silly."; Ofcourse, MySQL craps out because of the apostrophes. So I did this: $string = mysql_real_escape_string($string); This is entered into the database, however it is entered as this: "There\'s trouble ahead because they\'re silly." I was wondering how I can enter apostrophes, without entering a backslash, because now when I pull the text from the DB and display it on a page, I get a backslash in front of all apostrophes. HELP! Please! Is the only way around this to add slashes, then use stripslashes() when displaying text??
-
xyph, Sorry, yeah ... DATE type, not DATA type. Actually, the premise is to keep tabs on 'user scores' for the current week plus the previous four weeks. So here's the task: - determine current date - get last login date - if last login was previous to the last monday, but since 2 mondays ago (so its the first login of the week), do this: (week 0 = current week) week 1 = week 0 week 2 = week 1 week 3 = week 2 week 4 = week 3 week 0 = 0 - however, if the user has not logged in since 2 mondays ago, then you have to do this: week 2 = week 1 week 3 = week 2 week 4 = week 3 week 0 = 0 week 1 = 0 Is this explanation enough? Thanks
-
I am building a site that needs to update member accounts on a weekly basis. At the moment I have a cron job set for 12:01 am on Monday, that resets five database fields for all of my members. The first field is the current week, the second field is the previous week, the third field is from two weeks ago, the fourth field is from three weeks ago, and the fifth field is from four weeks ago. Obviously the cron job resets the first field to 0, and the data from this field is moved to field two (last week), and so on and so forth, and the data from the fifth field is just removed altogether. However, this is really not preferred, because if/when I get 1000+ users, the cron job will take up a crapload of CPU as many mysql queries need to be executed for each account. So, I am trying to implement a script that checks the last login date for a user, and if they have have not logged in since before the latest Monday, the Monday before that, the Monday before that, or the Monday before that, etc. I have never really worked with dates, so I don't even know how to begin. The last user login is stored as a DATA datatype in a mysql database, and is in the following format: YYYY-MM-DD. Thanks in advance!
-
Thanks very much guys. In the end, I did not even have to use the JOIN function of MySQL. I simply combined a WHERE and IS NOT NULL with RAND() and LIMIT. I'm going to have to look into this join stuff, though, because it seems like a very popular function. Either way, as suspected, I got the bonus of learning some new MySQL: I was not familiar with IS NOT NULL until now. Again, thank you.
-
I am not a MySQL guru: I only know some basics. I am hoping that someone can point me in the right direction, and I can learn something a little more complex. Here is my scenario: I have 2 tables. Table 1: user_id user_fname user_lname user_handle user_email Table 2: img_id_fk img_thumb Now, img_id_fk is a foreign key, that is equivalent to user_id. Therefore, if user_id = 15 in table 1, then table 2 will have an row with img_id_fk = 15 which holds a filename for an image associated with this user. Not everyone has an actual value for img_thumb. That is, that field may be blank. What I would like to do is select five random user_email's from table 1 and their associated values for the img_thumb field from table 2 but img_thumb cannot be blank. I don't know if I am explaining this clearly. Please let me know if I have to clarify anything else ... Thank you in advance.
-
Super cool. This works great. Thanks guys.
-
I have a div, like this: div.article { float: left; min-width: 310px; min-height: 150px; margin-left: 2px; margin-right: 2px; margin-top: 5px; background-color: #9c9c9c; border-style: solid; border-width: 1px; border-color: #000; } I would like to overlay another div, with identical dimensions. This second div would contain an semi-transparent image, that would overlay the contents of the article div. I have been trying to do this for so long, but I can't find anything that works. z-index, I know, but it just won't work for me. Help, please!!!
-
I have created a series of rectangles with rounded corners, using the following code: import flash.display.Sprite; import flash.display.Shape; var hp_box01:Shape = new Shape(); hp_box01.graphics.beginFill(0x006600, 1); hp_box01.graphics.drawRoundRect(0, 0, 200, 150, 12, 12); hp_box01.graphics.endFill(); addChild(hp_box01); All displays as it should. However, I am now unable to do the following: hp_box01.addEventListener(MouseEvent.CLICK, myFunction); It won't let me add an even listener to this shape. How can I convert the shape to a MC so that I can add event listeners to it?
-
I have an array, $old_array, that looks like this (each line is a different index): 1|1|0|20|0|0 1|2|0|20|0|0 1|3|0|20|0|0 1|4|0|20|0|0 1|5|0|20|0|0 1|6|0|20|0|0 1|7|0|20|0|0 33|3|0|15|0|0 33|4|0|15|0|0 33|5|0|15|0|0 34|1|0|15|0|0 34|2|3|15|0|0 34|3|2|15|0|0 34|4|3|15|0|0 34|5|0|15|0|0 34|6|2|15|0|0 34|7|0|15|0|0 It is an array of strings, which are exploded to create other arrays. Anyways, then I have a foreach loop like this: foreach($old_array as $val) { $check = substr($val, 0, strpos( $val,'|',strpos($val,'|')+1)); $array_temp[ $check ] = TRUE; } I am getting this error (ONLY IN INTERNET EXPLORER!): Warning: strpos() [function.strpos]: Offset not contained in string in /home/pgagnon/public_html/chores_uni.html on line 131 Line 131 is this one: $check = substr($val, 0, strpos( $val,'|',strpos($val,'|')+1)); Why does this work in Firefox, Opera, Safari, Chrome, but not IE?? Microsoft can eat shit until it dies!
-
ZOMG! I should have used <img src="" ... instead of <input type="" ... cuz there was no form!
-
OK, so I've read up on this on Google, but haven't found a solution ... As it turns out, if you have an image link within a div, Internet Explorer (blah! I think I'm going to be sick!) actually puts the image behind the div or rearranges the stacking order in some fashion (F U Microsoft!) and makes the link un-clickable. The DIV looks something like this: <div style="width: 250px; background-color: #2ebfe7; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -moz-border-radius-bottomleft: 5px; float: left; margin: 0px 10px 10px 60px; text-align: left; padding: 8px; clear: both;"> <p class="white">Add chores from the community chores database (universal list of chores) to your childs chore chart.</p> <center><br /><a href="chores_uni.html?childid=999&fname=Bob"><input type="image" src="images/btn_next_blue.png" style="margin-bottom: 10px;" /></a></br></br></center> </div> Ofcourse, this code works in ALL other browsers (Firefox, Chrome, Safari, Opera, etc.). Does anyone have a solution for this? I'm not familiar with z-index, if that's a solution at all, but I tried playing with it and could not figure this out! Thanks in advance.
-
Figured it out ... Changed this: if (document.markform['cmarked4[]']) { for (i = 0; i < document.markform['cmarked4[]'].length; i++) {document.markform['cmarked4[]'].checked = true ;} } To this: if (document.markform['cmarked4[]']) { if (document.markform['cmarked4[]'].length > 0) { for (i = 0; i < document.markform['cmarked4[]'].length; i++) {document.markform['cmarked4[]'].checked = true ;} } else {document.markform['cmarked4[]'].checked = true ;} }
-
I just realized that neither the Check All or Uncheck All buttons work if the array, as in 'cmarked4[], only has one index. The array must have at least two indexes, or else these buttons don't work. How do I get around this?
-
I have created a table with a series of checkboxes. At the bottom of the table there are 'Check All' and 'Uncheck All' buttons. For some reason, some of the boxes get checked, while some don't, and I can't figure out, for the life of me, why the ones that don't get checked aren't getting checked! Its driving me crazy! I know that this is an unformatted mess, but copy and paste it into a .html file, and see the problem for yourself (PLEASE!): <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script language="javascript"> function checkAll() { if (document.markform['marked[]']) { for (i = 0; i < document.markform['marked[]'].length; i++) {document.markform['marked[]'].checked = true ;} } if (document.markform['marked1[]']) { for (i = 0; i < document.markform['marked1[]'].length; i++) {document.markform['marked1[]'].checked = true ;} } if (document.markform['marked2[]']) { for (i = 0; i < document.markform['marked2[]'].length; i++) {document.markform['marked2[]'].checked = true ;} } if (document.markform['marked3[]']) { for (i = 0; i < document.markform['marked3[]'].length; i++) {document.markform['marked3[]'].checked = true ;} } if (document.markform['marked4[]']) { for (i = 0; i < document.markform['marked4[]'].length; i++) {document.markform['marked4[]'].checked = true ;} } if (document.markform['cmarked[]']) { for (i = 0; i < document.markform['cmarked[]'].length; i++) {document.markform['marked5[]'].checked = true ;} } if (document.markform['cmarked1[]']) { for (i = 0; i < document.markform['cmarked1[]'].length; i++) {document.markform['cmarked1[]'].checked = true ;} } if (document.markform['cmarked2[]']) { for (i = 0; i < document.markform['cmarked2[]'].length; i++) {document.markform['cmarked2[]'].checked = true ;} } if (document.markform['cmarked3[]']) { for (i = 0; i < document.markform['cmarked3[]'].length; i++) {document.markform['cmarked3[]'].checked = true ;} } if (document.markform['cmarked4[]']) { for (i = 0; i < document.markform['cmarked4[]'].length; i++) {document.markform['cmarked4[]'].checked = true ;} } } function uncheckAll(field) { if (document.markform['marked[]']) { for (i = 0; i < document.markform['marked[]'].length; i++) {document.markform['marked[]'].checked = false ;} } if (document.markform['marked1[]']) { for (i = 0; i < document.markform['marked1[]'].length; i++) {document.markform['marked1[]'].checked = false ;} } if (document.markform['marked2[]']) { for (i = 0; i < document.markform['marked2[]'].length; i++) {document.markform['marked2[]'].checked = false ;} } if (document.markform['marked3[]']) { for (i = 0; i < document.markform['marked3[]'].length; i++) {document.markform['marked3[]'].checked = false ;} } if (document.markform['marked4[]']) { for (i = 0; i < document.markform['marked4[]'].length; i++) {document.markform['marked4[]'].checked = false ;} } if (document.markform['cmarked[]']) { for (i = 0; i < document.markform['marked5[]'].length; i++) {document.markform['cmarked[]'].checked = false ;} } if (document.markform['cmarked1[]']) { for (i = 0; i < document.markform['cmarked1[]'].length; i++) {document.markform['cmarked1[]'].checked = false ;} } if (document.markform['cmarked2[]']) { for (i = 0; i < document.markform['cmarked2[]'].length; i++) {document.markform['cmarked2[]'].checked = false ;} } if (document.markform['cmarked3[]']) { for (i = 0; i < document.markform['cmarked3[]'].length; i++) {document.markform['cmarked3[]'].checked = false ;} } if (document.markform['cmarked4[]']) { for (i = 0; i < document.markform['cmarked4[]'].length; i++) {document.markform['cmarked4[]'].checked = false ;} } } </script> </head> <body> <form name="markform" method="post" action=""> <table width="675px" cellpadding="2" cellspacing="0" > <tr class="tableheader"><td><h4 class="header"> Chores from 3 Weeks Ago</h4></strong></td><td><center><h4 class="header">M</h4></center></td><td><center><h4 class="header">T</h4></center></td><td><center><h4 class="header">W</h4></center></td><td><center><h4 class="header">Th</h4></center></td><td><center><h4 class="header">F</h4></center></td><td><center><h4 class="header">Sa</h4></center></td><td><center><h4 class="header">Su</h4></center></td></tr> <tr style="background-color: #8cccd3;"><td> Brush teeth</td><td></td><td><center><input type="checkbox" name="marked3[]" value="0" /></center></td><td><center><input type="checkbox" name="marked3[]" value="1" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td></tr><tr style="background-color: #addce1;"><td> Clean back yard</td><td></td><td></td><td></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td></tr><tr style="background-color: #8cccd3;"><td> Do your homework</td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td></td></tr><tr style="background-color: #addce1;"><td> Empty the trash cans</td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td></tr><tr style="background-color: #8cccd3;"><td> Feed the family pets</td><td><center><input type="checkbox" name="marked3[]" value="18" /></center></td><td><center><input type="checkbox" name="marked3[]" value="19" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td></tr><tr style="background-color: #addce1;"><td> Wash the dishes</td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td></tr><tr style="background-color: #8cccd3;"><td> Make the bed</td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td></tr><tr style="background-color: #addce1;"><td> Play an instrument (1hr)</td><td></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td></td><td></td><td></td></tr><tr style="background-color: #8cccd3;"><td> Go to sports practice</td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td></td><td></td></tr><tr style="background-color: #addce1;"><td> Prepare a meal</td><td></td><td></td><td></td><td></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td></tr><tr style="background-color: #8cccd3;"><td> Brush your hair</td><td><center><input type="checkbox" name="marked3[]" value="40" /></center></td><td><center><input type="checkbox" name="marked3[]" value="41" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td></tr><tr style="background-color: #addce1;"><td> Clean your bedroom</td><td></td><td></td><td></td><td></td><td></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td></tr></tr><tr style="background-color: #8cccd3;"><td> Bark at the moon</td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_faded.png" /></center></td><td><center><img src="images/checkbox_checked_faded.png" /></center></td><td><center><input type="checkbox" name="cmarked4[]" value="5" /></center></td></tr></table> <br /> <img src="images/btn_check_all.png" onClick="checkAll()" /> <img src="images/btn_uncheck_all.png" onClick="uncheckAll()" /></form> </body> </html>
-
Found an answer on the internet. Have to change filed to: field = document.markform['marked[]'];