[development] problem with db_query and menu call backs

Pooya pooya.source at gmail.com
Thu Sep 15 09:11:15 UTC 2011

I just wrote a module to send a report of all our online clients to
us(server) every time cron runs. In this situation I made both server and
client module in one drupal installation, to develop and test. I faced a
weired problem so here's my code(just lines u need to see).

this is a hook_menu for 'itaco_remote' which is the callback of server
module. Then 'itacocms_report' item which I made to call a function and test
reporting, this one will be in client module and will be removed, so I call
it in cron.
*function itacocms_menu() {
  $items['itaco_remote'] = array(
    'page callback' => 'itacocms_itaco_xml',
    'access arguments' => array('access content'),
    'page arguments' => array(1,2,3,4,5,6,7,8,9,10,11),
    'type' => MENU_CALLBACK,
  $items['itacocms_report'] = array(
    'page callback' => 'itacocms_itaco_report',
    'access arguments' => array('access content'),
  return $items;

this function is called when 'itaco_remote' page is requested, calling with
*function itacocms_itaco_xml($name='name', $url='url', $key='01',
$phone='01', $email='email', $date='date', $major='01', $build='01',
$address='address', $reseller='reseller', $report_time='01010101'){
  $result=db_query("INSERT INTO {itacocms_report} (name, url, key, phone,
email, date, major, build, address, reseller, report_time) VALUES
('%s','%s', %d, %d,'%s','%s', %d, %d,'%s','%s', %d)", $name, $url, $key,
$phone, $email, $date, $major, $build, $address, $reseller, $report_time);

This one is where I used 'drupal_http_request()' and send the data I need,
to above function using GET method.
*function itacocms_itaco_report(){
  global $base_url;
  $request_url = 'http://localhost/poosheshrah.com/itaco_remote'.

// Send the request.
  $result = drupal_http_request($request_url);

Problem here is when I open 'example.com/itacocms_report' and it sends the
request to 'itaco_remote' db_query doesn't work at all and nothing's
inserted in database. Is there something wrong with my drupal_http_request()
or db_query()?

I tried to debug this and using print and devel module but couldn't find the
also made a topic here http://drupal.org/node/1280106
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110915/5851f7a5/attachment-0001.html 

More information about the development mailing list