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

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.

Related

Variable not detected as variable [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I wanted to ask, how I can write down a variable without it's getting detected as one.
As example:
$data = <<< DATA
<?php
$dbServername = $_POST["admin"];
?>
DATA;
$dbServername shouldn't be a variable, but $_POST["admin"]; should be one.
I want, to write with fwrite the $_POST["admin"] variable into a document. But when $dbServername also gets detected as a variable, but it should be one, it throws errors.
Any Idea how to fix this?
EDIT:
There are 2 ways:
Either escape them with a backslash \ or put the variable into curly brackets {}. That also works.
Either escape the dollar sign by adding a backslash (\) infront of the dollar sign, or use single quotes to denote the string.

Can work out how to redirect capture page to affiliate username [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 9 years ago.
Improve this question
<?php header('Location: http://potttmatrix.biz/?r=;echo $r;echo');
?>
That is what im trying at the min I want the page to redirect to the referring persons link they were first at on the referral page.
Try one of these:
header("Location: http://potttmatrix.biz/?r=$r");
or
header('Location: http://potttmatrix.biz/?r='.$r);
Your code was a bit confusing, but I am assuming that you are trying to append a variable to a string.
Edit, as suggested by Chris Hayes:
In short, single quotes will take the value of the string as a literal value, while double quotes will "parse" your variable. Therefore, with single quotes you need to append the variable from the outside of the string, where with double quotes you can just include the variable in the string and it's value will be shown instead.

Using php variable in href html links [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 9 years ago.
Improve this question
here is what i am trying to do
$store='something.com';
echo '<div><h3>click on</h3><a href='.$store.'>host</a></p></div>';
what it output is
something.com
instead it should use something.com as link and output need to be host.
try for sometime to do it my own but havn't achieved any success.
This code will help you out:
<?php
$store='something.com';
echo '<div><h3>click on</h3>host</p></div>';
Note the double quotes (") between the string concatenation (') this is needed by the browser to make render the proper href element.
I am agree with the Answer of Ma'moon and it is right.
Php code does not work inside the single quotes ' ', so its required to place code inside the double quotes " ".
You can also use following method instead ↓
$store='something.com';
echo "<div><h3>click on</h3><a href='$store'>host</a></p></div>";

PHP, escape any characters [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 9 years ago.
Improve this question
Can I escape any character in string without using symbol "\"?
For example, programming language C# allows specify string, which does not have special characters:
#"c:\webserver\".Equals("c:\\webserver\\") // <== return true
Thanks for answers and sorry for my poor English!
to escape use addslashes(); and stripslashes() to remove added slashes
Do you want to automatically add slashes?
Then you can use built in php function:
addslashes();
http://php.net/manual/en/function.addslashes.php

Not Entering Values into the database [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
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')

Categories