PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Skunk1311
Forum Newbie
Posts: 11 Joined: Tue Jan 20, 2009 9:22 am
Post
by Skunk1311 » Tue Jan 20, 2009 2:39 pm
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
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Tue Jan 20, 2009 2:49 pm
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()).
Skunk1311
Forum Newbie
Posts: 11 Joined: Tue Jan 20, 2009 9:22 am
Post
by Skunk1311 » Tue Jan 20, 2009 2:54 pm
Tah, no errors now but it still does nothing =/
The info isnt getting submitted into my fields.
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Tue Jan 20, 2009 2:57 pm
are you calling mysql_query()?
Skunk1311
Forum Newbie
Posts: 11 Joined: Tue Jan 20, 2009 9:22 am
Post
by Skunk1311 » Tue Jan 20, 2009 3:00 pm
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.
Skunk1311
Forum Newbie
Posts: 11 Joined: Tue Jan 20, 2009 9:22 am
Post
by Skunk1311 » Tue Jan 20, 2009 3:02 pm
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
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Tue Jan 20, 2009 3:07 pm
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.