Solved

Simple PHP question defining function for sql query

Posted on 2011-03-17
4
432 Views
Last Modified: 2012-05-11
I am using x cart and trying to insert fields into a mysql database.  x cart continually uses this type code to insert data into the database

db_query("INSERT INTO $sql_tbl[newslist_subscription] (listid, email, since_date) VALUES ('$id','$email', '".XC_TIME."')");

I copied this directly from the include/register.php file and this is working code that comes with x cart

My problem is when I try to use db_query in the example below i get an error "Fatal error: Call to undefined function db_query()"

db_query("INSERT INTO $sql_tbl[customers] (fb_name, email, fb_uid) VALUES ('$fb_name','$email', '$fb_id')");       

Why is this?  How is db_query not defined elsewhere? it is being used everywhere within xcart
What am I missing?
0
Comment
Question by:jesterbone
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
Chris Harte earned 250 total points
ID: 35158628
Looks like db_query is a function of their own, it certainly not a php library function. The MySql equivalent is mysql_query and for ms is is mssql_query.

Check out the php site for database extentions

http://uk3.php.net/manual/en/refs.database.php
0
 

Author Comment

by:jesterbone
ID: 35158820
thanks but I am trying to understand xcart and how it works, so I was hoping someone with specific xcart knowledge would have some advice.
0
 
LVL 3

Assisted Solution

by:clinker83
clinker83 earned 250 total points
ID: 35164697
See what libraries are included at the top of the php file. The function should be found in one of those libraries.
0
 

Author Comment

by:jesterbone
ID: 35165742
Thanks I figured this out yesterday
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
array_values - reorder after unset? 5 21
php function to remove a file 31 39
Fulfillment API php code sample 1 40
How do uses indexes to maximize MySQL Searches 14 23
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question