Jump to content

Archived

This topic is now archived and is closed to further replies.

chico1st

My code is my output :(

Recommended Posts

Hey I have this little script it is part of a bigger program but when i run it, it pretty much just prints the php code, which is odd.

Here is my code:
<?

include "spyLib.php";

$dbConn = connectToSpy();

$fieldNames = "";
$fieldValues = "";

foreach ($_REQUEST as $fieldName => $value){
  if ($fieldName == $_POST['tableName']){
    $theTable = $value;
  } else {
    $fields[] = $fieldName;
    $values[] = $value;
  } // end if
} // end foreach

print updateRec($theTable, $fields, $values);

print mainButton();

?>

And the output is: (but all on one line)

[b]Update Record[/b]

$value){
  if ($fieldName == $_POST['tableName']){
    $theTable = $value;
  } else {
    $fields[] = $fieldName;
    $values[] = $value;
  } // end if
} // end foreach

print updateRec($theTable, $fields, $values);

print mainButton();

?>

(i also tried replacing the => with a ->... because i didnt know the difference)

Any help would be awesome.
Sincerely
THANKS!

Share this post


Link to post
Share on other sites
Don't you need "<?php" at the beginning?  Otherwise, your httpd server isn't set up properly to handle PHP scripts.

Share this post


Link to post
Share on other sites
PHP may not have a setting called short_open_tag enabled which allows you to use <? as an opeing tag and <?= a shortcut for <?php echo . Try fenways suggestion by using the full opening tag <?php

Share this post


Link to post
Share on other sites

×

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.