Call To Undefined Function Db_Query()

I created my own ajax cal in details.tpl for that ajax cal i create one php file(“Reminder.php”) and i place this php file in custom folder in the following path(“cscart/custom”).In reminder.php i wrote db_query() for inserting data into database but it show some error message “call to undefined function db_query() in reminder.php”…otherwise how can i access the $config array with in the reminder.php page please help me…thanks in advance

Hi,

Please explain what do you won’t to do with ajax request and i will help you creating the structure and files ;)





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

i want to store the json data into database i tried db_query() for inserting but it shows some error message “call to undefined function db_query()” and even i cant access the $config array in my reminder.php.please help me to insert json data into database

Please create



#file [color=#ff0000]app/addons/my_changes/controllers/frontend/reminder.php[/color]



#content
if (!defined('BOOTSTRAP')) { die('Access denied'); }

if ($mode == 'insert') {

$vars = array();
$vars['var_name_1'] = $_REQUEST['var_name_1'];
$vars['var_name_2'] = $_REQUEST['var_name_2'];
$vars['var_name_3'] = $_REQUEST['var_name_3'];
#...

$id = db_query("INSERT INTO ?:table_name ?e", $vars);

echo 'Done - '.$id;
exit;
}





#request url
http://www.example.com/index.php?dispatch=reminder.insert




I hope that helps,





Valentin

[color=#808080][size=2]part of hungryweb.net[/size][/color]

vali i tried what you have said like that but its not displaying any thing in my local…it shows only empty page

i tried the suggested solution in windows Operating system with php version 5.4.4 it displays empty page



Then I tried the suggested solution in our server with Centos-6, cs-cart version is 3.0.3 PROFESSIONAL, php version is: 5.3.3 it displays the following message"[color=#061C68][font=Arial, Helvetica, sans-serif][size=1][center][size=5]The page you are looking for, might have been removed or is temporarily unavailable.!!"[/size][/center][/size][/font][/color]





Please suggest any solution

The script above is for v4 :D



For v3 please follow



#file [color=#ff0000]addons/my_changes/controllers/customer/reminder.php[/color]



#content```php

<?php

if ( !defined('AREA') ) { die('Access denied'); }

if ($mode == 'insert') {

$vars = array();
$vars['var_name_1'] = $_REQUEST['var_name_1'];
$vars['var_name_2'] = $_REQUEST['var_name_2'];
$vars['var_name_3'] = $_REQUEST['var_name_3'];
#...

$id = db_query("INSERT INTO ?:table_name ?e", $vars);

echo 'Done - '.$id;
exit;
}

```

#request url```php
http://www.example.com/index.php?dispatch=reminder.insert
```

I hope that helps,

---
Valentin
[color=#808080][size=2]part of hungryweb.net[/size][/color]

thanks vali its working

You are welcome