superhoops
Members-
Posts
65 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
superhoops's Achievements
Newbie (1/5)
0
Reputation
-
?
-
So the correct code for that would be???
-
[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> </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"> </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"> </td> <td><input type="submit" value="Submit" name="B1"> <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> </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]
-
I had that but if you put them you get errors.
-
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.
-
Thank You very much, it works!
-
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]
-
As i said before the page goes blank when i submit the form, is that what you mean?
-
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?
-
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()); } ?>
-
I am connected, could someone just give me this code to run this query.
-
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?
-
I added it, submitted the form and the page went blank after the form was submitted like before.
-
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?
-
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.