Jump to content


Photo

My code is my output :(


  • Please log in to reply
2 replies to this topic

#1 chico1st

chico1st
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 26 July 2006 - 03:34 PM

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)

Update Record

$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!


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 July 2006 - 03:42 PM

Don't you need "<?php" at the beginning?  Otherwise, your httpd server isn't set up properly to handle PHP scripts.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 26 July 2006 - 04:28 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users