Solved

Simple PHP question defining function for sql query

Posted on 2011-03-17
4
412 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks I figured this out yesterday
0

Featured Post

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
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…
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.

743 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

11 Experts available now in Live!

Get 1:1 Help Now