Solved

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

Posted on 2014-07-21
2
283 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 83

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 109

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
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…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

832 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