PHP form Echo change format [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I have a mobile number
0827910119
this is how it is saved in SQL, if I echo it back on a form i would like to have it shown as follow
27827910119
This is my echo command
<input type="text" name="member_msisdn" value="<? echo $rows['member_msisdn']; ?>"
readonly id="member_msisdn" />
I have tried a Session command to drop the 0 and add the 27 in front but not getting it to work
$_SESSION['msisdn'] = "27" . substr($rows['member_msisdn'], 1);
Is there another way I can echo the number to drop the 0 and add the 27 as I need the 27827910119 in my action PHP to work and not the 0827910119 number

Use
$rows['member_msisdn'] = "27" . substr($rows['member_msisdn'], 1);
instead of
$_SESSION['msisdn'] = "27" . substr($rows['member_msisdn'], 1);
or print using
<? echo $_SESSION['msisdn']; ?>

Related

Assign empty string to php variable [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Just need help fixing this php code
if ($cmtx_set_name_value == "anonymous")
{
$cmtx_set_name_value = ""
}
thanks
Try adding ; after the assignment.
$cmtx_set_name_value = "";
your code is work fine just put ; to end of line
if ($cmtx_set_name_value == "anonymous"){
$cmtx_set_name_value = "" ; }

preg match for known value plus 7 charecters [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Can anyone help me get the value of IFC/USD 0.00001031 from the webpage http://infinitecoin.com.
I need to grab the value after IFC/USD..
The way I thought to do it was to:
$file_string = file_get_contents('http://infinitecoin.com');
preg_match('/IFC/USD plus next 11 charecters', $file_string, $title);
$value = $title[1];
echo $title_out ;
But im not sure how to ask PHP to find IFC/USD then return the next 11 characters after that.
If I could accomplish this, my task would be solved..
Any help would be great.
Thank you
Jason
$output = array();
preg_match("/(?<=IFC\/USD\s)[\d\.]+/", 'IFC/USD 0.00001015', $output);
$output will look like this:
Array
(
[0] => 0.00001015
)

Parse error: syntax error, unexpected T_VARIABLE on line 5 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am new to PHP and am encountering this parsing error. My code is:
<?php
$con=mysqli_connect("glcmcrusaders.ipagemysql.com", "cycregister", "Crusaders13!",
"registration")
$sql="INSERT INTO camperregistration (camperFirstName, camperLastName, camperGender,
camperBirthdate, camperStreet, camperCity, camperState, camperZip, camperCountry,
camperShirtSize, guardianFirstName, guardianLastName, guardianStreet, guardianCity,
guardianState, guardianZip, guardianCountry, guardianCell, guardianEmail,
alternateFirstName, alternateLastName, alternateStreet, alternateCity, alternateState,
alternateZip, alternateCountry, alternateCell, alternateRelationship, camperSwimming)
VALUES
('$_POST[camperFirstName]', '$_POST[camperLastName]', '$_POST[camperGender]',
'$_POST[camperBirthdate]', '$_POST[camperStreet]', '$_POST[camperCity]',
'$_POST[camperState]', '$_POST[camperZip]', '$_POST[camperCountry]',
'$_POST[camperShirtSize]', '$_POST[guardianFirstName]', '$_POST[guardianLastName]',
'$_POST[guardianStreet]', '$_POST[guardianZip]', '$_POST[guardianCountry]',
'$_POST[guardianCell]', '$_POST[guardianEmail]', '$_POST[alternateFirstName]',
'$_POST[alternateLastName]', '$_POST[alternateStreet]', '$_POST[alternateCity]',
'$_POST[alternateState]', '$_POST[alternateZip]', '$_POST[alternateCountry]',
'$_POST[alternateCell]', '$_POST[alternateRelationship]', '$_POST[camperSwimming]')";
mysqli_close($con);
?>
Line 5 starts at the %sql ="INSERT INTO... ends at camperSwimming)
I am not sure what I am doing wrong.
Missing a semi-colon:
$con=mysqli_connect("glcmcrusaders.ipagemysql.com", "cycregister", "Crusaders13!",
"registration") // <-- HERE
you need a terminator(;) at the end of $con.
$con=mysqli_connect("glcmcrusaders.ipagemysql.com", "cycregister", "Crusaders13!",
"registration");
^Here

Strange call to a member function on a non-object php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
So I create a Supermarket class and initiate two objects like this:
$items[0] = new Supermarket("Item1", 2.70);
$items[1] = new Supermarket("Item2", 1.0);
Then I call the showItem() method on the first object of the array and it works:
$items[0]->showItem();
But when I try to use a for or a foreach loop through the array to show all the items I get the non-object error. The following won't work either:
$i = 0;
$items[i]->showItem();
Any ideas?
You are not using the variable sign $
$i = 0;
$items[$i]->showItem();
change like
$i = 0;
$items[i]->showItem();
$i = 0;
$items[$i]->showItem();
$items[$i] instead of $items[i]

$variable = $url + static_page.php [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I would like to uplaod files using cURL but can't figure out how I can use $url array.
For example:
$urls = array("http://images.domain.com/",
"http://flash.domain.com/",
"http://other.domain.com/"
);
foreach ($urls as $url) {
I'm trying this but without success:
$upload = "$url ."upload/upload.php";
Any advice? :)
Thanks
You need to take out the first quote for it to work
$urls = array("http://images.domain.com/",
"http://flash.domain.com/",
"http://other.domain.com/"
);
foreach ($urls as $url) {
$upload = $url ."upload/upload.php";
}

Categories