Jump to content

McMaster

Members
  • Posts

    55
  • Joined

  • Last visited

Everything posted by McMaster

  1. Josh! Thank you very much That worked a treat for me. Appreciate that.
  2. Hi! I have a javascript function that loops through certain elements on a page and add's the elements up. For example, element 1 value is 20 and element 2 value is 10. The alert in the loop should be showing 20 and then 10, but it just shows undefined20.00 and the stops? Here is my function... function updatePrice(couponPrice,couponQuanity,whichPrice,howMany) { var price = couponPrice * couponQuanity; var x; var ptotal; var myItems = new Array(); document.getElementById(whichPrice).innerHTML=price.toFixed(2); for (x=1;x<howMany+1;x++) { myItems[x] = document.getElementById('totalPrice' + x).innerHTML; ptotal+=myItems[x]; alert(ptotal); } }
  3. Hi! I've recently bumped in to this strange problem that is doing my head in and so I thought I'd post here in the hope that someone can help me out here. I have a few images on the home page of my website and when I hover over these images a nice opacity appears over the image. The problem I am having is that when I mouse over on certain images, the main image seems to jump to the right a couple of pixels. Here is the link so you can see what I mean... http://tinyurl.com/ckfo7mn The 2 images that jump (very top one and very bottom one) aren't linked, whereas the image inbetween does have a link and causes no problems at all? Hmmm... Can anyone help shed some light on this as I'm racking my brains here. Thanks
  4. Do you know where I could find a function to do this? I'm really strugglinh here.
  5. I don't suppose you could have some sort of function that could help me out here. I've bee racking my brains here with this.
  6. Okay guys, On to my hated regular expressions lol. I'm having a problem here. I've been building a comment system and I want links to be converted to actual clickable URL's. I have this working but only if http:// is within the comment the user has posted. Here is my expression. return preg_replace('!(((f|ht)tp://)[-a-zA-Z?-??-?()0-9@:%_+.~#?&;//=]+)!i', '<a href="$1">$1</a>', $text); Anything I can do here so it accepts both http:// and just www (without http) Thanks in advance ATB
  7. Had a brainwave but probably not right... Wouldn't it be possible to use ctype_alpha() along with ctype_digit() ?
  8. Hi, Recently I've been working on a comment system but I'm experiencing a problem. People can post with just spaces and not actual characters / numbers. Is there any way around this? Thanks in advance. ATB
  9. Well, when I click on the text input field and enter some text and then view the source code, the value of "human" is still set to 0, even when I refresh the source page.
  10. I am trying to change the value of the "human" field to 1 when the name field is onfocus but I cannot seem to get it to work. Here is the code I have for it... <form action="process.php" method="POST"> <input type="text" name="name" onfocus='document.getElementById("human").value="1"' /> <input type="hidden" name="human" id="human" value="0" /> <input type="submit" value="go" /> </form> Any help appreciated.
  11. What query is running through the $result2 variable?
  12. This normally appears when a variable isn't set properly so you may need to edit the source (well, the line with the error to be precise). Another solution is to suppress warnings. Add this line of PHP code to the source... error_reporting (E_ALL ^ E_NOTICE);
  13. It clearly says in the original users post "I've made a webpage that displays data taken from SQL" .. maybe MySQL/MSSQL who knows but I am pretty sure they got the idea of what I was saying. Nesting tables is not bad practice at all although it can be tricky if you nest a lot as there will be a lot of code. A nested table can position just as good as CSS so wherever you got the idea of CSS is for positioning and not tables is a lot of crap lol.
  14. Your new response makes even less sense, especially since I'm pretty sure the OP isn't using MySQL, and this is a topic about html/css not sql. The user is reading records from the sql database to feed the table... check their original code.
  15. <table> <tr> <td> <!-- THIS IS TABLE 1 (LEFT) --> <table border="1" BORDERCOLOR=Black style=width:300px >'; <tr> <th bgcolor = "LightBlue">Name</th> <th bgcolor = "LightBlue">Sales Volume</th> <th bgcolor = "LightBlue">Year</th></tr>'; </tr> <?php while($row = sqlsrv_fetch_array($results, SQLSRV_FETCH_ASSOC)) { echo '<tr>'; echo '<td >' .$row['NAME'].'</td>'; echo '<td>' .$row['SalesVolume'].'</td>'; echo '<td>' .$row['Year'].'</td>'; echo '</tr>'; } ?> </table> </td> <td> <!-- THIS IS TABLE 2 (RIGHT) --> <table border="1" BORDERCOLOR=Black style=width:300px >'; <tr> <th bgcolor = "LightBlue">Name</th> <th bgcolor = "LightBlue">Sales Volume</th> <th bgcolor = "LightBlue">Year</th></tr>'; </tr> <?php while($row = sqlsrv_fetch_array($results, SQLSRV_FETCH_ASSOC)) { echo '<tr>'; echo '<td >' .$row['NAME'].'</td>'; echo '<td>' .$row['SalesVolume'].'</td>'; echo '<td>' .$row['Year'].'</td>'; echo '</tr>'; } ?> </table> </td></tr> </table> Notice how I put 2 tables in 1 so now you have a left and right column. No float:left
  16. I misunderstood but I edited my reply
  17. Why not put a MySQL LIMIT on the first table and then another LIMIT on the second? You will also need to put both tables in 1 separate table.
  18. By the sounds of it you need a PHP tutorial Try reading up on it. If you have programming experience, it shouldn't be difficult.
  19. Yeah, but how exactly do I get the saved country to show in the select dropdown? That is my question.
  20. Hi, I have a search form where users can search by age and country. Users can also save their search so they can go back and do it again but the problem is when they reload their saved search, I need it to select the country that has been saved in the drop down. So if someone searched the United Kingdom, I need it to show United Kingdom in the select drop down instead of (Select Country). Is there any easy and quick way around this? Many Thanks
  21. I am using a javascript function to check whether a price field is numeric or not. Now the problem is that it won't let decimal points to go through. So, it's okay to do 100 but not 100.50. As you can see, it doesn't allow the decimal point. Does anyone have any idea what I should do to this function so it allows decimal points. Here is the code: <script type='text/javascript'> function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) { alert('You are only allowed to enter numbers.'); return false; } else { return true; } }
  22. Yeah I see what you are saying. Hmm, so how would I go about extracting those MONTH(), DAY(), and YEAR() functions from the query and echoing them on to the page?
  23. Thanks for your response. The thing is, the date is contained within 1 table field only. So Would I do something like: $sql = mysql_query = ("select Month(str_to_date(date,'%M %e, %Y %h:%i %p')), day(str_to_date(date,'%M %e, %Y %h:%i %p')), year(str_to_date(date,'%M %e, %Y %h:%i %p')) from recent_activity"); Also, this may sound silly but how exactly do I extract the month, day and year from that query? Would I just use something like mysql_result($sql)? Thanks
  24. Hey, I have a database with a date field that has the date in this format: August 2, 2010 11:04 pm I was wondering if it was possible to change this so I have the day, month and year in separate variables like this: $day = "2"; $month = "8"; $year = "2010"; Also notice how I have changed August to "8". I was wondering if there was an easy way around getting this done? Thanks in advance
×
×
  • 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.