Jump to content

c_shelswell

Members
  • Posts

    275
  • Joined

  • Last visited

    Never

Posts posted by c_shelswell

  1. 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

  2. Hi I'm looking for someone to do a paypal website payments pro integration for me. I've made the site and done a basic paypal integration for it which is working fine but my customer wants the full customised payment page. I've really no experience with paypal pro and don't really have the time so I'm looking for someone who's done it before.

     

    Any takers? Could you PM me with an idea of cost/time.

     

    Cheers

    Chris

  3. 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

  4. 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?

  5. 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.

  6. 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

  7. 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!

  8. 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

  9. 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

  10. 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

  11. 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>
    
    

×
×
  • 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.