Jump to content

[SOLVED] Strange issue with functions?


Solarpitch

Recommended Posts

Hey,

 

I generally set up a page called "database.php" which has all my database functions. When I started to write a new application this morning, I set one up but noting was being called from the database.php file. So I stripped everything down to this basic example and I still cant get it to work

 

<?php

//### database.php

function get_select(){

$select = "Test";
return $select;
}

//### test.php

include("database/database.php");

echo get_select();

?>

 

The page will just crash as soon as it hits the get_select() function. You can see how basic this is and it still wont retrieve from the database file. I tried to put error_reporting(E_ALL); but noting happens.

Link to comment
https://forums.phpfreaks.com/topic/137350-solved-strange-issue-with-functions/
Share on other sites

I know, the code seems perfect but at the moment... thats the only function I have in the database.php file! No other code could be breaking this apart from what you see there.

 

I dont even thinks it's something stupid at this stage because I's of well noticed it by now

Sorry asmith... what I mean by that is, anything after the function will not display. The page will simply get to the function and stop executing.

 

For example...

<?php

echo "Step 1";

echo get_select();

echo "Step 2";

?>

 

If I do this, Step 1 will print to screen but it wont get to Step 2

I just got off the phone to my host. Problem was, there was a change made on the .htaccess file yesterday so we could manage directory paths the way we wanted with a framework we are using.

 

I asked them to remove the rule and now the functions are working again. Weird tho, not sure why that would have had an effect on my functions.

 

PHP can be a mystery sometimes  ::) ... thanks for the help

Archived

This topic is now archived and is closed to further replies.

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