Solved

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

Posted on 2014-07-21
2
286 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
[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 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 110

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Display images from mysql blob type (Not working) 9 50
QQ problem 22 63
Coldfusion/Mysql page error related to dynamic table creation. 9 43
php hashing methods 3 10
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…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This video teaches users how to migrate an existing Wordpress website to a new domain.
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.

735 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