Solved

Simple PHP question defining function for sql query

Posted on 2011-03-17
4
421 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 16

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now