Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

php/sql query syntax

Posted on 2008-10-07
5
Medium Priority
?
836 Views
Last Modified: 2013-12-12
Hello, i am running joomla 1.0.15,  using fabrik 1.0.6, a form building component for Joomla, it gives the option of having the form perfom a php command - eq an sql query upon submission.

I was wondering if you could give me the proper structure for such a command

this is a sample sql query which I have run successfully from phpmyadmin

INSERT IGNORE INTO `jos_users` ( `name`,`username`)
(SELECT namel_newsletter,email_newsletter FROM `jos_fabrik_formdata_1` )

I know I need to add something like

$database->query($sql)

but I`m not sure of the exact syntax.

Any help would be greatly appreciated
0
Comment
Question by:dsrpmedia
[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
5 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 22690774
Try something like this...
// MAKE THE SQL STATEMENT
$sql = "INSERT IGNORE INTO `jos_users` ( `name`,`username`)
(SELECT namel_newsletter,email_newsletter FROM `jos_fabrik_formdata_1` )";
 
// DO THE QUERY
$database->query($sql)

Open in new window

0
 

Author Comment

by:dsrpmedia
ID: 22691205
thanks for the suggestion, but it didn `t quite work. I got an error message

'Parse error: syntax error, unexpected $end in /home/content/.../html/components/com_fabrik/fabrik.class.php(1575) : eval()'d code on line 6
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 22691496
That's a totally different issue.  Unexpected $end means that you have a conditional statement such as if() or foreach() with an open brace { that is not terminated by a matching closing brace }

Usually you can use an IDE or text editor to find unbalanced braces or parentheses.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …
Suggested Courses

636 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