PHP unidentified index when getting SQL data
Good Day, I am tasked to have an original and discounted price in our website, using PHP. Previously the original price is already present, now I am trying to add a second price by adding variables in the customer management system. The problem is that I get
Notice: Undefined index:
even when I add a discounted price value alongside the original price. I added a new column for the new discounted price option in my phpmyadmin database but I still get that index error.
Any help would be appreciated and ill explain the situation with codes and screenshots.
price error
phpmyadmin columns
codes with original price and discounted price (the "d_price" is the one with unidentified index)
1.
<div class="col-md-12"><hr></div>
<div class="col-md-3">ORIGINAL PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="price" placeholder="Original Price"
value="<?php
if(isset($_POST['price'])) {
echo($_POST['price']);
} else {
echo($rowProduct['price']);
} ?>">
</div>
<div class="col-md-12"><hr></div>
<div class="col-md-3">DISCOUNTED PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="d_price" placeholder="Discounted Price"
value="<?php
if(isset($_POST['d_price'])) {
echo($_POST['d_price']);
} else {
echo($rowProduct['d_price']);
} ?>">
</div>
2.
<div class="col-md-12">
<div class="col-md-6 text-align-center">
<h4>ORIGINAL PRICE</h4>
<strike><h4><?php echo($rowProduct['price']); ?> PHP</h4></strike>
</div>
<div class="col-md-6 text-align-center">
<h4>DISCOUNTED PRICE</h4>
<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
</div>
</div>
3. (this is the if statement snippet for the save button)
if (isset($_POST['submit']) && $_POST['submit'] == 'SAVE')
{
$price = $_POST['price'];
$d_price = $_POST['d_price'];
Again 'price' works normally while 'd_price' shows the error. I hope I have provided enough information to not get my question downvoted.
I think this is where $rowProduct originates:
$producttagid = isset($_GET['t']) ? $_GET['t'] : 1;
$merchantid = isset($_GET['m']) ? $_GET['m'] : NULL;
$rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
$lstProductTag = $mcProductTag->SelectLst($db);
$lstProductTagLink = $mcProductTagLink->SelectLst_ByProductId($db, $productid);
$lstMerchant = $mcMerchant->SelectLst($db, 1, 10000);
$productid = $mcProduct->InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays);
heres a screenshot of my phpmyadmin database, I already added d_price in the Product row but I still get unidentified index. Im providing as much information as I can.
I think these lines of code interact with the SQL database via PDO
EDIT: here are all the locations of SelectObj_ByProductId (searched with notepad++)
C:xampphtdocsmwc_canuto-apiProductsBookmarkToggle.api.php (1 hit)
Line 65: $api['productData'] = $api['productModel']->SelectObj_ByProductId(
C:xampphtdocsmwc_canutocardsinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocardsinfo.vc.php (2 hits)
Line 46: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 65: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutoclinicinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocmsproducts_edit.vc.php (1 hit)
Line 151: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canuto_mcProduct.mc.php (1 hit)
Line 205: public function SelectObj_ByProductId($db, $productid) {
EDIT: I added d_price in what seems to be the insert object function, I still get unidentified index
/********** Insert Object **********/
public function InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays) {
$stmt = $db->prepare(
" INSERT INTO `product`
(merchantid, title, subtitle, body, recstatus, price, d_price, qty, createddate, createdby, featured, packageid, expirationdays)
VALUES
(:merchantid, :title, :subtitle, :body, :recstatus, :price, :d_price, :qty, :createddate, :createdby, :featured, :packageid, :expirationdays) "
);
// cast bit type data to int else it wont save properly
$featured = (int)$featured;
$stmt->bindValue(':merchantid', $merchantid, PDO::PARAM_INT);
$stmt->bindValue(':title', $title, PDO::PARAM_STR);
$stmt->bindValue(':subtitle', $subtitle, PDO::PARAM_STR);
$stmt->bindValue(':body', $body, PDO::PARAM_STR);
$stmt->bindValue(':recstatus', $recstatus, PDO::PARAM_INT);
$stmt->bindValue(':price', $price, PDO::PARAM_STR);
$stmt->bindValue(':d_price', $d_price, PDO::PARAM_STR);
$stmt->bindValue(':qty', $qty, PDO::PARAM_INT);
$stmt->bindValue(':createddate', $createddate, PDO::PARAM_STR);
$stmt->bindValue(':createdby', $createdby, PDO::PARAM_STR);
$stmt->bindValue(':featured', $featured, PDO::PARAM_INT);
$stmt->bindValue(':packageid', $packageid, PDO::PARAM_INT);
$stmt->bindValue(':expirationdays', $expirationdays, PDO::PARAM_INT);
$stmt->execute();
$insertId = $db->lastInsertId();
return $insertId;
}
php html mysql forms
|
show 15 more comments
Good Day, I am tasked to have an original and discounted price in our website, using PHP. Previously the original price is already present, now I am trying to add a second price by adding variables in the customer management system. The problem is that I get
Notice: Undefined index:
even when I add a discounted price value alongside the original price. I added a new column for the new discounted price option in my phpmyadmin database but I still get that index error.
Any help would be appreciated and ill explain the situation with codes and screenshots.
price error
phpmyadmin columns
codes with original price and discounted price (the "d_price" is the one with unidentified index)
1.
<div class="col-md-12"><hr></div>
<div class="col-md-3">ORIGINAL PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="price" placeholder="Original Price"
value="<?php
if(isset($_POST['price'])) {
echo($_POST['price']);
} else {
echo($rowProduct['price']);
} ?>">
</div>
<div class="col-md-12"><hr></div>
<div class="col-md-3">DISCOUNTED PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="d_price" placeholder="Discounted Price"
value="<?php
if(isset($_POST['d_price'])) {
echo($_POST['d_price']);
} else {
echo($rowProduct['d_price']);
} ?>">
</div>
2.
<div class="col-md-12">
<div class="col-md-6 text-align-center">
<h4>ORIGINAL PRICE</h4>
<strike><h4><?php echo($rowProduct['price']); ?> PHP</h4></strike>
</div>
<div class="col-md-6 text-align-center">
<h4>DISCOUNTED PRICE</h4>
<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
</div>
</div>
3. (this is the if statement snippet for the save button)
if (isset($_POST['submit']) && $_POST['submit'] == 'SAVE')
{
$price = $_POST['price'];
$d_price = $_POST['d_price'];
Again 'price' works normally while 'd_price' shows the error. I hope I have provided enough information to not get my question downvoted.
I think this is where $rowProduct originates:
$producttagid = isset($_GET['t']) ? $_GET['t'] : 1;
$merchantid = isset($_GET['m']) ? $_GET['m'] : NULL;
$rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
$lstProductTag = $mcProductTag->SelectLst($db);
$lstProductTagLink = $mcProductTagLink->SelectLst_ByProductId($db, $productid);
$lstMerchant = $mcMerchant->SelectLst($db, 1, 10000);
$productid = $mcProduct->InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays);
heres a screenshot of my phpmyadmin database, I already added d_price in the Product row but I still get unidentified index. Im providing as much information as I can.
I think these lines of code interact with the SQL database via PDO
EDIT: here are all the locations of SelectObj_ByProductId (searched with notepad++)
C:xampphtdocsmwc_canuto-apiProductsBookmarkToggle.api.php (1 hit)
Line 65: $api['productData'] = $api['productModel']->SelectObj_ByProductId(
C:xampphtdocsmwc_canutocardsinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocardsinfo.vc.php (2 hits)
Line 46: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 65: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutoclinicinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocmsproducts_edit.vc.php (1 hit)
Line 151: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canuto_mcProduct.mc.php (1 hit)
Line 205: public function SelectObj_ByProductId($db, $productid) {
EDIT: I added d_price in what seems to be the insert object function, I still get unidentified index
/********** Insert Object **********/
public function InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays) {
$stmt = $db->prepare(
" INSERT INTO `product`
(merchantid, title, subtitle, body, recstatus, price, d_price, qty, createddate, createdby, featured, packageid, expirationdays)
VALUES
(:merchantid, :title, :subtitle, :body, :recstatus, :price, :d_price, :qty, :createddate, :createdby, :featured, :packageid, :expirationdays) "
);
// cast bit type data to int else it wont save properly
$featured = (int)$featured;
$stmt->bindValue(':merchantid', $merchantid, PDO::PARAM_INT);
$stmt->bindValue(':title', $title, PDO::PARAM_STR);
$stmt->bindValue(':subtitle', $subtitle, PDO::PARAM_STR);
$stmt->bindValue(':body', $body, PDO::PARAM_STR);
$stmt->bindValue(':recstatus', $recstatus, PDO::PARAM_INT);
$stmt->bindValue(':price', $price, PDO::PARAM_STR);
$stmt->bindValue(':d_price', $d_price, PDO::PARAM_STR);
$stmt->bindValue(':qty', $qty, PDO::PARAM_INT);
$stmt->bindValue(':createddate', $createddate, PDO::PARAM_STR);
$stmt->bindValue(':createdby', $createdby, PDO::PARAM_STR);
$stmt->bindValue(':featured', $featured, PDO::PARAM_INT);
$stmt->bindValue(':packageid', $packageid, PDO::PARAM_INT);
$stmt->bindValue(':expirationdays', $expirationdays, PDO::PARAM_INT);
$stmt->execute();
$insertId = $db->lastInsertId();
return $insertId;
}
php html mysql forms
I'll take a guess and say that this<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
is line 139? If so, use a conditional statement for it also or a ternary operator.
– Funk Forty Niner
Nov 21 at 2:26
yes thats line 139 with the unidentified index. also i tried to explain the situation of the codes here in order to avoid that duplicate question mark.
– Hadrian Clayton
Nov 21 at 2:28
may i see a smple of a conditional statement or a ternary operator using my code?
– Hadrian Clayton
Nov 21 at 2:35
1
You already have one going nowif(isset($_POST['d_price'])) { echo($_POST['d_price']); }
- Base yourself on that. The ternary operator example can be found here php.net/manual/en/language.operators.comparison.php
– Funk Forty Niner
Nov 21 at 2:41
i woud just like to admit and be honest after i read the ternary operator example and how my if else statement still outputs unidentified index: I Don't Get It
– Hadrian Clayton
Nov 21 at 2:56
|
show 15 more comments
Good Day, I am tasked to have an original and discounted price in our website, using PHP. Previously the original price is already present, now I am trying to add a second price by adding variables in the customer management system. The problem is that I get
Notice: Undefined index:
even when I add a discounted price value alongside the original price. I added a new column for the new discounted price option in my phpmyadmin database but I still get that index error.
Any help would be appreciated and ill explain the situation with codes and screenshots.
price error
phpmyadmin columns
codes with original price and discounted price (the "d_price" is the one with unidentified index)
1.
<div class="col-md-12"><hr></div>
<div class="col-md-3">ORIGINAL PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="price" placeholder="Original Price"
value="<?php
if(isset($_POST['price'])) {
echo($_POST['price']);
} else {
echo($rowProduct['price']);
} ?>">
</div>
<div class="col-md-12"><hr></div>
<div class="col-md-3">DISCOUNTED PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="d_price" placeholder="Discounted Price"
value="<?php
if(isset($_POST['d_price'])) {
echo($_POST['d_price']);
} else {
echo($rowProduct['d_price']);
} ?>">
</div>
2.
<div class="col-md-12">
<div class="col-md-6 text-align-center">
<h4>ORIGINAL PRICE</h4>
<strike><h4><?php echo($rowProduct['price']); ?> PHP</h4></strike>
</div>
<div class="col-md-6 text-align-center">
<h4>DISCOUNTED PRICE</h4>
<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
</div>
</div>
3. (this is the if statement snippet for the save button)
if (isset($_POST['submit']) && $_POST['submit'] == 'SAVE')
{
$price = $_POST['price'];
$d_price = $_POST['d_price'];
Again 'price' works normally while 'd_price' shows the error. I hope I have provided enough information to not get my question downvoted.
I think this is where $rowProduct originates:
$producttagid = isset($_GET['t']) ? $_GET['t'] : 1;
$merchantid = isset($_GET['m']) ? $_GET['m'] : NULL;
$rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
$lstProductTag = $mcProductTag->SelectLst($db);
$lstProductTagLink = $mcProductTagLink->SelectLst_ByProductId($db, $productid);
$lstMerchant = $mcMerchant->SelectLst($db, 1, 10000);
$productid = $mcProduct->InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays);
heres a screenshot of my phpmyadmin database, I already added d_price in the Product row but I still get unidentified index. Im providing as much information as I can.
I think these lines of code interact with the SQL database via PDO
EDIT: here are all the locations of SelectObj_ByProductId (searched with notepad++)
C:xampphtdocsmwc_canuto-apiProductsBookmarkToggle.api.php (1 hit)
Line 65: $api['productData'] = $api['productModel']->SelectObj_ByProductId(
C:xampphtdocsmwc_canutocardsinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocardsinfo.vc.php (2 hits)
Line 46: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 65: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutoclinicinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocmsproducts_edit.vc.php (1 hit)
Line 151: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canuto_mcProduct.mc.php (1 hit)
Line 205: public function SelectObj_ByProductId($db, $productid) {
EDIT: I added d_price in what seems to be the insert object function, I still get unidentified index
/********** Insert Object **********/
public function InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays) {
$stmt = $db->prepare(
" INSERT INTO `product`
(merchantid, title, subtitle, body, recstatus, price, d_price, qty, createddate, createdby, featured, packageid, expirationdays)
VALUES
(:merchantid, :title, :subtitle, :body, :recstatus, :price, :d_price, :qty, :createddate, :createdby, :featured, :packageid, :expirationdays) "
);
// cast bit type data to int else it wont save properly
$featured = (int)$featured;
$stmt->bindValue(':merchantid', $merchantid, PDO::PARAM_INT);
$stmt->bindValue(':title', $title, PDO::PARAM_STR);
$stmt->bindValue(':subtitle', $subtitle, PDO::PARAM_STR);
$stmt->bindValue(':body', $body, PDO::PARAM_STR);
$stmt->bindValue(':recstatus', $recstatus, PDO::PARAM_INT);
$stmt->bindValue(':price', $price, PDO::PARAM_STR);
$stmt->bindValue(':d_price', $d_price, PDO::PARAM_STR);
$stmt->bindValue(':qty', $qty, PDO::PARAM_INT);
$stmt->bindValue(':createddate', $createddate, PDO::PARAM_STR);
$stmt->bindValue(':createdby', $createdby, PDO::PARAM_STR);
$stmt->bindValue(':featured', $featured, PDO::PARAM_INT);
$stmt->bindValue(':packageid', $packageid, PDO::PARAM_INT);
$stmt->bindValue(':expirationdays', $expirationdays, PDO::PARAM_INT);
$stmt->execute();
$insertId = $db->lastInsertId();
return $insertId;
}
php html mysql forms
Good Day, I am tasked to have an original and discounted price in our website, using PHP. Previously the original price is already present, now I am trying to add a second price by adding variables in the customer management system. The problem is that I get
Notice: Undefined index:
even when I add a discounted price value alongside the original price. I added a new column for the new discounted price option in my phpmyadmin database but I still get that index error.
Any help would be appreciated and ill explain the situation with codes and screenshots.
price error
phpmyadmin columns
codes with original price and discounted price (the "d_price" is the one with unidentified index)
1.
<div class="col-md-12"><hr></div>
<div class="col-md-3">ORIGINAL PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="price" placeholder="Original Price"
value="<?php
if(isset($_POST['price'])) {
echo($_POST['price']);
} else {
echo($rowProduct['price']);
} ?>">
</div>
<div class="col-md-12"><hr></div>
<div class="col-md-3">DISCOUNTED PRICE</div>
<div class="col-md-9">
<input type="number" class="form-control" name="d_price" placeholder="Discounted Price"
value="<?php
if(isset($_POST['d_price'])) {
echo($_POST['d_price']);
} else {
echo($rowProduct['d_price']);
} ?>">
</div>
2.
<div class="col-md-12">
<div class="col-md-6 text-align-center">
<h4>ORIGINAL PRICE</h4>
<strike><h4><?php echo($rowProduct['price']); ?> PHP</h4></strike>
</div>
<div class="col-md-6 text-align-center">
<h4>DISCOUNTED PRICE</h4>
<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
</div>
</div>
3. (this is the if statement snippet for the save button)
if (isset($_POST['submit']) && $_POST['submit'] == 'SAVE')
{
$price = $_POST['price'];
$d_price = $_POST['d_price'];
Again 'price' works normally while 'd_price' shows the error. I hope I have provided enough information to not get my question downvoted.
I think this is where $rowProduct originates:
$producttagid = isset($_GET['t']) ? $_GET['t'] : 1;
$merchantid = isset($_GET['m']) ? $_GET['m'] : NULL;
$rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
$lstProductTag = $mcProductTag->SelectLst($db);
$lstProductTagLink = $mcProductTagLink->SelectLst_ByProductId($db, $productid);
$lstMerchant = $mcMerchant->SelectLst($db, 1, 10000);
$productid = $mcProduct->InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays);
heres a screenshot of my phpmyadmin database, I already added d_price in the Product row but I still get unidentified index. Im providing as much information as I can.
I think these lines of code interact with the SQL database via PDO
EDIT: here are all the locations of SelectObj_ByProductId (searched with notepad++)
C:xampphtdocsmwc_canuto-apiProductsBookmarkToggle.api.php (1 hit)
Line 65: $api['productData'] = $api['productModel']->SelectObj_ByProductId(
C:xampphtdocsmwc_canutocardsinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocardsinfo.vc.php (2 hits)
Line 46: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 65: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutoclinicinfo-detailed.vc.php (2 hits)
Line 45: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
Line 54: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canutocmsproducts_edit.vc.php (1 hit)
Line 151: $rowProduct = $mcProduct->SelectObj_ByProductId($db, $productid);
C:xampphtdocsmwc_canuto_mcProduct.mc.php (1 hit)
Line 205: public function SelectObj_ByProductId($db, $productid) {
EDIT: I added d_price in what seems to be the insert object function, I still get unidentified index
/********** Insert Object **********/
public function InsertObj($db, $merchantid, $title, $subtitle, $body, $recstatus, $price, $d_price, $qty, $createddate, $createdby, $featured, $packageid, $expirationdays) {
$stmt = $db->prepare(
" INSERT INTO `product`
(merchantid, title, subtitle, body, recstatus, price, d_price, qty, createddate, createdby, featured, packageid, expirationdays)
VALUES
(:merchantid, :title, :subtitle, :body, :recstatus, :price, :d_price, :qty, :createddate, :createdby, :featured, :packageid, :expirationdays) "
);
// cast bit type data to int else it wont save properly
$featured = (int)$featured;
$stmt->bindValue(':merchantid', $merchantid, PDO::PARAM_INT);
$stmt->bindValue(':title', $title, PDO::PARAM_STR);
$stmt->bindValue(':subtitle', $subtitle, PDO::PARAM_STR);
$stmt->bindValue(':body', $body, PDO::PARAM_STR);
$stmt->bindValue(':recstatus', $recstatus, PDO::PARAM_INT);
$stmt->bindValue(':price', $price, PDO::PARAM_STR);
$stmt->bindValue(':d_price', $d_price, PDO::PARAM_STR);
$stmt->bindValue(':qty', $qty, PDO::PARAM_INT);
$stmt->bindValue(':createddate', $createddate, PDO::PARAM_STR);
$stmt->bindValue(':createdby', $createdby, PDO::PARAM_STR);
$stmt->bindValue(':featured', $featured, PDO::PARAM_INT);
$stmt->bindValue(':packageid', $packageid, PDO::PARAM_INT);
$stmt->bindValue(':expirationdays', $expirationdays, PDO::PARAM_INT);
$stmt->execute();
$insertId = $db->lastInsertId();
return $insertId;
}
php html mysql forms
php html mysql forms
edited Nov 21 at 6:29
asked Nov 21 at 2:18
Hadrian Clayton
637
637
I'll take a guess and say that this<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
is line 139? If so, use a conditional statement for it also or a ternary operator.
– Funk Forty Niner
Nov 21 at 2:26
yes thats line 139 with the unidentified index. also i tried to explain the situation of the codes here in order to avoid that duplicate question mark.
– Hadrian Clayton
Nov 21 at 2:28
may i see a smple of a conditional statement or a ternary operator using my code?
– Hadrian Clayton
Nov 21 at 2:35
1
You already have one going nowif(isset($_POST['d_price'])) { echo($_POST['d_price']); }
- Base yourself on that. The ternary operator example can be found here php.net/manual/en/language.operators.comparison.php
– Funk Forty Niner
Nov 21 at 2:41
i woud just like to admit and be honest after i read the ternary operator example and how my if else statement still outputs unidentified index: I Don't Get It
– Hadrian Clayton
Nov 21 at 2:56
|
show 15 more comments
I'll take a guess and say that this<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
is line 139? If so, use a conditional statement for it also or a ternary operator.
– Funk Forty Niner
Nov 21 at 2:26
yes thats line 139 with the unidentified index. also i tried to explain the situation of the codes here in order to avoid that duplicate question mark.
– Hadrian Clayton
Nov 21 at 2:28
may i see a smple of a conditional statement or a ternary operator using my code?
– Hadrian Clayton
Nov 21 at 2:35
1
You already have one going nowif(isset($_POST['d_price'])) { echo($_POST['d_price']); }
- Base yourself on that. The ternary operator example can be found here php.net/manual/en/language.operators.comparison.php
– Funk Forty Niner
Nov 21 at 2:41
i woud just like to admit and be honest after i read the ternary operator example and how my if else statement still outputs unidentified index: I Don't Get It
– Hadrian Clayton
Nov 21 at 2:56
I'll take a guess and say that this
<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
is line 139? If so, use a conditional statement for it also or a ternary operator.– Funk Forty Niner
Nov 21 at 2:26
I'll take a guess and say that this
<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
is line 139? If so, use a conditional statement for it also or a ternary operator.– Funk Forty Niner
Nov 21 at 2:26
yes thats line 139 with the unidentified index. also i tried to explain the situation of the codes here in order to avoid that duplicate question mark.
– Hadrian Clayton
Nov 21 at 2:28
yes thats line 139 with the unidentified index. also i tried to explain the situation of the codes here in order to avoid that duplicate question mark.
– Hadrian Clayton
Nov 21 at 2:28
may i see a smple of a conditional statement or a ternary operator using my code?
– Hadrian Clayton
Nov 21 at 2:35
may i see a smple of a conditional statement or a ternary operator using my code?
– Hadrian Clayton
Nov 21 at 2:35
1
1
You already have one going now
if(isset($_POST['d_price'])) { echo($_POST['d_price']); }
- Base yourself on that. The ternary operator example can be found here php.net/manual/en/language.operators.comparison.php– Funk Forty Niner
Nov 21 at 2:41
You already have one going now
if(isset($_POST['d_price'])) { echo($_POST['d_price']); }
- Base yourself on that. The ternary operator example can be found here php.net/manual/en/language.operators.comparison.php– Funk Forty Niner
Nov 21 at 2:41
i woud just like to admit and be honest after i read the ternary operator example and how my if else statement still outputs unidentified index: I Don't Get It
– Hadrian Clayton
Nov 21 at 2:56
i woud just like to admit and be honest after i read the ternary operator example and how my if else statement still outputs unidentified index: I Don't Get It
– Hadrian Clayton
Nov 21 at 2:56
|
show 15 more comments
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404431%2fphp-unidentified-index-when-getting-sql-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404431%2fphp-unidentified-index-when-getting-sql-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'll take a guess and say that this
<h4><?php echo($rowProduct['d_price']); ?> PHP</h4>
is line 139? If so, use a conditional statement for it also or a ternary operator.– Funk Forty Niner
Nov 21 at 2:26
yes thats line 139 with the unidentified index. also i tried to explain the situation of the codes here in order to avoid that duplicate question mark.
– Hadrian Clayton
Nov 21 at 2:28
may i see a smple of a conditional statement or a ternary operator using my code?
– Hadrian Clayton
Nov 21 at 2:35
1
You already have one going now
if(isset($_POST['d_price'])) { echo($_POST['d_price']); }
- Base yourself on that. The ternary operator example can be found here php.net/manual/en/language.operators.comparison.php– Funk Forty Niner
Nov 21 at 2:41
i woud just like to admit and be honest after i read the ternary operator example and how my if else statement still outputs unidentified index: I Don't Get It
– Hadrian Clayton
Nov 21 at 2:56