Unable to view .PHP files

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Unable to view .PHP files

Postby hiddenninja » 26. May 2016 20:59

Hello,

Thank you for reading my post.

I'm running XAMPP V3.2.2, I've uploaded some .php files, and i've gone to http://localhost/index.php but for some reason it's just giving me all the php code i've typed, anyone had this issue efore?
hiddenninja
 
Posts: 3
Joined: 26. May 2016 20:56
XAMPP version: 3.2.2
Operating System: Windows 10

Unable to view .PHP files

Postby hiddenninja » 26. May 2016 21:13

I keep getting this error when I view it, but when I put it on a proper domain it works

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\edit.php on line 32

Code: Select all
<?php
include('config.php');
if (isset($_GET['id']) ) {
$id = (int) $_GET['id'];
if (isset($_POST['submitted'])) {
foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); }
$sql = "UPDATE `customers` SET  `date` =  '{$_POST['date']}' ,  `surname` =  '{$_POST['surname']}' ,  `item` =  '{$_POST['item']}' ,  `email` =  '{$_POST['email']}' ,  `items_left` =  '{$_POST['items_left']}' ,  `fault` =  '{$_POST['fault']}' ,  `password` =  '{$_POST['password']}' ,  `progress` =  '{$_POST['progress']}' ,  `diagnosis` =  '{$_POST['diagnosis']}' ,  `work_done` =  '{$_POST['work_done']}' ,  `telephone` =  '{$_POST['telephone']}' ,  `price` =  '{$_POST['price']}' ,  `location` =  '{$_POST['location']}' ,  `done` =  '{$_POST['done']}' ,  `collected` =  '{$_POST['collected']}'   WHERE `id` = '$id' ";
mysql_query($sql) or die(mysql_error());
echo (mysql_affected_rows()) ? "Edited row.<br />" : "Nothing changed. <br />";
echo "<a href='list.php'>Back To Listing</a>";
}
$row = mysql_fetch_array ( mysql_query("SELECT * FROM `customers` WHERE `id` = '$id' "));
?>

<form action='' method='POST'>
<p><b>Date:</b><br /><input type='text' name='date' value='<?= stripslashes($row['date']) ?>' />
<p><b>Surname:</b><br /><input type='text' name='surname' value='<?= stripslashes($row['surname']) ?>' />
<p><b>Item:</b><br /><input type='text' name='item' value='<?= stripslashes($row['item']) ?>' />
<p><b>Email:</b><br /><input type='text' name='email' value='<?= stripslashes($row['email']) ?>' />
<p><b>Items Left:</b><br /><input type='text' name='items_left' value='<?= stripslashes($row['items_left']) ?>' />
<p><b>Fault:</b><br /><input type='text' name='fault' value='<?= stripslashes($row['fault']) ?>' />
<p><b>Password:</b><br /><input type='text' name='password' value='<?= stripslashes($row['password']) ?>' />
<p><b>Progress:</b><br /><input type='text' name='progress' value='<?= stripslashes($row['progress']) ?>' />
<p><b>Diagnosis:</b><br /><input type='text' name='diagnosis' value='<?= stripslashes($row['diagnosis']) ?>' />
<p><b>Work Done:</b><br /><input type='text' name='work_done' value='<?= stripslashes($row['work_done']) ?>' />
<p><b>Telephone:</b><br /><input type='text' name='telephone' value='<?= stripslashes($row['telephone']) ?>' />
<p><b>Price:</b><br /><input type='text' name='price' value='<?= stripslashes($row['price']) ?>' />
<p><b>Location:</b><br /><input type='text' name='location' value='<?= stripslashes($row['location']) ?>' />
<p><b>Done:</b><br /><input type='text' name='done' value='<?= stripslashes($row['done']) ?>' />
<p><b>Collected:</b><br /><input type='text' name='collected' value='<?= stripslashes($row['collected']) ?>' />
<p><input type='submit' value='Edit Row' /><input type='hidden' value='1' name='submitted' />
</form>
hiddenninja
 
Posts: 3
Joined: 26. May 2016 20:56
XAMPP version: 3.2.2
Operating System: Windows 10

Re: Unable to view .PHP files

Postby hiddenninja » 26. May 2016 21:19

Managed to solve this, it was the way the php file ended
hiddenninja
 
Posts: 3
Joined: 26. May 2016 20:56
XAMPP version: 3.2.2
Operating System: Windows 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 61 guests