
skbanta
Members-
Posts
39 -
Joined
-
Last visited
Never
Everything posted by skbanta
-
that helped a lot, pretty easy to understand, i just one more question though, for the Player 1 Wins or Player 2 Wins, if i wanted to use the players names (signed in usernames), would it just be getting username info from their cookies set at sign in?
-
so how would i do two rand(1,6) for each person? i'd give each die a variable like $die1 and $die2 and then add them, but how would i choose a different random for each one and display the picture according to the number generated?
-
what kinda of functions am i going to need to make that script? ive never used any number generator with php yet, just simpler stuff
-
i dont mean it has to be animated, i meant that in when the result is shown it shows a picture of whatever side the dice was rolled for both dice and pictures of what the opponent rolled , like your on one page both players click roll and then another page loads on each's browser displaying pictures of the side of the dice that was rolled with their totals scores under the dice pictures and the winner at the top, is it possible?
-
can someone provide some help on what functions i'd need to code a little game where two people both roll 2 six sided dice and their rolls are added up and whoever has the higher total wins, with graphics for the dice
-
I can't seem to get my code right tonight. My eyes must be a little off, but if anyone can help me find out what is wrong with my code, thanks in advance. <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="767" border="0"> <tr> <td height="73" colspan="2"> </td> </tr> <tr> <td width="119" height="201"> </td> <td width="638" align="left" valign="top"> <?php $con=mysql_connect("localhost","root",""); if (!$con) { die('Problem encountered'); } mysql_select_db("write", $con); $result = mysql_query("SELECT * FROM article"); echo "<table border=''> while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>Title</td>"; echo "<td>" . $row['title'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>Author</td>"; echo "<td>" . $row['author'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" . $row['article'] . "</td>"; echo "</tr>"; } echo "</table>";mysql_close($con); ?> </td> </tr> </table> </body> </html>
-
I've fixed it. Thank you for the help.
-
I followed your comments and got this error: Parse error: syntax error, unexpected T_STRING in C:\wamp\www\write\article.php on line 12
-
I'm not sure whats wrong with this but I keep getting and error. <?php $con=mysql_connect(******) or die ('A problem has occurred'); mysql_select_db(write); $query="INSERT INTO articles (title, article, author, topic) VALUES ('$_POST[title]','$_POST[article]','$_POST[author]','$_POST[topic])"; if (!mysql_query($query,$con)) { die('Problem Encountered'); } echo "Thank You"; mysql_close($con) ?>
-
yeah, so i'd put it in code right after the form? or in the form action code?
-
I don't think I'll ever need to recover the swear, so where would I put it to filter before it is saved to my database?
-
$swears=array('ass','fuck','shit','a$$','ASS','FUCK','SHIT','$hit','bitch','BITCH','porn','PORN','p0rn','P0rn','faggot','fag','FAGGOT','FAG','sex','SEX'); $newword="****" $newword = str_replace( $swears, '****', $newword );
-
I have a swear filter coded, but where would I put it: Into the code for the form action or the code for displaying the information?
-
is this bad code? <?php $con=mysql_connect("*********") if($con) { die('Problem connecting to the database:'.mysyql_error()); } mysql_select_db("kylban5_banta",$con); $result=mysql_query("SELECT entry FROM politics ORDER BY id DESC"); $num=mysql_numrows($result); mysql_close(); $1=0; while($i<$num) { $entry=mysql_result($result,$i,"entry"); }?> <table> <tr> <td><? echo $entry; ?></td> </tr> </table> <? $i++; } echo "</table>"; ?>
-
im using dreamweaver, i couldn't even select anything from my db without tables
-
I changed those and now this "; echo " } echo " "; mysql_close($con); ?> shows up in my browser when I open it
-
Thanks, that was one of my problems, but I can't get the data to show up in my page at all much less in a table. It shows up blank where I have that code. Since I am using dreamweaver Templates does it have to be a php template or can I use an html template and just put the php code into the html?
-
I have my php and I know it's getting to the table, but I need to select it and have it appear in a table in reverse chronological order (newest first) with a date and timestamp at the top (very unsure how I'd code the last part). Here's the code I have: <?php $con=mysql_connect("***","***","***") if($con) { die('Problem connecting to the database:'.mysyql_error()); } mysql_select_db("kylban5_banta",$con); $result=mysql_query("SELECT entry FROM politics"); echo "<table border='1'> while($row=mysql_fetch_array($result)); { echo "<tr>"; echo "<td>".$row['entry']."</td>"; echo "</tr> } echo "</table>"; mysql_close($con); ?> I would also like to be able to delete data after a certain amount of time or so, but I can worry about that later.
-
Still can't get it to work. I look in my database and the username is empty and the password is in my email. The whole row is moved one spot except id and password and username just aren't there. I had a friend register too, but only one item shows up in the table.
-
Does "mysite_username" have to change in the setcookie?
-
<?php include("config.php"); // connect to the mysql server $link = mysql_connect($server, $db_user, $db_pass) or die ("Could not connect to mysql because ".mysql_error()); // select the database mysql_select_db($database) or die ("Could not select database because ".mysql_error()); $match = "select id from $table where username = '".$_POST['username']."' and password = '".$_POST['password']."';"; $qry = mysql_query($match) or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($qry); if ($num_rows <= 0) { echo "Sorry, your username or password is incorrect.<br>"; echo "<a href=index.html>Try again</a>"; echo "or"; echo "<a href=register.html>Register</a>"; exit; } else { setcookie("loggedin", "TRUE", time()+(3600 * 24)); setcookie("mysite_username", "$username"); echo "You are now logged in!<br>"; } ?> There.
-
I realized I was missing a few lines with $match, so I added them, but now it is pulling up my error saying the username/password is incorrect when it is because I checked. Way to fix this?
-
Ok, thanks a lot for that part, I got the database to work, but now the log in wont work. it comes up with this error: "Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/www/bantaproject.100webspace.net/login.php on line 26" here is the log-in code: <?php include("config.php"); // connect to the mysql server $link = mysql_connect($server, $db_user, $db_pass) or die ("Could not connect to mysql because ".mysql_error()); // select the database mysql_select_db($database) or die ("Could not select database because ".mysql_error()); $qry = mysql_query($match) or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($qry); if ($num_rows <= 0) { echo "Sorry, your username or password is incorrect.<br>"; echo "<a href=index.html>Try again</a>"; echo "or"; echo "<a href=register.html>Register</a> exit; } else { setcookie("loggedin", "TRUE", time()+(3600 * 24)); setcookie("mysite_username", "$username"); echo "You are now logged in!<br>"; } ?> (I hope this is one of the last times I have to code a register/log in system)
-
I added this and all the periods after each post, but now I get "Could not insert data because Column count doesn't match value count at row 1" again. I am truly stumped as to what to do.