Solved

Simple PHP question defining function for sql query

Posted on 2011-03-17
4
453 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 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