Jump to content

c_shelswell

Members
  • Posts

    275
  • Joined

  • Last visited

    Never

Everything posted by c_shelswell

  1. ah right so autoload only loads the class when I instantiate it? great. Thanks
  2. Hi - I'm not sure if subject of this is really correct. What I mean is if I take one file and fill it full of all my: require('./class_user.php'); require('./class_session.php'); but don't actually call that class is this going to slow things down and use more memory or is the file effectively not read until i use $user = new user; and instantiate the class? Before i've just included the class at the top of the page that needs it just wondering if that's the best way Cheers
  3. nice one that's easy. Just the same as you would a link. Kind of feel stupid now didn't even think of that! Cheers
  4. Hi pretty simple question just don't know if it's possible and can't find much on it. I simply want to be able to do a Header("Location: ./page.php") but for it to show part way down page.php is this possible? Cheers
  5. found the solution! All i needed to do was use a fulltext search maybe this will help someone else: select * from table where match (field) against ('Fruitshop opens 7am') cheers
  6. Hi I've been looking about for this but can't seem to find an answer. I have a string that I need to search in the database for eg 'Fruitshop opens 7am' but my database field only says 'Fruitshop' I thought I could just use a search like: select * from table where field like %Fruitshop opens 7am% but that won't seem to find Fruitshop. Any ideas? Cheers
  7. cheers phpKnight. The number format seems to have sorted it. Though I still think kind of strange it should have to. Thanks
  8. yeah i did have them as decimal before. I assumed this might be the problem so changed it. It does it both ways. Strange thing is it has been working. Unless my web hosting people have gone and changed my mysql version but it's a dedicated server so i doubt it.
  9. Hi I've got a bit of a baffling problem. I'm trying quite simply to subtract two number pulled from my database. They're store in the DB as DOUBLE and the sum would equate to 0.49 - 0.49 the answer i'm getting though is: 5.55111512313E-17 I don't get it! This is working fine on my local machine but on the web server i'm not having much luck. Anyone seen a problem like this before?
  10. yeah that was my next plan. Still though I'm a bit confused why the data would go if the browser hasn't been closed. Cheers
  11. Hi, I've got a confirmation script made that sends an email with a link for a user to confirm their email. This all works pretty good with the exception of not being able to direct them to where they were going before they verified. For everything in the site I just use HTTP_REFERER which works great. I assumed I'd be able to do the same with this if I store it to SESSION. Providing the user doesn't close their browser I thought this should work? Apparently not though. My var is no longer there. Any one have any advice? Thanks very much.
  12. bit of a strange one. I had been getting results from this now all of a sudden i'm not. The query is working without errors it's just not returning. Here's the sql SELECT * FROM products WHERE MATCH(item_title, description) AGAINST ('saddle') Full text search is on and the word is in both the item_title and description. I'm just not getting anything back. Don't suppose anyone has any ideas? Cheers
  13. Hi I've a bit of a puzzle that perhaps someone knows better than me if not i'll keep hunting. I basically have two arrays with different fields in them that I need to display in date order. I was thinking the best thing to do would be to combine them then sort them then to display do a foreach on them. Question is how do I select which field the arrays get sorted by? both have a date field but with different titles i.e. crt_insert_date & claim_insert_date can I select to sort by both? Any ideas would be really great - thanks!
  14. Thanks for the reply. Thing is if i remove the [] I don't even get undefined I just don't get anything. I'm getting this: {"optionValue: 1":"optionDisplay: \u0027WELCOME GIFTS\u0027"} perhaps I'm formatting it wrong?
  15. Ok so i've take up previous advice and tried to use json.encode with my data but now all I get returning to my select box is 'undefined'. I know i'm getting results from my mysql query it just my select box isn't populating with the data. my code is: foreach ($cats as $k => $v) { $arr["optionValue: ".$v['id'].""] = "optionDisplay: '".$v[DEFAULT_LANG]."'"; } echo "[".json_encode($arr,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP)."]"; Then the javascript on the page with the select box is: $(function() { $("select#membersOrPublic").change(function() { $.getJSON("get_categories.php",{id: $(this).val(), ajax: 'true'}, function(j) { var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; if (j[i].optionValue == 0) { // no results have been returned } } $("select#categoryList").html(options); }) }) }) I'm afraid I'm not overly familiar with JSON so finding this one quite difficult to problem solve Cheers
  16. excellent that's exactly what i'll do. Thanks for the info. Love this forum somebody always knows the things you don't! Cheers
  17. Ok I've found what's causing it. One of the entries that is being populated is a test string of: 123456MOBcat"t"//\\''deü©ΣДçگẫ£$ which i presume is ballsing up my JSON? is there a way to format this to stop if from happening?
  18. Hi I can't figure this out. I'm populating a select box based on the selection of another. This is working fine on my machine but not online. Is there a reason this might happen. my jquery on the first page: $(function() { $("select#membersOrPublic").change(function() { $.getJSON("get_categories.php",{id: $(this).val(), ajax: 'true'}, function(j) { var options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; if (j[i].optionValue == 0) { // no results have been returned } } $("select#categoryList").html(options); }) }) }) and my get page $cats = $db->selectFromDB('site_categories', '', "where area='".$_GET['id']."'"); if (count($cats) > 0) { $json = "["; foreach ($cats as $k => $v) { $json .= "{optionValue: '".$v['id']."', optionDisplay: '".$v[DEFAULT_LANG]."'},"; } $json = substr($json, 0, -1); $json .= "]"; echo $json; } else { $json = "["; $json .= "{optionValue: '0', optionDisplay: 'NO CATEGORIES PLEASE CREATE ONE'}"; $json .= "]"; echo $json; } I'm not getting any errors from my get page just can't figure why it's not working online. any ideas? Cheers
  19. nice one - thanks. I'll take a look at this. It looks like it'll do the job anyway.
  20. this might be a stupid question but in trying to save some time i've come across a small problem. I've been adding data to my database (no problems here) some of the data string has a php echo CONSTANT in it though. so what's getting added to my database is: 'string string etc <?php echo CONSTANT; ?> string' I had hoped that when i retrieved it from the database and echoed it it might still print the constant. I was wrong. Is there anyway to do this? Hope this is clear even if it probably is a really weird question. Cheers
  21. Mate you are fantastic!! Thank you so much. Was so annoyingly simple too!
  22. Ok i'm getting this a little better. But does anyone know a way to get it to focus on the centre of the screen even if the page is scrolled down? Cheers
  23. Hi I've got a bit of code that seems to work fine in another site i've made but I can't seem to integrate it to a new site I'm working on. I had initially copied the code so I could have missed something. When a user clicks the link (in this case "test") the popup div should center itself vertically on the page. It seems to be horizontally doing it just fine. The function that should achieve this is "centerPopup". I've pasted all the code below this should be able to be loaded in to a browser fully. Can anyone see where i'm going wrong? Many thanks <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <style type="text/css"> #popupBackground{ display:none; position:fixed; _position:absolute; /* hack for internet explorer 6*/ height:100%; width:100%; top:0; left:0; background:#000000; border:1px solid #cecece; z-index:1; } #popupForm{ display:none; position:fixed; _position:absolute; /* hack for internet explorer 6*/ height: 200px; width:200px; background:#000; border:1px solid #555; z-index:2; padding:5px; } </style> <title>TEST</title> </head> <body> <script type="text/javascript"> $(document).ready(function() { var popupStatus = 0; function loadPopup() { if(popupStatus==0) { $("#popupBackground").css( { "opacity": "0.5" }); $("#popupBackground").fadeIn("slow"); $("#popupForm").fadeIn("slow"); popupStatus = 1; } } function disablePopup() { if(popupStatus == 1) { $("#popupBackground").fadeOut("slow"); $("#popupForm").fadeOut("slow") popupStatus = 0; } } function centrePopup() { var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight; var popupHeight = $("#popupForm").height(); var popupWidth = $("#popupForm").width(); $("#popupForm").css( { "position": "absolute", "top": windowHeight/2-popupHeight/2, "left": windowWidth/2-popupWidth/2 }); $("#popupBackground").css({ "height": windowHeight }); } $(".popupClick").click(function() { $("#popupForm").append("Got it"); centrePopup(); loadPopup(); }); $("#closePopup").click(function() { disablePopup(); }); $("#popupBackground").click(function() { disablePopup(); }); $(document).keypress(function(e) { if(e.keyCode==27 && popupStatus==1) { disablePopup(); } }); }); </script> <div class='title'></div> <h1>NEWS ITEMS </h1> <table id="table-1" cellspacing="4" cellpadding="4" border='0' width='100%'> <tr> <td style='border: 1px solid #333;' valign='top' height="100px"> <a href='#nogo' class="popupClick">Test</a> </td> </tr> <tr> <td style='border: 1px solid #333;' valign='top' height="100px"> <a href='#nogo' class="popupClick">Test</a> </td> </tr> <tr> <td style='border: 1px solid #333;' valign='top' height="100px"> <a href='#nogo' class="popupClick">Test</a> </td> </tr> <tr> <td style='border: 1px solid #333;' valign='top' height="100px"> <a href='#nogo' class="popupClick">Test</a> </td> </tr> <tr> <td style='border: 1px solid #333;' valign='top' height="100px"> <a href='#nogo' class="popupClick">Test</a> </td> </tr> <tr> <td style='border: 1px solid #333;' valign='top' height="100px"> <a href='#nogo' class="popupClick">Test</a> </td> </tr> <tr> <td style='border: 1px solid #333;' valign='top' height="100px"> <a href='#nogo' class="popupClick">Test</a> </td> </tr> </table> <div id="popupForm"></div> <div id='popupBackground'></div> </body> </html>
  24. cool will maybe give that a shot. Didn't know if it was something someone had tried already. Cheers
×
×
  • 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.