Jump to content

Greaser9780

Members
  • Posts

    326
  • Joined

  • Last visited

    Never

Everything posted by Greaser9780

  1. session_start(); must be places just like this: <?php session_start();
  2. What Browser are you using? Firefox,Internet Explorer?
  3. If it helps here is the file that shows the first dropdown: <html> <head> <script src="selectuser.js"></script> </head> <body> <div align="center"> <form> <select name="users" onchange="showUser(this.value)"> <option>QB <option>WR <option>RB <option>TE <option>K <option>DF </select> </form> </div> <div id="txtHint"> </div> </BODY> </html> And here is the js file: var xmlHttp function showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="showUser.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
  4. Tried that too. I just can't figure out why the variable gets passed in FF but not in IE makes no sense. If I take the q part out of the query it lists all 400 or so from the db.
  5. <?php $q=$_GET["q"]; include("db.php"); $sql="SELECT name FROM players WHERE position='".$q."' ORDER BY name ASC"; $result = mysql_query($sql); ?> <html> <head> </head> <body> <form action="select.php" method="post"> Comment:<input type='text' name='com' maxlength='80'><br> <select name="playername"> <?php while($row = mysql_fetch_array($result)) { echo "<option value='" . $row['name'] . "'>" . $row['name']."</option>" ; } ?> </select> <input type="submit" name="submit" value="select"> </form> </body> </html> At first I thought it was an AJAX issue but it's showing what it is supposed to show. The preceding script is what it is supposed to show. If I take out the "q" part it works fine. So I am wondering why Q is not passed in IE but it is in firefox.
  6. I'm not a huge AJAX guy I just started learning. One thing I know from PHP though, I don't even see a need for you to be using php to show any of that. Why not just use html? <HTML> <HEAD> <TITLE>The Angry Dragon</TITLE> <script src="jsFunctions.js" language="javascript" type="text/javascript"></script> <script src="ajax.js" language="javascript" type="text/javascript"></script> </HEAD> <BODY BGCOLOR="#FFFFFF" onLoad="javascript:mainOnLoad();"> <CENTER> <FONT COLOR="#000000"><H1></H1></FONT> <TABLE WIDTH=85% BORDER=1> <TR> <TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=leftFrame ID=leftFrame></DIV><TD></TR></TABLE></TD> <TD WIDTH=60% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=centerFrame ID=centerFrame></DIV><TD></TR></TABLE></TD> <TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=rightFrame ID=rightFrame></DIV><TD></TR></TABLE></TD> </TR> </TABLE> <CENTER> </BODY> </HTML> Add to that all of the table and td declarations should be in ""
  7. I get no errors in FF but in IE I get the following: Line: 16 Char: 1 Error: Unknown name. Code: 0 URL:blahblahblah
  8. Here is the .js file: var xmlHttp function showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://www.blah.com/blah/showUser.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
  9. NOPE Page sending I have this now: if ($actsum < 20){ $sql1 =mysql_query("SELECT name FROM `draft_teams` ORDER BY activate ASC, teamid DESC LIMIT 1"); $res1=mysql_fetch_array($sql1); $name1=$res1["name"]; $pd=$res1['pd']; $id=$res1['teamid']; header("Location: http://www.BLAH.com/mocks/functions.php/?id=".$res1['teamid']); exit(); } Accepting page I have this: <?php include("db.php"); $id=$_GET['id']; echo $id ; It's redirecting properly. If I change $id to "BLAH" it shows up. I can't figure out why it's not sending the value of $id
  10. No error now. It still doesn't seem to be passing the id though. I have $id=$_GET['id']; at the beginning of the next script.
  11. header(\"Location: http://www.blah.com/mocks/functions.php/?id=".$res1['teamid']."\"); This must be the wrong way to send this.
  12. Would it be possible to have it run a check to see if it needs to update every time a certain row is updated?
  13. Is it possible to have mysql do something everytime it updates a certain table? I have a function I would like to run evertime a table is updated.
  14. Did U run it in firefox? You can error check with that browser.
  15. Is that the whole code? I don't see any <?php and ?> tags at beginning and end.
  16. echo "<td align=\"left\" width=\"50%\" height=\"35\">Welcome " . ucfirst($name) . "! </td>"; echo "<td align=\"left\" width=\"50%\" height=\"35\">Welcome " . $name['ucfirst'] . "! </td>";
  17. I am wondering how to go about this in PHP. I need to write a script that constantly detects which teams turn it is. Then if they have preselected players for their team it will update the db the second it becomes their turn. Everytime a teams selection is made it has to check for this and either update or exit. The problem is, if it updates, it automatically needs to run again because it was just updated. Not lookin fo rcode here just suggestion on how to make it happen. I thought of a CRON job but that will not be automatic as I can only run a CRON every minute. This is how I determine turn as of now. In the teams table I have a row labelled activate every time this team picks a player activate is incremented. So I run a query to return a list of teams ordered by activate ASC then by teamid ASC. I am not sure if this is even possible with only PHP.
  18. showUser.php is not getting the variable $q. Any clue how to force showUser to get Q. I need showUser.php to know which position was selected so it can send the proper query to show.
  19. Tried <option selected></option> and it still always uses the last dropdown mox and tries to input a blank value in my table. I think the problem with this setup is all the dropdown still exist they are just hidden. Eventhough they are hidden they still hold data. That's why I went with the other script I posted under.
  20. If youmean the ; I inserted it because firefox showed an error message saying it needed to be in there. I still get the same message as before without it. I just get an extra error saying I need to put it there.
  21. Here is my select box that calls the js: <html> <head> <script src="selectuser.js"></script> </head> <body> <form> <select name="users" onchange="showUser(this.value)"> <option>QB</option> <option>WR</option> <option>RB</option> <option>TE</option> <option>PK</option> <option>DF</option> </select> </FORM> <div id="txtHint"> </div> </BODY> </html> Here is the java: var xmlHttpfunction ;showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") } var url="getuser.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } }function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } Here is what it is supposed to show: <?php $q=$_GET["q"]; require("db.php"); $sql="SELECT * FROM players WHERE position = '".$q."'"; $result = mysql_query($sql); ?> <html> <head> </head> <body> <form action="select.php" method="post"> Team name:<input type='text' name='name'> Password:<input type='password' name='pass'> Comment:<input type='text' name='com' maxlength='80'> <select name="playername"> <?php while($row = mysql_fetch_array($result)) { echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>"; } ?> </select> <input type="submit" name="submit" value="select"> </form> </body> </html> Any clues why I keep getting these errors
  22. Here is my select box that calls the js: <html> <head> <script src="selectuser.js"></script> </head> <body> <form> <select name="users" onchange="showUser(this.value)"> <option>QB</option> <option>WR</option> <option>RB</option> <option>TE</option> <option>PK</option> <option>DF</option> </select> </FORM> <div id="txtHint"> </div> </BODY> </html> Here is the java: var xmlHttpfunction ;showUser(str) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") } var url="getuser.php" url=url+"?q="+str url=url+"&sid="+Math.random() xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } }function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } Here is what it is supposed to show: <?php $q=$_GET["q"]; require("db.php"); $sql="SELECT * FROM players WHERE position = '".$q."'"; $result = mysql_query($sql); ?> <html> <head> </head> <body> <form action="select.php" method="post"> Team name:<input type='text' name='name'><br> Password:<input type='password' name='pass'><br> Comment:<input type='text' name='com' maxlength='80'><br> <select name="playername"> <?php while($row = mysql_fetch_array($result)) { echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>"; } ?> </select> <input type="submit" name="submit" value="select"> </form> </body> </html> Any clues why I keep getting these errors.
  23. I was using INSERT now() + INTERVAL 5 MINUTE Since I added the -57600 it appears to be working properly. I am only showing hours,minutes, seconds though Now I am having trouble getting the cronjob timer to work right since it never displays a negative number. I change the CRON script to if $disp >300 <-----number of seconds in 5 minutes. The timer should stay close to 5 minutes
×
×
  • 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.