Jump to content

mrbobey

Members
  • Posts

    13
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mrbobey's Achievements

Member

Member (2/5)

0

Reputation

  1. HTML page Looks fine in local host when uploaded to hosting site something messy happen, but it goes worst into android device. the page coded to be responsive. other pages looks fine both pc and android when uploaded to hosting site except this one page.. when i put a form into the div something happen, but it is good in localhost in hosting site is not what i wanted to be seen and also to the android,
  2. wohhh... i think my mind get explode while absorbing the necessary things that you said.. thanks alot im not getting this information through hearing from the professor or else it would be repeated thank you for this... i am gladly you made effort for checking my file.. thanks alot.. im just only a newbie here where youtube and google is my instructor.. thank you sir..
  3. if there is wrong with the code why it is working in my localhost? I am sending you the video so that you will see exactly what is happening
  4. i will post the full code for this... the function that is creating the table function createcart($conn2, $Regname){ $sql = "CREATE TABLE .$Regname ( TrxID INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, ProductName VARCHAR(50) NOT NULL, Price DECIMAL(4.2) NOT NULL, Quantity INT(6) NOT NULL, ProductImage VARCHAR (255) NOT NULL, PurchasedDate VARCHAR(10) NOT NULL, PurchasedStatus VARCHAR(10) NOT NULL )"; if ($conn2->query($sql) === TRUE){ header("location: ../index.html"); exit(); } else{ header("location: ../account.html?error=CannotCreateAccount"); exit(); } my productdetail.html <?php $uri = $_SERVER["REQUEST_URI"]; $uriArray = explode('/', $uri); $value = $uriArray[4]; $_SESSION["PID"] = $value; require_once '../connection/connection.php'; $sql = "SELECT * FROM featuredlist WHERE ProductID = ?"; $stmt = mysqli_stmt_init($conn1); if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'connection error'; } mysqli_stmt_bind_param($stmt, "i", $value); mysqli_stmt_execute($stmt); $resultdata = mysqli_stmt_get_result($stmt); if($row = mysqli_fetch_assoc($resultdata)){ $DetailName = $row["ProductName"]; $DetailPrice = $row["Price"]; $DetailImage = $row["ProductImage"]; $DetailCategory = $row["Category"]; $DetailDetail = $row["ProductDetail"]; $_SESSION["ProdName"] = $DetailName; $_SESSION["ProdPrice"] = $DetailPrice; $_SESSION["ProdImage"] = $DetailImage; $_SESSION["ProdDate"] = date("y.m.d"); $_SESSION["ProdStatus"] = 'Not Paid'; echo '<div class="col-2"> <img src="'.$DetailImage.'" width="100%"> </div> <div class="col-2"> <h3>Category</h3> <p>'.$DetailCategory.'</p> <h1>'.$DetailName.'</h1> <h4>'.$DetailPrice.'php</h4> <form class="buy" action = "" method = "POST"> <a href="../connection/buy.php" name = "buybtn" class="buy-btn">Add to Cart</a> </form> <h3>Product Information</h3><br> <p>'.$DetailDetail.'</p> </div>'; } ?> my buy.php <?php session_start(); if(isset($_SESSION["Usrname"])){ require_once 'connection.php'; $name = $_SESSION["Usrname"]; $PName = $_SESSION["ProdName"]; $Price = $_SESSION["ProdPrice"]; $PImage = $_SESSION["ProdImage"]; $PDate = $_SESSION["ProdDate"]; $PStatus = $_SESSION["ProdStatus"]; $val = $_SESSION["PID"]; $sql = "SELECT * FROM .$name WHERE TrxID = ?"; $stmt = mysqli_stmt_init($conn2); if(!mysqli_stmt_prepare($stmt, $sql)){ echo "cannot buy this product please try again"; } mysqli_stmt_bind_param($stmt, "s", $val); mysqli_stmt_execute($stmt); $resultdata = mysqli_stmt_get_result($stmt); if($row = mysqli_fetch_assoc($resultdata)){ header("location: ../customer/cart.html"); exit(); } else{ $sql = "INSERT INTO .$name (TrxID, ProductName, Price, ProductImage, PurchasedDate, PurchasedStatus) VALUES (?, ?, ?, ?, ?, ?)"; $stmt = mysqli_stmt_init($conn2); if(!mysqli_stmt_prepare($stmt, $sql)){ echo 'connection error'; } mysqli_stmt_bind_param($stmt, "isssss", $val, $PName, $Price, $PImage, $PDate, $PStatus); mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); header("location: ../customer/cart.html"); exit(); } } else{ header("location: ../account.html"); exit(); }
  5. there is no error in syntax i used that code in localhost through xamp and it is fine... the table im using is auto create table when there is a user register he has a table for his own.. i connect into that database, creating table to that database is fine also when there is someone regiter. but when im going to put a value to the columns on that table there is no event that happened
  6. Good day guyz... I dont know why this code does not work... the connection is fine, the database is also fine it works with the localhost, when i upload it on free hosting site like 000webhost and infinityfree this is not working.. the database on free hosting site are also working also the connection is code, just only this code i cant figure it out.. else{ $sql = "INSERT INTO .$name (TrxID, ProductName, Price, ProductImage, PurchasedDate, PurchasedStatus) VALUES (?, ?, ?, ?, ?, ?)"; $stmt = mysqli_stmt_init($conn2); if(!mysqli_stmt_prepare($stmt, $sql)){ echo 'connection error'; } mysqli_stmt_bind_param($stmt, "isssss", $val, $PName, $Price, $PImage, $PDate, $PStatus); mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); header("location: ../customer/cart.html"); exit(); } }
  7. thank you sir i have an idea now, sounds that you are passing the product ID together with the url thank you very much
  8. I think it will change when it loops until no products available..
  9. you mean that there is no way to make this happen? instead for having a product detail page each product? there is no problem when using a link specified to that product because i already have that on database but there a too many products i have to make a product detail page so that they have a specified link.
  10. I think i might doing that already... here is the code: My Product Page <?php session_start(); require_once 'connection.php'; $sql = "SELECT * FROM featuredlist"; $stmt = mysqli_stmt_init($conn1); if(mysqli_stmt_prepare($stmt, $sql)){ mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); while($row = mysqli_fetch_assoc($result)) { $Name = $row["ProductName"]; $Price = $row["Price"]; $Image = $row["ProductImage"]; $Link = $row["ProductLink"]; $_SESSION["ProdID"] = $row["ProductID"]; ---> applying session so that the ID of the product will be passed to the detail page echo '<div class="col-4"> <a href="Ariel-with-downy.html"><img src="'.$Image.'"></a>'; echo '<h4>'.$Name.'</h4> <p>'.$Price.'</p> </div> '; } } else { echo "0 results"; } mysqli_close($conn1); ?> <?php My Product Detail Page require_once '../connection/connection.php'; $sql = "SELECT * FROM featuredlist WHERE ProductID = ?"; $stmt = mysqli_stmt_init($conn1); if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'connection error'; } $value = $_SESSION["ProdID"]; -----> i am passing now the Product ID into the variable which is needed for the query. mysqli_stmt_bind_param($stmt, "i", $value); mysqli_stmt_execute($stmt); $resultdata = mysqli_stmt_get_result($stmt); if($row = mysqli_fetch_assoc($resultdata)){ $DetailName = $row["ProductName"]; $DetailPrice = $row["Price"]; $DetailImage = $row["ProductImage"]; $DetailCategory = $row["Category"]; $DetailDetail = $row["ProductDetail"]; echo '<div class="col-2"> <img src="'.$DetailImage.'" width="100%"> </div> <div class="col-2"> <h3>Category</h3> <p>'.$DetailCategory.'</p> <h1>'.$DetailName.'</h1> <h4>'.$DetailPrice.'php</h4> <form class="buy" action = "" method = "POST"> <a href="../Connection/buy.php" name = "buybtn" class="buy-btn">Add to Cart</a> </form> <h3>Product Information</h3><br> <p>'.$DetailDetail.'</p> </div>'; } ?> My problem is when i click the product in the product page, it shows the last product on the detail page.
  11. I have a product page which populates all my products in one page. I have also a detail page which gives details on a product which i wanted to know. My problem is when I am going to click on the product that I want the detail page shows incorrect product details. I just want one detail product page so that it will be easy to edit the page in the future. I am asking an Idea on how to make one detail page in all of my products.. thanks...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.