Page 1 of 1

Problem uploading php and html to apache

PostPosted: 02. July 2007 01:56
by SirChick
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 ?

PostPosted: 03. July 2007 05:59
by davidspan
just put it all in a .php file

PostPosted: 03. July 2007 14:18
by SirChick
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

PostPosted: 03. July 2007 19:14
by davidspan
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

PostPosted: 05. July 2007 23:40
by SirChick
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";
}
}
?>

PostPosted: 06. July 2007 06:57
by davidspan
what is the error your getting?

PostPosted: 06. July 2007 14:21
by SirChick
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'])) {

PostPosted: 10. July 2007 21:03
by SirChick
anyone?

PostPosted: 21. July 2007 04:39
by Eric Pement
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.