Problem uploading php and html to apache

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

Problem uploading php and html to apache

Postby SirChick » 02. July 2007 01:56

Hey im not sure if this is just a trvial error on my part or there is a problem here. Im trying to upload my php/html notepad file on to my Apache to run the code for testing.

Now i got the php and the html with mysql in the same notepad file as "register.php" now was wondering should i have put the html seperate with a line calling up the php file, or is it not working for other reasons ?

My error im getting well its like 1000 lines long so i cant really paste it here, but it shows the first line of the code and the line straight after it. But however my sql code in the php file does work its been tested else where so its 100% correct yet im getting an error when i upload it, why is this ?
SirChick
 
Posts: 68
Joined: 19. June 2007 15:03
Operating System: Windows 7 64 bit

Postby davidspan » 03. July 2007 05:59

just put it all in a .php file
XAMPP is one of the topics I write about
MyBlogIt!
davidspan
 
Posts: 47
Joined: 25. June 2007 01:59

Postby SirChick » 03. July 2007 14:18

I tried that but had an error, though i should'nt get one because i tested the code before uploading :S, so the code is fine yet it denies it
SirChick
 
Posts: 68
Joined: 19. June 2007 15:03
Operating System: Windows 7 64 bit

Postby davidspan » 03. July 2007 19:14

there could be a few reasons why it's not working. It might help to see an example but here is a few hints:

If your using just <? try <?php

Also make sure your non-echoed html is not inside <?php tag
XAMPP is one of the topics I write about
MyBlogIt!
davidspan
 
Posts: 47
Joined: 25. June 2007 01:59

Postby SirChick » 05. July 2007 23:40

This is the code do you see anything wrong with it that its not accepting? Cos im stuck


<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];
$Password = $_POST['Password'];
$Password2 = $_POST['Password2'];

If ($Password == $Password2) {
mysql_connect("localhost", "root", "default") or die (mysql_error());
mysql_select_db("civilian") or die (mysql_error());
$query = "INSERT INTO `registrationdetails` (Username) Values ('$Username')";
echo $query;
mysql_query($query) or die(mysql_error());
}
elseif ($Password != $Password2) {
echo "passwords did not match";
}
}
?>
SirChick
 
Posts: 68
Joined: 19. June 2007 15:03
Operating System: Windows 7 64 bit

Postby davidspan » 06. July 2007 06:57

what is the error your getting?
XAMPP is one of the topics I write about
MyBlogIt!
davidspan
 
Posts: 47
Joined: 25. June 2007 01:59

Postby SirChick » 06. July 2007 14:21

My php is fine i tested it and it works i even had a forum for php check that for me, i then checked if "RegistrationSubmission" matched the php and the html which it does its even matched with capital letters so im stumped.

Error:

Error

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];<?php
if (isset($_POST['RegistrationSubmission'])) {

$Username = $_POST['Username'];


SQL query:

<?php if (isset($_POST['RegistrationSubmission'])) { $Username = $_POST['Username'];

MySQL said: Documentation
#1064 - 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 '<?php
if (isset($_POST['RegistrationSubmission'])) {
SirChick
 
Posts: 68
Joined: 19. June 2007 15:03
Operating System: Windows 7 64 bit

Postby SirChick » 10. July 2007 21:03

anyone?
SirChick
 
Posts: 68
Joined: 19. June 2007 15:03
Operating System: Windows 7 64 bit

Postby Eric Pement » 21. July 2007 04:39

SirChick wrote:anyone?

I thought PHP was case-sensitive. So "If" !== "if" (note well!).

You do not check for any return values for mysql_connect or mysql_select_db, although I would never try this without them. Read the PHP recommendations here -- see the examples section:

http://us.php.net/manual/en/function.mysql-connect.php

I notice that you're comparing 2 strings with != instead of strcmp(), although as I see it, a simple else would have done.

The leading if() test is not balanced with an else response.

Finally, backticks `...` are the execution operator in PHP. This may be the cause of a glitch. I am inclined to take them out entirely. HTH.
Eric Pement - pemente [at] northpark [dot] edu
Eric Pement
 
Posts: 25
Joined: 19. May 2007 18:35


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 147 guests