Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple PHP question defining function for sql query

Posted on 2011-03-17
4
Medium Priority
?
466 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
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 …

715 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