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 suppose that this is very noob question but I can't figure it out.
I've got code:
for($i=1; $i<9; $i++){
if (isset($_POST['is'$i'ID'])) {
echo $i . " is OK<br>";
}
}
And I know that the problem lies in this line :
if (isset($_POST['is'$i'ID']))
How can I use variable i in this code?
String concatenation rules apply even when used as array keys:
if (isset($_POST['is'.$i.'ID']))
Simply concat your strings. You even do it in your echo call :)
if (isset($_POST['is' . $i . 'ID']))
Related
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 2 years ago.
Improve this question
I am a little lost with one of my variables and need your help. I am trying to add the +1 to default to my phone number variable so I don't have to use it on front.
Current row:
$this->sendSMS($plainMessage, $users['mobile_number']);
What I tried is next:
$mobile_number = "+1" . $mobile_number
$this->sendSMS($plainMessage, $users['mobile_number']);
I am pretty sure it's wrong but my brain is stuck.
Option 1:
$mobile_number = "+1" . $users['mobile_number'];
$this->sendSMS($plainMessage, $mobile_number);
Option 2:
$this->sendSMS($plainMessage, "+1" . $users['mobile_number']);
Spaces before and after dot are not necessary.
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 3 years ago.
Improve this question
How can i echo PHP Get request with []?
example: value=ok¶ms[account]=123456
There is no problem with:
echo $value = $_GET["value"];
Not working with:
echo $account = $_GET["params[account]"];
echo $account = $_GET["params"]["account"];
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 6 years ago.
Improve this question
So basically I am trying to save something on my root folder:
$xml->save('../datas/' + $randomString + '.xml');
But it doesn't work. however, when I do
$xml->save('../datas/hi.xml');
it does. so I figured, it must be a problem with my var, randomString:
$randomString = substr(str_shuffle("0123456789"), 0, $length);
So, what am i doing wrong?
You want string concatenation. In PHP the operator for it is ., not +.
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)
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.