Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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