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

  • Home
  • SEARCH
  • 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 4320752
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:40:04+00:00 2026-05-21T08:40:04+00:00

Code in inc/q/prof.php: <?php // Insert Comments into Database that user provides $comm =

  • 0

Code in “inc/q/prof.php”:

<?php
// Insert Comments into Database that user provides
$comm = mysql_real_escape_string($_POST['addComment']);

// following line has changed:
$pID4 = filter_var( $_POST['pID'], FILTER_SANITIZE_STRING );

$commentDetail = $_POST['addComment'];
$username = "###";
$password = "###";
$pdo4 = new PDO('mysql:host=localhost;dbname=####', $username, $password);
$pdo4->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth4 = $pdo4->prepare('
INSERT INTO Comment (info, pID, cID) VALUES(?,?,?) 
SELECT Comm.cID
FROM Professor P, Comment Comm, Course Cou 
WHERE P.pID = Comm.pID
AND Cou.cID = Comm.cID;
'); 
$sth4->execute(array($commentDetail, $pID4, $cID ));


?>

HTML

<form action='inc/q/prof.php' method='post'>
                    <input type='text' id='addComment' name='addComment' tabindex='3' value='Enter comment' />
                <input type='hidden' name='pID' value='<?php echo $pID4; ?>'>

                </form>

Tables:
comm
course
prof

Error still received – I am still getting error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT Comm.cID FROM Professor P, Comment Comm, Course Cou WHERE P.pID = Comm.p' at line 2\PDOStatement->execute(Array) #1

  • 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-05-21T08:40:04+00:00Added an answer on May 21, 2026 at 8:40 am

    You can pass them as both hidden input fields. It appears as though you already have that for pID:

    <input type="hidden" name="pID" value="<?php echo $pID4 ?>" />
    

    Also, ensure you are actually posting the correct fields and values. Add the following to the top of prof.php:

    print_r($_POST);
    

    My guess is your not actually passing anything for $_POST['pID']

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

Sidebar

Related Questions

I have this HTML: <?php if(!empty($_GET['pID'])) $the_pID = mysql_real_escape_string($_GET['pID']); #echo $the_pID; ?> <form action=inc/q/prof.php?pID=<?php
Please look at the code below. require_once(initvars.inc.php); require_once(config.inc.php); ?> <?php if($latestads_count) { ?> <div
Alright, when I compile this bit of code to test: <?php require('index.inc'); $page =
HTML <form action=inc/q/prof.php?pID=<?php echo $the_pID; ?> method=post> <select id=courseInfoDD name=courseInfoDD tabindex=1><?php while($row3 = $sth3->fetch(PDO::FETCH_ASSOC))
Some PHP code worked well. However, when I port the code into a Drupal
If you code in C and configure your compiler to insist that all functions
I'm using a hash table (source code by Google Inc) to store some method
0x042444FF; /* inc dword ptr [esp+4] */ 0x042444FF is the machine code,while inc dword
I find this code useful and want to copy-paste it into my application which
<?php //require 'includes/db.inc.php'; require 'includes/configs.inc.php'; ?> <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>

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.