Page 2 of 2
Re: Help placing mysql results in html table.
Posted: Tue Jan 20, 2009 2:39 pm
by Skunk1311
thanks for replying
Although now i cant get it to submit to my fields.
Code: Select all
<?
$ingame = $_POST['ingame'];
$realname = $_POST['realname'];
$favmap = $_POST['favmap'];
$ctwep = $_POST['ctwep'];
$twep = $_POST['twep'];
$skill = $_POST['skill'];
include ("mysql_connect.php");
$query="INSERT INTO `members` (`ingame`,`realname`,`favmap`,`ctwep`,`twep`,`skill`) VALUES ('$ingame','$realname','$favmap','$ctwep','$twep','$skill');
?>
And the error : Parse error: syntax error, unexpected $end in /home/a4415825/public_html/addmember2.php on line 12
Re: Help placing mysql results in html table.
Posted: Tue Jan 20, 2009 2:49 pm
by Burrito
you're missing a closing quote on that line.
also you should make sure you sanitize your input to avoid sql injection (mysql_real_escape_string()).
Re: Help placing mysql results in html table.
Posted: Tue Jan 20, 2009 2:54 pm
by Skunk1311
Tah, no errors now but it still does nothing =/
The info isnt getting submitted into my fields.
Re: Help placing mysql results in html table.
Posted: Tue Jan 20, 2009 2:57 pm
by Burrito
are you calling mysql_query()?
Re: Help placing mysql results in html table.
Posted: Tue Jan 20, 2009 3:00 pm
by Skunk1311
Aha silly me llol. Ok i got that ill just try and display it now and see what happens.
Ill reply if i need help.
Thanks alot.

Re: Help placing mysql results in html table.
Posted: Tue Jan 20, 2009 3:02 pm
by Skunk1311
Dam i cant get it to display the results
Code: Select all
<?PHP
include 'mysql_connect.php';
echo "<table border='1' width='100%' cellspacing='0' cellpadding='0'>";
$query=mysql_query("SELECT * FROM `members`") or die("Error Occured,plz try again");
while($row=mysql_fetch_array($query))
{
echo "<tr>";
echo "<td>";
echo $row['title'];
echo"</td>";
echo "<td>";
echo $row['realname'];
echo"</td>";
echo "<td>";
echo $row['skill'];
echo"</td>";
echo "<td>";
echo $row['favmap'];
echo"</td>";
echo "<td>";
echo $row['ctwep'];
echo"</td>";
echo "<td>";
echo $row['twep'];
echo"</td>";
echo"</tr>";
}
echo"</table>";
?>
It dies so it shows Error Occured,plz try again as i set above.
edit: just removed the backslashes and it works. thanks alot man. for all ur help
Re: Help placing mysql results in html table.
Posted: Tue Jan 20, 2009 3:07 pm
by Burrito
I don't mind helping you, but you at least need to try some things on your own. You're here to learn and my hand feeding you isn't going to help you obtain that objective very well unless you try some things on your own.
Read what the error says (where the error is occurring) and try to figure out what it means and why it's happening. Try 3 or 4 different things to try and resolve the error. If at that point you still can't get it going, post back with an exact error message and applicable code and I'll take a look at it.