Not Entering Values into the database [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
mysql_query("insert into user_info(Name,Id,Password,Email,Gender,Date_of_birth) values('".$name."','".$iden."','".$pass1."','".$email."','".$gender."','STR_TO_DATE('$date','%d,%m,%Y')')");
Can anyone tell which part of this code is incorrect, as it is not entering anything in the database.....

Unquote the 'STR_TO_DATE('$date','%d,%m,%Y')' call. I also cleaned up the rest of the code a bit. As a result you get:
mysql_query("insert into user_info(Name,Id,Password,Email,Gender,Date_of_birth) values('$name','$iden','$pass1','$email','$gender',STR_TO_DATE('$date','%d,%m,%Y'))");

On this part:
'STR_TO_DATE('$date','%d,%m,%Y')'
There are single quotes inside single quotes, causing an error. To fix this, replace the single quotes on the arguments to escaped double quotes, like this:
'STR_TO_DATE(\"$date\",\"%d,%m,%Y\")'
However, since you probably want to use the function and not post it literally, you should just remove the outside quotes, like this:
STR_TO_DATE('$date','%d,%m,%Y')

Related

How to create a new product with Lazada API? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Below is the example code get from LazadaOP:
Create function in ProductsController:
Continue...
So I just try to run this but it shows the error with invalid request format.
Error Page
I just want to know what is the problem with the code, and if there some solution plz do provide some code to references.TQ
#WilliamC, you had used a single quote on your XML string, yet your double quotes inside the string are escaped (e.g. '<xml version=\"1.0\"...'). You don't have to escape double quotes inside a single quoted string.
Should have been:
'<xml version="1.0" encoding="UTF-8" ?>...'
More explanation about single vs. double quotes can be found here.

Strip HTML tags AND double quotes [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I want to clean my entries that look like
“If you think adventure is dangerous, try routine; it is lethal.”
<p>Life isn't about finding yourself it's about creating yourself. </p>
I need to remove HTML tags and double quotes and single quotes if they are in the beginning or the end of the string.
There was a function, but I don't remember what it was or something like a class...
You can remove everything with ^[“"'‘]|[”"'’]$|^<[^>]*?>|<[^>]*?>$
Here is a demo.

Something wrong with php code [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I did something wrong because the last lane do not add anything to database.
Could someone experienced take a look please?
EDIT: I just deleted all unnecessary lanes
mysql_query('INSERT INTO votes (voter, photoid, photoowner, vote) VALUES ($voter, $photoid, $photoowner, "yes")');
Variable values are not evaluated within a string with single quotes:
mysql_query("INSERT INTO votes (voter, photoid, photoowner, vote) VALUES ('$voter', '$photoid', '$photoowner', 'yes')");
put double quotes around your select statement or use concatenation and don't forget to put quotes around your string values
Also use use mysql_error() to retrieve the error text

Twig variable does not exist if the name contains underscores [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I can’t display a variable like {{foo_bar}}, but if I change the name to fooBar it works. How can I display variables that contain underscores?
I think it's okay if you display variables that contain underscores. There is no error with it.

How to echo a hyperlink with a variable? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Getting these hyperlinks right and mixing HTML with PHP seems to be a constant source of sorrow for me. Whats wrong with this hyperlink?
echo '$suggestion[$ss_count]<br>;
it should be
echo ''.$suggestion[$ss_count].'<br>';
Within single quotes variables are not interpolated so you have to pull the link text out of the string literal.
try it ..!!
echo ''.$suggestion[$ss_count].'<br>';
you all missing the point.
JUST USE BACKSLASH

Categories