Solved

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

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video teaches users how to migrate an existing Wordpress website to a new domain.
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…

729 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