|
-
Nov 5th, 2001, 03:41 AM
#1
Thread Starter
Fanatic Member
could you take a look at my code and tell me what I did worng
in poll.htm file:
Code:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Poll</title>
<FONT face=Courier color=#ffcc00 size=2></FONT>
<script language="Javascript">
<!--
function ValidateForm(form) {
if (!form.Answer[0].checked && !form.Answer[1].checked) {
alert("Please choose your answer before submitting!");
form.Answer[0].focus();
return false;
}
}
//-->
</script>
</head>
<body bgcolor="#008000">
<pre><font face="Courier" color="#999999" size="2"></pre>
<p></p>
<center>
<table cellpadding="15" cellspacing="0" border="1">
<tr>
<td bgcolor="#006666"><font face="Arial" size="2" color="#ffffff">Isn't my first PHP poll just excellent? </font></td>
</tr>
<tr>
<td><font face="Arial" size="2" color="#ffffff"><font color="#ffcc00">
<form name="Poll" onSubmit="return ValidateForm(this)" method="post" action="results.php">
<input type="radio" name="Answer" value="1">Yes<br>
<input type="radio" name="Answer" value="2">No<br>
<br>
<input type="submit" value="Submit"> <input type="reset">
</form>
</font><a href="results.php"><font face="Arial" size="2" color="#ffffff">see
the results </font> </a></font></td>
</tr>
</table>
</center>
<p></p>
<pre></pre>
</font>
</body>
</html>
in results.php
PHP Code:
<html>
<title>Poll results</title>
<body>
<center>
<table cellpadding=15 cellspacing=0 border=1>
<tr>
<td bgcolor="#006666">
<font face="Arial" size=2 color="#ffffff">
Isn't my first PHP poll just excellent?
</font>
</td>
</tr>
<tr>
<td>
<font face="Courier" size=2 color="#ffffff">
<body bgcolor="#008000">
<?php
mysql_connect("localhost", "root");
$query = "SELECT votes from polldb WHERE answer_id = 1;";
$result = (mysql_db_query("database", $query));
$row = mysql_fetch_array($result);
$votes = $row["votes"];
echo"Yes: $votes vote(s)<br>";
$query = "SELECT votes from polldb WHERE answer_id = 2;";
$result = (mysql_db_query("database", $query));
$row = mysql_fetch_array($result);
$votes = $row["votes"];
echo"No: $votes vote(s)<br>";
if (isset($Answer)) {
$query = "UPDATE polldb SET votes=votes+1
WHERE answer_id = $Answer;";
$result = mysql_db_query("database", $query);
}
?>
</td>
</tr>
</table>
</center>
</body>
</html>
When I run this code I'm getting 405 error: method not allowed for url /
Any idea why it happens?
Thanks
Q
-
Nov 5th, 2001, 06:42 AM
#2
and which line is the error picked up on ?
-
Nov 5th, 2001, 07:51 AM
#3
Black Cat
Is your webserver configured to accept HTTP POSTs for PHP pages?
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Nov 5th, 2001, 09:07 AM
#4
Conquistador
localhost and root are unneccessary in the db connect function...
-
Nov 5th, 2001, 03:22 PM
#5
Originally posted by da_silvy
localhost and root are unneccessary in the db connect function...
how is he suppose to connect to the database without signing on? only unneccessary if he isn't root. but what if he is doing it from his own computer?
QWERTY, you say when you run the code, well which one?? the top one or the bottom one.
and there is no 405 error, at least not according to this
http://www.w3.org/Protocols/HTTP/HTRESP.html
-
Nov 5th, 2001, 03:41 PM
#6
look at this.
$query = "SELECT votes from polldb WHERE answer_id = 1;";
you don't need the first ; after the 1 take it out.
-
Nov 6th, 2001, 07:51 AM
#7
Black Cat
HTTP 1.1
http://www.w3.org/Protocols/rfc2616/rfc2616.txt
and there is no 405 error, at least not according to this
From the link you posted: "This is a historic document and is not accurate anymore. For up-to-date details on the HTTP specification, see the latest HTTP/1.1 drafts "
The 405 error means the server's not accepting the HTTP POST, which seems like a web server config problem than a programming problem to me...
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Nov 6th, 2001, 08:05 AM
#8
Just to clarify / back that, this is from the current IIS :
-
Nov 7th, 2001, 03:16 AM
#9
Conquistador
Originally posted by scoutt
how is he suppose to connect to the database without signing on? only unneccessary if he isn't root. but what if he is doing it from his own computer?
QWERTY, you say when you run the code, well which one?? the top one or the bottom one.
and there is no 405 error, at least not according to this
http://www.w3.org/Protocols/HTTP/HTRESP.html
If he is connecting as root and localhost, then they are unneccessary.
I'm sure that vbulletin runs mysql off it's server - that would make it a local database. 
I assumed that he is root as he was connecting:
"localhost","root"
-> There is no need to sign on, you are automatically assigned root.
I run mySQL on my computer.
Maybe he wants to test his code (like me) or wants to run a web server ?
-
Nov 7th, 2001, 09:02 AM
#10
I see, but I run mysql for testing purposes too and I have to sign on. wouldn't let me run it unless I did. I can run mysql but to grab and put information I had to sign on. which doesn't bother me as I have to do it on my site as well.
But the whole purpose to test for my site is so I don't have to change much if I run it on my computer to mysite. ie change passwords, user names, links, etc...
-
Nov 7th, 2001, 03:29 PM
#11
Conquistador
-
Nov 7th, 2001, 08:30 PM
#12
I guess he is not going to answer his own thread..... or we won't be able to see if it was the problem or not
-
Nov 7th, 2001, 10:25 PM
#13
Thread Starter
Fanatic Member
Thanks for help guys. The problem was indeed with my server which wasn't properly configured to accept that kind of information. It works now thanks.
-
Nov 8th, 2001, 02:01 AM
#14
Conquistador
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|