Some Questions Answered…
Sat, 10 June, 2006 – 11:10 am
Okay so further to my post on the Search Analytics Software I've run through my stats on their site and found a few searches on questions that I don't currently have the answers up to. So I figured I'd answer a few here (feel free to ask others that you think I might know the answer to in the comments - oh but I mean PHP type questions, not personal ones ;))
Strip the ampersand in PHP
Okay, to simply strip the ampersand out of a string you can use the str_replace() function by saying 'replace all ampersands with nothing' i.e.
< ?php str_replace(" & ", " ", $string); ?>
why the gaps around the ampersand? Because if you have an ampersand elsewhere, eg on a non-breaking space ( ) then it will remove the ampersand from that too! This is the single sign ampersand, but for those of you using valid markup then you'll want to remove the & instead, so just replace the & with & in the code above.
phpinfo.php returns blank screen
The easiest way to see if PHP is running correctly is to use the phpinfo() function. Quite simply you create a file with
< ?php phpinfo(); ?>
in it. Of course if it doesn't display a long page of detail about the PHP version and extensions you have installed, then there's something wrong. If PHP isn't running properly then you'll see the above code, however if it's a blank page then there's a few possibilities for this. The first is the easiest, have you got the right address? Have you put the file in the right place and got the right address. I mention the file as most people have PHP issues when they try to install it on their own computer. A friend of mine took days to realise he wasn't putting the test file into the correct directory, so everytime he went to it the page was blank. Why a blank page for a missing page? For some reason some servers return a blank page instead of a 404 page not found error when you try a PHP page that doesn't exist.
The other popular reason for a blank page being returned is that there are errors going on but in your php.ini file, the Error Reporting has been turned off so you cannot see the errors, so this needs checking on.
Amazon affiliate code not validating
Unfortunately most affiliate codes given out, not just from Amazon but everywhere, do not validate. Annoying when you have a nice validating XHTML strict page. But this one's easy, simply alter the code given to make it validate. There are usually two main issues, the javascript and the ampisands. The javascript either doesn't contain the type="text/javascript" or it DOES contain language="javascript" which it shouldn't. As for the ampisands, simple use & instead, this includes any URLs with an ampisand in them too.
So that's covered the questions I can answer, the others involved the weight of 2l of milk and the opening times of a JJB sports in a place in London, neither of which I know!


4 Responses to “Some Questions Answered…”
Sarah, 2L of milk weighs approx. 2KG
As for JJB - no idea.
By Peter on Jun 20, 2006
Heh thanks Peter, i wasn't sure on the milk. I know 2l of Water is 2kg, but wasn't sure if milk is heavier as it's denser.
By Sarah on Jun 20, 2006
So go experiment why don't you?
For those that simple can't improvise, here is a worksheet to follow:
http://www.beloit.edu/~SEPM/Wa.....rents.html
:o)
By A. N. Other on Jun 25, 2006
Really not that concerned to be honest, I got better things to wonder about! But ta for the link, if the questioner returns hopefully they'll find it.
By Sarah on Jun 25, 2006