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 8147279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:17:57+00:00 2026-06-06T14:17:57+00:00

I’m really struggling with this. I have a viewdetails.php page, addnew.php page and a

  • 0

I’m really struggling with this. I have a viewdetails.php page, addnew.php page and a php.php. The php.php page has my query for both pages. First I have the query that displays results on viewdetails.php and second is the query that displays results on addnew.php page. The problem I’m having is when I open addnew.php in a browser it gives me errors regarding the path to dbandpassword.php and for other items in the query for viewdetails.php.

How do I keep all these queries in one page (php.php) and keep them separate so I don’t get errors? Should I be combining the two queries together or maybe just some of it together? I know the code needs to be cleaned up, I’m not worried about that right now. I also know that the queries both work individually if put in their own file (php.php, php2.php).

 <?php

 ob_start(); 
 require("../admin/dbandpassword.php");
 ob_end_clean(); 

// FETCH LEAD INFORMATION - this is query for viewdetails.php

 $query = ("SELECT * FROM contacts WHERE contacttype IN ('Buyer','Seller','Buyer / Seller','Investor') AND leadstatus = 'New' ORDER BY date DESC");

$result = $mysqli->query($query) or die ("Error: ".mysqli_error($mysqli,$query));
while ($row = $result->fetch_array()) {

$firstname = $row ['firstname'];     
$lastname = $row['lastname'];
$ID = $row['ID'];   
$partner  = $row['spousefirst'];   
$phonecell = $row['phonecell'];
$email = $row['email'];
$date = $row['date'];
$contacttype = $row['contacttype'];
$agentassigned = $row['agentassigned'];
$leadstatus = $row['leadstatus'];

echo'
     <table>
     <tbody>       
     <tr>
        <td width="10"><input type="checkbox" name="" id="" value="'.$ID.'"></td>
        <td><a href="/backend/leads/view/?ID='.$ID.'"><strong>'.$firstname.' '.$lastname.'</strong></a></td>
        <td><a href="/backend/leads/view/?ID='. $ID.'">'.$partner.'</a></td>
        <td>'.$phonecell.'</td>
        <td><a href="mailto:'. $email.'">'.$email.'</a></td>
        <td>'.date("M jS, g:i A", strtotime($date)).'</td>
        <td>'.$contacttype.'</td>
        <td>'.$agentassigned.'</td>
        <td>'.$leadstatus.'</td>
        <td><a href="/backend/contacts/notes.php?ID='.$ID.'">View </a>+</td>
        <td><a href="/backend/contacts/todo.php?ID='.$ID.'">View </a>+</td>
        <td><a href="/backend/contacts/deletesuccess.php?ID='.$ID.'">D</a></td>
       </tr>
       </tbody>
       </table>';
         }

