Jump to content

Recommended Posts

Im in need of some help, im trying to learn more about php and iis. I have a simple site on a win 2k3 server. everything was going fine until dreamweaver asked about being the site manager and boom most of my php stuff isnt working anymore. I checked the see if what verbs i was allowing and its set to allow all on the site main and site levels. My php config page still comes up so php is working.

 

 

This page worked before dreamweaver did its thing but now all i get is a 500 error when i try and access it

 

<?php

function square($num)

{

$num *= $num;

return $num;

}

$someNum = 6;

echo(Variable before going into the function =  . $someNum);

$results = square($someNum);

echo(<br>Variable after going into the

function =  . $someNum . <br>Results of

function =  .$results);

?>

 

 

 

here is what my log file says.

 

#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status

 

2008-10-09 18:13:31 W3SVC1 172.16.0.4 GET /numbers.php - 80 - 172.16.0.23 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022;+InfoPath.2) 500 0 0

 

 

I turned on the display errors and it reads:

Parse error: syntax error, unexpected T_STRING in D:\phptest\numbers.php on line 8

 

It says thing similar to this on other php files i have that were working before.

 

 

Any help would be greatly apprectiated, thanks.

Looks like you have some syntax errors not get and post.  Change these lines

 

echo("Variable before going into the function = " . $someNum);
$results = square($someNum);
echo("
Variable after going into the function = " . $someNum . " 
Results of function = " . $results);

everything was going fine until dreamweaver asked about being the site manager and boom most of my php stuff isnt working anymore.

 

What exactly happened?  I only use dreamweaver to edit, not sure about their wizards and managers.  Seems like it altered a lot of your code.  Did you have a backup?

First off thanks for taking the time to help me figure this out.

 

It started about a week ago. At first i was using notepad to edit the pages but then i switched to dreamweaver. All was fine until the site manager wizard came up and i went through that. I did enable server technology. After that i started getting the 500 errors on some of the pages that had previously been working. Even the scripts i get from my pdf and online sources are getting these errors.

 

 

As you see in the other example the error was in the echo so i found an echo example to test the code and i found this script:

 

<?php

$my_string = "Hello Bob.  My name is: ";

$my_number = 4;

$my_letter = a;

echo $my_string;

echo $my_number;

echo $my_letter;

?>

 

actual print out:

 

Notice: Use of undefined constant a - assumed 'a' in D:\phptest\echo.php on line 4

Hello Bob. My name is: 4a

 

i went back changed

 

$my_number = 4;

$my_letter = a;

to

$my_number = "4";

$my_letter = "a";

 

and it worked fine

 

Since im new to the php code im not totally sure whats going on but argh! its annoying lol

 

heres a form i modified to have people reserve resources on our intranet i was going to have it connect to a mysql database in the future

 

 

 

<HTML>

<HEAD>

<TITLE>Processing All Form Elements</TITLE>

</HEAD>

<BODY BGCOLOR=”#ffffff”>

<FORM name=”frm_Example” action=”allformelements.php” method=”post”>

<table border=”0” cellpadding=”2” cellspacing=”0”>

<tr>

<td align=”left” valign=”top”><b>Your Name?</b></td>

<td align=”left” valign=”top”><input type=”text” name=”strname”></td>

</tr>

<tr>

<td align=”left” valign=”top”><b>Hours Needed</b></td>

<td align=”left” valign=”top”>

 

<select name=”dblhour”>

<option value=”1”>1</option>

<option value=”2”>2</option>

<option value=”3”>3</option>

</select>

</td>

</tr>

<tr>

<td align=”left” valign=”top”><b>Confrence room needed</b></td>

<td align=”left” valign=”top”>

<input type=”radio” name=”strLocation” value=”Main”>main

<input type=”radio” name=”strLocation” value=”Glass” checked>Glass

<input type=”radio” name=”strLocation” value=”Creative”>Creative

</td>

</tr>

<tr>

<td align=”left” valign=”top”><b>Equipment</b></td>

<td align=”left” valign=”top”>

<input type=”checkbox” name=”nEquipmentID[]” value=”1” checked>Projector

<input type=”checkbox” name=”nEquipmentID[]” value=”2” checked>Speakers

<input type=”checkbox” name=”nEquipmentID[]” value=”3” checked>Microphone

 

</td>

</tr>

<tr>

<td align=”left” valign=”top” colspan=”2”><input type=”submit” value=”Submit”></

td>

</tr>

</table>

</FORM>

 

 

 

<?php

if($_POST)

{

$strname = $_POST[‘strname’];

$dblhour = $_POST[‘dblhour’];

$strLocation = $_POST[‘strLocation’];

echo=(You Chose <br> $strname <br> $dblhour <br> $strLocation <br>);

$listvals = $_POST[‘nEquipmentID’];

for($i=0;$i<count($_POST[‘nEquipmentID’]);$i++)

echo “Equipment ID $i=”.$listvals[$i].”<br>\n”;

}

?>

</BODY>

</HTML>

 

 

This did work but all i get now is:

Parse error: syntax error, unexpected '=' in D:\phptest\equipment.php on line 56

Sorry this is line 56

i changed it to

 

echo "You Chose";

echo $strname;

echo $dblhour;

echo $strLocation;

 

which got rid of my error

looks like somehow the code needs to be changed for some reason and this is where the learning curve kicks in!

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\phptest\equipment.php on line 62

 

line 62

echo Equipment ID $i=.$listvals[$i].<br>\n;

well looks like i have some learning to do!

  • 2 weeks later...

The "=" sign mentioned is a result of DW's re-rendering of the code. I am experiencing the same behavior and I am writing in ColdFusion. DW is destroying all my code. It is rather frustrating to say the least.

 

If anyone can offer instructions to prevent DW from rewriting code I think that's what we're all after here.

 

Thanks!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.