Solved

need help building url encoded string query for php if that is what it is called

Posted on 2014-07-21
2
280 Views
Last Modified: 2014-07-25
I am new to php
How would I send a string to a database that would have the following query
$sql = "INSERT INTO `mlog`(`student`, `password`, `mDate`, `speed`, `correct`, `wrong`, `style`, `hints`, `blank_N_words`) VALUES (\'Ben\',\'7316\',\'1/23/1967\',30,5,5,\'multichoice\',5,3)";

Open in new window

0
Comment
Question by:Dov_B
2 Comments
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 100 total points
ID: 40210417
Since the whole string is double-quoted, you do not need to 'escape' the single quotes.
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 400 total points
ID: 40219862
Getting started in PHP and MySQL:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html

The query with the unwanted "escape" characters removed:
$sql = "INSERT INTO `mlog`(`student`, `password`, `mDate`, `speed`, `correct`, `wrong`, `style`, `hints`, `blank_N_words`) VALUES ('Ben','7316','1/23/1967',30,5,5,'multichoice',5,3)";

Open in new window

This query cannot work because the number of columns does not match the number of values.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
move records one table to another 14 51
Filter by data and current_date 4 30
Video on my site 4 27
Insert data into database 2 15
New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

758 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

25 Experts available now in Live!

Get 1:1 Help Now