Jump to content

superhoops

Members
  • Posts

    65
  • Joined

  • Last visited

    Never

Everything posted by superhoops

  1. [code] <?php $db = mysql_connect("username", "username", "password") or die("Could not connect."); if(!$db) die("no db"); if(!mysql_select_db("fmpsite_reg",$db)) die("No database selected."); if(!get_magic_quotes_gpc()) ?> <?php mysql_select_db('fmprotasy_reg', $db); $result = mysql_query('SELECT * FROM Pre'); echo '<table border=0 bgcolor=#FF8C00 width=100% cellpadding=10> <tr> <td width=100% valign=top style=border-style: solid; border-width: 2> <p align=left><b><font face=Arial size=2>Pre Match Comments</font></b> </td> </tr> </table> <table border="0" bgcolor="#FF8C00" width="100%" cellpadding="10" height="15"> <tr> <td width="100%" valign="top" height="1" style="border-style: solid; border-width: 2"> <font face="Arial" size="2">As the manager you need to say the right things to win. Here you can rate your chances of success, say a few words to or about the opposition and prepare your players for the match.<br> &nbsp;</font><table border="0" width="100%" id="table1"> <tr> <td width="167"><font face="Arial" size="2">Your Name:</font></td> <td><form action="insertpre.php" method="post"> <input type="text" name="Name" size="32"> </td> </tr> <tr> <td width="167"><font face="Arial" size="2">Your Team:</font></td> <td> <select size="1" name="Team">Team <optgroup label="Premiership"> <option value="Arsenal">Arsenal<option> <option value="Aston Villa">Aston Villa<option> <option value="Birmingham City">Birmingham City<option> <option value="Blackburn">Blackburn Rovers<option> <option value="Bolton">Bolton Wanderers<option> <option value="Charlton">Charlton Athletic<option> <option value="Chelsea">Chelsea<option> <option value="Everton">Everton<option> <option value="Fulham">Fulham<option> <option value="Liverpool">Liverpool<option> <option value="Manchester City">Manchester City<option> <option value="Manchester United">Manchester United<option> <option value="Middlesborough">Middlesbrough<option> <option value="Newccastle United">Newcastle United<option> <option value="Portsmouth">Portsmouth<option> <option value="Sunderland">Sunderland<option> <option value="Tottenham Hotspur">Tottenham Hotspur<option> <option value="West Bromwich Albion">West Bromwich Albion<option> <option value="West Ham">West Ham United<option> <option value="Wigan Athletic">Wigan Athletic<option> <optgroup label="Championship"> <option value="Burnley">Burnley<option> <option value="Cardiff">Cardiff City<option> <option value="Coventry">Coventry<option> <option value="Crystal Palace">Crystal Palace<option> <option value="Derby">Derby<option> <option value="Hull">Hull City<option> <option value="Ipswich">Ipswich<option> <option value="Leeds">Leeds<option> <option value="Leicester">Leicester<option> <option value="Luton">Luton<option> <option value="Norwich">Norwich<option> <option value="Plymouth">Plymouth<option> <option value="Preston">Preston<option> <option value="Queens Park Rangers">Queens Park Rangers<option> <option value="Reading">Reading<option> <option value="Sheffield United">Sheffield United<option> <option value="Southampton">Southampton<option> <option value="Stoke">Stoke<option> <option value="Watford">Watford<option> <option value="Wolves">Wolves<option></select></font><font size="2" face="Arial"> </font></td> </tr> <tr> <td width="167"><font face="Arial" size="2">Chance of Winning:</font></td> <td></font><font size="2" face="Arial"> &nbsp;</font><select size="1" name="Rating">Rating <option value="1">1 <option value="2">2 <option value="3">3 <option value="4">4 <option value="5">5 <option value="6">6 <option value="7">7 <option value="8">8 <option value="9">9 <option value="10">10 </select><b><font face="Arial">/</font><font face="Arial" size="3">10</font></b></td> </tr> <tr> <td width="167"><font face="Arial" size="2">Comments:</font></td> <td> <p><textarea rows="5" name="Comment" cols="34"></textarea></p> </td> </tr> <tr> <td width="167">&nbsp;</td> <td><input type="submit" value="Submit" name="B1">&nbsp;&nbsp; <input type="reset" value="Reset" name="B2"></form></td> </tr> </table> <p><br> <font face="Arial" size="2">Comments by you or other managers:</font><br> &nbsp;</p> echo '<table border=1 width=100% id=table2>'; while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td> <p align=left><font face=Arial size=2><font color=#0000FF> ' . $row['Name'] . '</font> - <font color="#FF0000">' . $row['Team'] . '</font></font></td>'; echo '</tr>'; echo '<tr>'; echo '<td> <p align=center><font face=Arial size=2>' . $row['Comment'] . '</font></td>'; echo '</tr>'; echo '<tr>'; echo '<td> <p align=right><font face=Arial size=2><font color=#006666> Chance of Winning: ' . $row['Rating'] . '</font></font></td>'; echo '</tr>'; } echo ' </table> </td> </tr> </table>'; mysql_close($db); ?> <p> <font face="Arial" size="2"></p> </font> </body> </html> [/code]
  2. I had that but if you put them you get errors.
  3. Here is my code: [code] echo '<table border=1 width=100% id=table2>'; while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td> <p align=left><font face=Arial size=2><font color=#0000FF> ' . $row['Name'] . '</font> - <font color="#FF0000">' . $row['Team'] . '</font></font></td>'; echo '</tr>'; echo '<tr>'; echo '<td> <p align=center><font face=Arial size=2>' . $row['Comment'] . '</font></td>'; echo '</tr>'; echo '<tr>'; echo '<td> <p align=right><font face=Arial size=2><font color=#006666> Chance of Winning: ' . $row['Rating'] . '</font></font></td>'; echo '</tr>'; } echo ' </table> </td> </tr> </table>'; mysql_close($db); ?> [/code] Error: [b]Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/fmprotasy.com/precommentsframe.php on line 115[/b] Line 115 is echo '<table border=1 width=100% id=table2>'; Its probably an easy error but just can't find it.
  4. I get this message with your code: [b] Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/www/fmprotasy.com/insertpre.php on line 23[/b]
  5. As i said before the page goes blank when i submit the form, is that what you mean?
  6. I always had that in the page just i didn't show that code. Do you know how to solve the problem of the textarea data not showing on the databse now?
  7. The whole code of the insertpre page is: <? $db = mysql_connect("username", "db", "password") or die("Could not connect."); if(!$db)   die("no db"); if(!mysql_select_db("fmpsite_reg",$db))     die("No database selected."); if(!get_magic_quotes_gpc()) mysql_select_db("fmprotasy_reg", $con); $Name = addslashes($_POST['Name']); $Comment = addslashes($_POST['Comment']); $sql="INSERT INTO Pre SET         Name = '".$Name."',         Team = '".$_POST['Team']."',         Rating = '".$_POST['Rating']."',         Comment = '".$Comment."'"; echo $sql; if (!mysql_query($sql))   {   die('Error: ' . mysql_error());   } ?>
  8. I am connected, could someone just give me this code to run this query.
  9. ive given you all the code that is required right? This is the code i need to use to run $sql is [code] echo '$sql'; [/code] That correct?
  10. I added it, submitted the form and the page went blank after the form was submitted like before.
  11. Yes i have a field called Comments in my table. here is the code for my createtable.php mysql_select_db("fmpsite_reg", $con); $sql = "CREATE TABLE Pre ( id INT AUTO_INCREMENT PRIMARY KEY, Name varchar(30), Team varchar(30), Rating int(2), Comment varchar(300) )"; I have checked the database, it definately has a field called Comments. When I echo $sql should i delete the insert into Pre stuff?
  12. Do you mean after the form is submitted? it goes blank but thats fine, it did that with my other page as well. Its getting the textarea info into the database.
  13. I think you thought i meant that if someone submitted nothing into the textarea nothing would happen, sorry but this is not the problem. The problem is when people submit data, they fill out all forms and all the results from the forms appear in the databse except what is submitted in the textbox.
  14. I don't understand sorry. I had a previous table in my database and the form i had submitted all the data correctly and i put the addslashes command for the fields with a textbox in. I haven't yet before this one had a text area though so i was wondering what i do?
  15. Please? [b]EDITED BY WILDTEEN88: DO NOT BUMP YOUR THREAD UNLESS IT IS ATLEAST A COUPLE OF HOURS OLD (2HRS MIN). IDEALLY YOU SHOULD BUMP YOUR THREAD EVERY 12-24 HOURS, BUT AS THE PHP HELP FORUM CAN MOVE ALONG VERY FAST 2 HOURS IS FINE[/B]
  16. I have a table on my database with 5 categories and when someone submits the form, all the data appears on the database correctly apart from a field called Comments where people submit data on a textarea on the form and nothing shows up on the database: Here is the code for my insert page: [code] $Name = addslashes($_POST['Name']); $Comment = addslashes($_POST['Comment']); $sql="INSERT INTO Pre SET         Name = '".$Name."',         Team = '".$_POST['Team']."',         Rating = '".$_POST['Rating']."',         Comment = '".$Comment."'"; // echo $sql;  for testing purposes [/code] And here is the code for the text area part of the form: [code] <textarea rows="5" name="Comment" cols="34"></textarea> [/code] IM sure its an easy thing to fix but if anyone would be able to tell me how to do it or slightly amend the insert page code bit i would be very greatful.
  17. Thanks, hat is very starneg as a chatroom i have uses include = blah.php. Thanks
  18. I have a couple of variables and im trying to echo them into my table. Most of is html but i have added the php info where i want it. Here is the code: [code] <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <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>Welcome to FMProtasy</title> </head> <body> <table border="0" bgcolor="#FF8C00" width="100%" cellpadding="10"> <tr> <td width="100%" valign="top" style="border-style: solid; border-width: 2"> <p align="left"><b><font face="Arial" size="2">Tottenham</font></b></td> </tr> </table> <table border="0" bgcolor="#FF8C00" width="100%" cellpadding="10" height="15"> <tr> <td width="100%" valign="top" height="1" style="border- style: solid; border-width: 2"> <p align="center"> <img border="0" src="tot.gif" width="155" height="183" align="left"></p> <table border="0" width="67%" id="table1"> <tr> <td width="163" align="center" bgcolor="#FFFFFF"> <font face="Arial" size="2">Team Name:</font></td> <td align="center" bgcolor="#FFFFFF"><font face="Arial" size="2">Tottenham</font></td> </tr> <tr> <td width="163" align="center" bgcolor="#000000"> <font face="Arial" size="2" color="#FFFFFF">Manager:</font></td> <td align="center" bgcolor="#000000"> <font face="Arial" size="2" color="#FFFFFF">Peter Jobes</font></td> </tr> <tr> <td width="163" align="center" bgcolor="#FFFFFF"> <font face="Arial" size="2">Squad:</font></td> <td align="center" bgcolor="#FFFFFF"><b><font face="Arial" size="2"> <a href="Sprs.txt"><span style="text- decoration: none"> <font color="#000000">Squad</font></span></a></font></b></td> </tr> <tr> <td width="163" align="center" height="20" bgcolor="#000000"> <font face="Arial" size="2" color="#FFFFFF">Division:</font></td> <td align="center" height="20" bgcolor="#000000"> <font face="Arial" size="2" color="#FFFFFF">Premiership</font></td> </tr> <tr> <td width="163" align="center" bgcolor="#FFFFFF"> <font face="Arial" size="2">Stadium Name:</font></td> <td align="center" bgcolor="#FFFFFF"><font face="Arial" size="2"> White Hart Lane Stadium</font></td> </tr> <tr> <td width="163" align="left" bgcolor="#000000"> <p align="center"><font face="Arial" size="2" color="#FFFFFF">Stadium Capacity:</font></td> <td align="center" bgcolor="#000000"> <font face="Arial" size="2" color="#FFFFFF">20,000</font></td> </tr> <tr> <td width="163" align="left" bgcolor="#FFFFFF"> <p align="center"><font face="Arial" size="2">Home Fan Base:</font></td> <td align="center" bgcolor="#FFFFFF"><font face="Arial" size="2">13,000</font></td> </tr> <tr> <td width="163" align="left" bgcolor="#000000"> <p align="center"><font face="Arial" size="2" color="#FFFFFF">Away Fan Base:</font></td> <td align="center" bgcolor="#000000"> <font face="Arial" size="2" color="#FFFFFF">4,000</font></td> </tr> [color=red]<?php include = code.php $val = 10 - $week; echo '<tr>'; echo '<td width="163" align="left" bgcolor="#FFFFFF"> <p align="center"><font face="Arial" size="2">Training Facilities:</font></td> <td align="center" bgcolor="#FFFFFF"><font face="Arial" size="2">Italio         o Flabio - '.$val.' weeks left</font></td>'; echo '</tr>'; ?>[/color] </table> </td> </tr> </table> [/code] The red font is the php part. This is the error message displayed: [b]Parse error: syntax error, unexpected '=' in /home/www/fmprotasy.com/Teams1/Prem/totmain.php on line 78[/b] Im sure ive made an obvious mistake as i am a no but any help would be much appreictaed.
  19. For some reason with this code: [code] <?php $week = "3"; $val = 10 - $week; echo 'There are currently ".$val." weeks left before it is built.'; ?> [/code] It only says this: [b]There are currently ".$val." weeks left before it is built.[/b]
  20. Here is the code for my test page: [code]<?php $week = "3"; echo 'There are currently 10-$week weeks left before it is built.'; ?>[/code] But it displays this [b]There is currently 10-$week weeks left before it is built[/b] Im a newbie and ive been p;layiong around with it but what i want to do it get it to work out 10 minus 3 ($week). What code do i need to do that?
×
×
  • 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.