Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8137373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:05:45+00:00 2026-06-06T11:05:45+00:00

I have folders and pages /admin/add/index.php, /admin/edit/index.php & /admin/view/index.php which all are requiring page

  • 0

I have folders and pages /admin/add/index.php, /admin/edit/index.php & /admin/view/index.php which all are requiring page /admin/php.php which has all of my php code for each, I’m getting fail to open stream errors. Should I be seperating them with <? ?> or is doing what I’m doing not possible or the best approach?

My admin/php.php file:

<?php
FOR ADD CONTACT PAGE

require ("../../dbandpassword.php");
$ID = $_POST['ID'];
$firstname = mysqli_real_escape_string($con,$_POST['firstname']);
$lastname = mysqli_real_escape_string($con,$_POST['lastname']);

$sql = "INSERT INTO table (firstname, lastname) VALUES ('$firstname', '$lastname')"; 

mysqli_query($con,$sql) or die ("Error: ".mysqli_error($con));

header("location: http://www.mydomain.com/admin/edit/?ID=".mysqli_insert_id($con));

exit;
}
FOR EDIT CONTACT PAGE

require ("../../dbandpassword.php");
$ID = $_POST['ID'];
$firstname = mysqli_real_escape_string($con,$_POST['firstname']);
$lastname = mysqli_real_escape_string($con,$_POST['lastname']);

$sql = "UPDATE table SET `firstname` = '$firstname', `lasttname` = '$lastname' WHERE `table`.`ID`  = '$ID' LIMIT 1";

mysqli_query($con,$sql) or die ("Error: ".mysqli_error($con));

FOR VIEW CONTACT PAGE

require ("../../dbandpassword.php");

$ID = $_GET['ID'];

$sql = "SELECT * FROM table WHERE ID='$ID' limit 1" or die ('Error: ' .mysqli_error());

$query = mysqli_query($con,$sql) or die ('Error: ' .mysqli_error($con));
$row = mysqli_fetch_array($query);

$space = (!empty($row['firstname']) && !empty($row['lastname'])) ? ' ' : '';        
$name = $row['firstname'].$space.$row['lastname'];       

mysqli_query($con,$sql) or die ("Error: ".mysqli_error($con));

FOR VIEW ALL CONTACTS PAGE

require ("../dbandpassword.php");

$ID=$_GET['ID'];

$query = "SELECT * FROM table WHERE firstname IN ('Bob','Joe') AND lastname = 'Smith' ORDER BY date DESC";

$result=mysqli_query($con,$query);
while ($row = mysqli_fetch_array($result)) {

$space = (!empty($row['firstname']) && !empty($row['lastname'])) ? ' ' : '';        
$name = $row['firstname'].$space.$row['lastname'];   

mysqli_query($con,$query) or die ("Error: ".mysqli_error($con));
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:05:48+00:00Added an answer on June 6, 2026 at 11:05 am

    Its better to create a php file and then create separate function for each of the action like

    function insert()
    {
    
    }
    
    function delete()
    {
    
    }
    
    function update()
    {
    
    }
    
    function fetch()
    {
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My folder structure is like - root admin create_page.php pages my_page1.php my_page2.php I have
I have a table FOLDERS ,everytime a folder is added through a php page
I have a page in HTML(index.html), and a folders named images, css, js that
I have an Admin folder which contains 4-5 aspx pages. I want to that
My plugin which adds a menu in admin page has two files. The code
Is it possible to have multiple login pages for different folders within an asp.net
I have a php page inside a folder on my website. I need to
I'm creating a dynamic website with php & mysql. I've 2 folders, one is
i have created a photography website with an admin page that uploads photos to
I have got tinyMCE working in the django admin, but all the popups are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.