// ADD LEAD - this would be for addnew.php page

       if (isset($_POST['firstname']))
       {

       require("../../admin/dcandpassword.php"); // NOTE THE DIFFERENT PATH THAN ABOVE BECAUSE addnew.php IS A FOLDER DEEPER

       $ID = $_POST['ID'];
       $date = mysqli_real_escape_string($con,$_POST['NOW()']);
       $firstname = mysqli_real_escape_string($mysqli,$_POST['firstname']);
       $lastname = mysqli_real_escape_string($mysqli,$_POST['lastname']);
       $spousefirst = mysqli_real_escape_string($mysqli,$_POST['spousefirst']);
       $spouselast = mysqli_real_escape_string($mysqli,$_POST['spouselast']);
       $primarybday = mysqli_real_escape_string($mysqli,$_POST['primarybday']);
       $spousebday = mysqli_real_escape_string($mysqli,$_POST['spousebday']);
       $phonecell = mysqli_real_escape_string($mysqli,$_POST['phonecell']);
       $phonehome = mysqli_real_escape_string($mysqli,$_POST['phonehome']);
       $phoneoffice = mysqli_real_escape_string($mysqli,$_POST['phoneoffice']);
       $spousecell = mysqli_real_escape_string($mysqli,$_POST['spousecell']);
       $phoneother = mysqli_real_escape_string($mysqli,$_POST['phoneother']);
       $email = mysqli_real_escape_string($mysqli,$_POST['email']);
       $emailspouse = mysqli_real_escape_string($mysqli,$_POST['emailspouse']);
       $emailother = mysqli_real_escape_string($mysqli,$_POST['emailother']);
       $emailspouseother = mysqli_real_escape_string($mysqli,$_POST['emailspouseother']);
       $address = mysqli_real_escape_string($mysqli,$_POST['address']);
       $suite = mysqli_real_escape_string($mysqli,$_POST['suite']);
       $city = mysqli_real_escape_string($mysqli,$_POST['city']);
       $state = mysqli_real_escape_string($mysqli,$_POST['state']);
       $zipcode = mysqli_real_escape_string($mysqli,$_POST['zipcode']);
       $addressother = mysqli_real_escape_string($mysqli,$_POST['addressother']);
       $suiteother = mysqli_real_escape_string($mysqli,$_POST['suiteother']);
       $cityother = mysqli_real_escape_string($mysqli$_POST['cityother']);
       $stateother = mysqli_real_escape_string($mysqli,$_POST['stateother']);
       $zipcodeother = mysqli_real_escape_string($mysqli,$_POST['zipcodeother']);
       $agentassigned = mysqli_real_escape_string($mysqli,$_POST['agentassigned']);
       $contacttype = mysqli_real_escape_string($mysqli,$_POST['contacttype']);
       $contactstatus = mysqli_real_escape_string($mysqli,$_POST['contactstatus']);
       $leadstatus = mysqli_real_escape_string($mysqli,$_POST['leadstatus']);
       $contactsource = mysqli_real_escape_string($mysqli,$_POST['contactsource']);
       $timing = mysqli_real_escape_string($mysqli,$_POST['timing']);
       $password = mysqli_real_escape_string($mysqli,$_POST['password']);
       $subscribesearches = mysqli_real_escape_string($mysqli,$_POST['subscribesearches']);
       $subscribedrips = mysqli_real_escape_string($mysqli,$_POST['subscribedrips']);

       $query = ("INSERT INTO contacts (date, firstname, lastname, spousefirst, spouselast, primarybday, spousebday, phonecell, phonehome, phoneoffice, spousecell, phoneother, email, emailspouse, emailother, emailspouseother, address, suite, city, state, zipcode, addressother, suiteother, cityother, stateother, zipcodeother, agentassigned, contacttype, contactstatus, leadstatus, contactsource, timing, password, subscribesearches, subscribedrips) VALUES (NOW(), '$firstname', '$lastname', '$spousefirst', '$spouselast', '$primarybday', '$spousebday', '$phonecell', '$phonehome', '$phoneoffice', '$spousecell', '$phoneother', '$email', '$emailspouse', '$emailother', '$emailspouseother', '$address', '$suite', '$city', '$state', '$zipcode', '$addressother', '$suiteother', '$cityother', '$stateother', '$zipcodeother', '$agentassigned', '$contacttype', '$contactstatus', '$leadstatus', '$contactsource', '$timing', '$password', '$subscribesearches', '$subscribedrips')");

       mysqli_query($mysqli,$query) or die ("Error: ".mysqli_error($mysqli));

       header("location: http://www.mydomain.com/backend/leads/edit/?ID=".mysqli_insert_id($mysqli));

  exit;
}
  • 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-06T14:17:59+00:00Added an answer on June 6, 2026 at 2:17 pm

    You really do need to worry about more than just separating the queries, but they appear to be independent of one another (one is an INSERT and one is a SELECT, and they aren’t part of a transaction).

    The real error here is probably that you’re requiring the same file twice on a page which is both needless and risky. Delete the second require statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.