Jump to content

fmax

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

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

fmax's Achievements

Member

Member (2/5)

0

Reputation

1

Community Answers

  1. i have created config.inc.php in root and include that file along with header / css / js include files. In config.inc.php for local development i use $_SERVER['DOCUMENT_ROOT'] which is returning correct path and on server i use getcwd(); which is returning path to public_html
  2. Dear Danish Hafeez Thank you for your reply, what you have suggested is working fine in normal folder structure. I might be wrong with folder structure, my folder structure looks like this TESTFOLDER/assets/styles/style.css TESTFOLDER/includes TESTFOLDER/dist TESTFOLDER/fonts TESTFOLDER/js TESTFOLDER/module1/models TESTFOLDER/module1/views TESTFOLDER/module1/contrls TESTFOLDER/module1/public What i am trying to do is to access TESTFOLDER/assets/styles/style.css inside TESTFOLDER/module1/public/index.php TESTFOLDER/module1/public/dash.php TESTFOLDER/module1/public/01.php TESTFOLDER/module1/public/02.php is it possible to do it with single file named config.php and call it on all module folders
  3. 1. Example On my computer <?php include $_SERVER['DOCUMENT_ROOT'].'/assets/filename.php';?> works in localhost 2. When i upload files to webserver in " public_html " it is throwing error warning file doesnot exist in websitename/private_html/assets/filename.php
  4. Hi All Currently i am using $_SERVER['DOCUMENT_ROOT'], Its working fine in localhost. But when i move to web its not taking actual files instead its accessing private_html folder. If my folder structure is like below assets includes module1 module1 sub folder 1 module1 sub folder 2 module1 sub folder 3 module2 module2 sub folder 1 module2 sub folder 2 module2 sub folder 3 What would be the best way to access the assets & includes folder files inside sub folders ?
  5. (): Argument #1 ($pdo) must be of type object, null given
  6. Hi All Using MVC Model i am stuck on multiple dependent combobox, My first combobox model code is as follows function getCompanyName(object $pdo){ $query = "SELECT * FROM MASTER_COMPANY;"; $companyNameStmt = $pdo->prepare($query); $companyNameStmt->execute(); $companyNameresult = $companyNameStmt->fetchAll(PDO::FETCH_ASSOC); return $companyNameresult; } I want to populate to a combobox <select name="FCompName" id="company-id" class="form-select" required=""> <option value="" disabled selected>--- SELECT COMPANY ---</option> <?php ?> </select>
  7. function getUserName(object $pdo, string $pUserName){ $query = "SELECT LOGIN_USERNAME FROM MASTER_LOGIN WHERE LOGIN_USERNAME = :pUserName;"; $stmt = $pdo->prepare($query); $stmt->bindParam(":pUserName",$pUserName); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); return $result; } function username_exists(object $pdo, string $pUserName){ if(getUserName($pdo, $pUserName)) { return true; } else { return false; } } if (username_exists($pdo, $pUserName)){ $errors["username_exists"] = "Username Already Exists"; }
  8. Dear All I am using below 2 PHP functions to insert data to database. Its returning me " Query Failed : SQLSTATE[HY093]: Invalid parameter number: parameter was not defined " error. When i run the SQL in phpMyAdmin query box its working fine. can anyone advice me where i am wrong in PHP code function getLoginId(object $pdo,string $LogID){ $query = "SELECT * FROM MASTER_LOGIN;"; $stmt = $pdo->prepare($query); $stmt->execute(); $count = $stmt->rowCount(); if($count == 0){ $LogID = "LOG0000001"; return $LogID; } else { $LogID = $count + 1; $LogID = str_pad((string)$LogID, 7,"0", STR_PAD_LEFT); $LogID = "LOG".$LogID; return $LogID; } } function set_user($pdo,$pUserName,$pPassword,$LogID){ $LogID = getLoginId($pdo,$LogID); $query = "INSERT INTO MASTER_LOGIN (LOGIN_ID,LOGIN_USERNAME,LOGIN_PASSWORD) VALUES (:LogID,:pUserName,:pPassword);"; $stmt = $pdo->prepare($query); $options = [ 'cost' => 12 ]; $hashedPwd = password_hash($pPassword, PASSWORD_BCRYPT, $options); $stmt->bindParam(":LOGIN_ID",$LogID); $stmt->bindParam(":LOGIN_USERNAME",$pUserName); $stmt->bindParam(":LOGIN_PASSWORD",$hashedPwd); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); return $result; }
  9. Thank you Danish Hafeez for your reply and giving me your valuable advice, I have turned on error reporting and it popped path of db connection php file. I have used your code but it updated all 8 records but i have kept your advice in mind of preparing statement and parameter binding to solve the issue :)
  10. Thank you Barand for a reply, Yes i just turned on and it popped connection issue of PATH and i have sorted it out using code of Danishhafeez
  11. Its No Response from script.
  12. Dear All In a web application for delete, I am using a different way rather than deleting record directly. In future admin can check who has deleted through collected login details. To achieve this i have created a column named COMPANY_STATUS instead of deleting i will change status to "N". The below code works fine in local machine but not working in web server. It is getting stuck at if(mysqli_query($con,$sql)){} Code is a below <?php if (isset($_GET['COMPANY_ID'])) { include('dataconn/connection.php'); $id = $_GET['COMPANY_ID']; $PCompanySts = "N"; $sql = "UPDATE `MASTER_COMPANY` SET `COMPANY_STATUS`='$PCompanySts' WHERE COMPANY_ID='$id'"; if(mysqli_query($con,$sql)){ session_start(); $_SESSION["delete"] = "Company Deleted Successfully!"; header("Location: /Companyindex.php"); }else{ die("Something went wrong"); } }else{ echo "Company does not exist"; } Can someone guide me, what am i doing wrong
×
×
  • 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.