T String When using a reference [closed] - php

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am using this as a reference
$jpsupp1 = '<?=$gamesss['jackpot']?>';
How can I use this without the 'jackpot' giving me t_string errors?

It should be:
$jpsupp1 = $gamesss['jackpot'];
You don't need <?= when you're already executing PHP code. That's used for embedding PHP in HTML.

Use double quotes
$jpsupp1 = "<?=$gamesss['jackpot']?>";
or
$jpsupp1 = "<?={$gamesss['jackpot']}?>";
Depending on what you want to store.

Related

What is the "returnto" in this piece of code [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
header("Location: {$TBDEV['baseurl']}/login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]));
Is it a variable? PHP reserved word? something to do with HTML?
It's a $_GET parameter. When you submit the code, the page receiving it will be able to use $_GET['returnto'] to return you to the page you're currently on.
Take some time to learn about $_GET

Php help find where is syntax error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes===".$card['id']."") as $kat){
echo (kat['id_categories']);
}
table cols and values are all matched, something is wrong in this part of code
I tried adding $ before kat and using only one "=", sill doesnt work
NEW LINK
http://pastebin.com/RPK7vEaJ
this
where id_kartes===".$card['id']."
would be
where id_kartes=".$card['id']."
and missing $
echo $kat['id_categories'];
so full code :-
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes='".$card['id']."'") as $kat){
echo $kat['id_categories'];
}
best practice if you store your query result in a variable and loop over this variable.
foreach($db->fetch_array("SELECT id_categories FROM csn_categories_join_kartes where id_kartes=".$card['id']."") as $kat)

PHP error for login session [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have an error in a single line of code but I can't seem to find it. I've tried changing the quotes to all match but that doesn't do anything. Please help. here is where the error is
$managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]);
try this :
$managerID = preg_replace('#[^0-9]#i','',$_SESSION["id"]);
btw i dont know what you are trying to do i just solved your syntax error ;)

PHP - Using $_POST after a link [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have a form with a textbox with name="name".
In my code, I use a direct image hosted on another website in the format:
$grav_url = "http://yourwebsitehere.com/avatarimage.php?username=YourUsername";
I want the YourUsername part to be replaced with the input of the textbox.
For this to work, i'm trying the following code:
$grav_url = "http://yourwebsitehere.com/avatarimage.php?username="+ $_POST['name'];
What am I doing wrong? PHP noob here
in php . is used for concatenate string not +
here try this
$grav_url = "http://yourwebsitehere.com/avatarimage.php?username=".$_POST['name'];

PHP: Parse Error After Assigning Variable? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
How come this php script is returning a parse error?
When I remove the line that assigns argv to a variable, PHP won't return a parse error. Furthermore, it says the parse error is on the print line.
<?php
$points = $argv[1]
print($argv[1])
?>
PHP statements should end with ;
$points = $argv[1];
^
print($argv[1]);
^

Categories