Posted by vsolmyr on February 21, 2013 at 1:38pm
greetings, i am new @ drupal and i am trying to make a connection to my db from a blank page. so far, i have used the mysqli, db_query and some other commands that i have read. But everytime I get the following error: Fatal error: Call to undefined function. for example: Fatal error: Call to undefined function db_query(). I have tried to require the "include files" but it doesn't work.
any suggestion?
thank you
Comments
Do you mean a real blank page?
Do you mean a real blank PHP page or a Drupal blank page? If you are talking about an actual blank PHP page then yes none of your functions are going to be available- there is nothing to integrate your page within the Drupal system. Your best bet to get started if you just want to see some results is to use a simple page or block module (there are many examples out there) which will be integrated into the Drupal system or add some PHP code to a block using the PHP filter mode ( go to structure>blocks>add block select 'PHP code' in the 'text format' dropdown and add some code) (though do this only as a simple way to see results- it is not the recommended way of adding custom code).
thank for your reply. i will
thank for your reply. i will try to create a module.
Try this simple example
No worries- as I say plenty of examples out there but think this one is very basic and very easy
Simple module
Personally I recommend first
Personally I recommend first understanding what you can do with Drupal without writing any code.