onthespot
Members-
Posts
424 -
Joined
-
Last visited
Never
Everything posted by onthespot
-
Hey guys, the SQL query works as I echoed the num rows and there are rows, I just don't think I am displaying very well? <?php $results = mysql_query("SELECT * FROM submittedresults where home_user = '$_SESSION[username]' or away_user = '$_SESSION[username]'"); $num_rows = mysql_num_rows($results); if ($num_rows > 0) { while( $row = mysql_fetch_assoc($results)) { extract($row); $info = explode("_",$row[comp]); if ( $user_submitted != $_SESSION[username]) { ?> <div align="center"> <table cellspacing="10" style='border: 1px dotted' width="300" bgcolor="#eeeeee"> <tr> <td><b><? echo $info[2]; ?></b></td> </tr><tr> <td width="100"><? echo $home_user; ?></td> <td width="50"><? echo $home_score; ?></td> <td>-</td> <td width="50"><? echo $away_score; ?></td> <td width="100"><? echo $away_user; ?></td> </tr><tr> <td><A HREF="confirmresult.php?fixid=<? echo $fix_id; ?>">Accept / Decline</a></td> </tr></table></div><br> <? } } } else { echo "You currently have no results awaiting confirmation"; } ?> Thankyou
-
Can anyone help me?
-
Ok see I told you i was probably wrong! Thought I would at least give it a go. Good luck mate
-
I could be completely wrong but when you select many values change while($r=mysql_fetch_array($result)) to while($r=mysql_fetch_assoc($result)) That might be the problem?
-
Hey, I did this but then it ran the else statement, tried if with both if and else if. Same result. Went all the way through and ran the ELSE statement
-
Ok So i have a problem. I have a piece of code that is capable of taking information from three different forms. <?php if (!empty($_POST)) { if($submissionFrom = "form1") { $query="INSERT INTO ".TBL_AWARDS." VALUES (NULL, '$type','$user', now(), '$acomment')"; if(!$acomment || strlen($acomment = trim($acomment)) == 0) echo "Comment not entered"; else if(!$acomment || strlen($acomment = trim($acomment)) < 10) echo "Comment too short, must be 10 characters at least"; else if (!$acomment || strlen($acomment = trim($acomment)) > 10){ echo "".$_SESSION['username'].", you have added an award to ".$_POST['awarduser']."'s Profile. "; mysql_query($query);} } else if($submissionFrom = "form2") { $query2="INSERT INTO ".TBL_RECOGNITION." VALUES (NULL, '$type2','$user2', now(), '$comment2')"; if(!$comment2 || strlen($comment2 = trim($comment2)) == 0) echo "Comment not entered"; else if(!$comment2 || strlen($comment2 = trim($comment2)) < 10) echo "Comment too short, must be 10 characters at least"; else if (!$comment2 || strlen($comment2 = trim($comment2)) > 10){ echo "".$_SESSION['username'].", you have added recognition to ".$_POST['recuser']."'s Profile. "; mysql_query($query2);} } else if($submissionFrom = "form3") { $query3="INSERT INTO warnings VALUES (NULL, '$type3','$user3', now(), '$comment3')"; if(!$comment3 || strlen($comment3 = trim($comment3)) == 0) echo "Comment not entered"; else if(!$comment3 || strlen($comment3 = trim($comment3)) < 10) echo "Comment too short, must be 10 characters at least"; else if (!$comment3 || strlen($comment3 = trim($comment3)) > 10){ echo "".$_SESSION['username'].", you have warned ".$_POST['warninguser']." "; mysql_query($query3);} } else { echo "There is an error with the forms?"; } } ?> It will not work with the 2nd and 3rd forms meaning that there must be an error with the else if? When i use just IF not else if, it works, but still displays errors for the other 2 forms as they arent submitted. Any way around this?
-
yeah it did, i fixed it and then realised u had too, thanks though. got another error, and i cannot work this out! $query3="UPDATE `fixtures` SET `home_user` = '$newuser', `home_team` = '$newteam', WHERE `home_user` = '$olduser' AND `comp` = '$comp'"; $query4="UPDATE `fixtures` SET `away_user` = '$newuser',`away_team` = '$newteam', WHERE `away_user` = '$olduser' AND `comp` = '$comp'"; $query5="UPDATE `submittedresults` SET `home_user` = '$newuser',`home_team` = '$newteam',WHERE `home_user` = '$olduser' AND `comp` = '$comp'"; $query6="UPDATE `submittedresults` SET `away_user` = '$newuser',`away_team` = '$newteam', WHERE `away_user` = '$olduser' AND `comp` = '$comp'"; Can anyone see any errors with the WHERE and AND clauses. I am getting errors on those with sql error! thnaks
-
Thats giving me a parse error dude?
-
$result = mysql_query("SELECT team FROM ."$_GET['game']_teams".") or die(mysql_error()); How do I get that to work? thankyou, im getting a parse error atm!
-
Solved you used == and i needed =, thanks though
-
Where do i define submissionform?
-
How do i enter into the DB before error checking? Take a second look?
-
hey, my code <?php $query="INSERT INTO ".TBL_AWARDS." VALUES (NULL, '$type','$user', now(), '$acomment')"; if (!empty($_POST)) { // processing logic if(!$acomment || strlen($acomment = trim($acomment)) == 0) echo "Comment not entered"; else if(!$acomment || strlen($acomment = trim($acomment)) < 10) echo "Comment too short, must be 10 characters at least"; else if (!$acomment || strlen($acomment = trim($acomment)) > 10){ echo "".$_SESSION['username'].", you have added an award to ".$_POST['awarduser']."'s Profile. "; mysql_query($query);}} ?> <?php $query2="INSERT INTO ".TBL_AWARDS." VALUES (NULL, '$type2','$user2', now(), '$comment2')"; if (!empty($_POST)) { // processing logic if(!$comment2 || strlen($comment2 = trim($comment2)) == 0) echo "Comment not entered"; else if(!$comment2 || strlen($comment2 = trim($comment2)) < 10) echo "Comment too short, must be 10 characters at least"; else if (!$comment2 || strlen($comment2 = trim($comment2)) > 10){ echo "".$_SESSION['username'].", you have added recognition to ".$_POST['recuser']."'s Profile. "; mysql_query($query2);}} ?> How can I seperate these so that they have a unique way of being different when i submit them?? At the moment when one is submitted, the other says no comment entered. Any way around this? Cheers
-
hey guys, my code <table class="awardtables" cellspacing="3" cellpadding="3"> <?php $awarduser = mysql_real_escape_string($req_user_info['username']); $query = "SELECT * FROM ".TBL_AWARDS." WHERE awarduser = '$awarduser' ORDER BY awarddate"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 10; while($row = mysql_fetch_assoc($result)) { // make the variables easy to deal with $awardtype = $row['awardtype']; // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product if($awardtype != "" && $awardtype != null) echo "<td><img src=\"images/awards/$awardtype.jpg\" width=\"8\" height=\"18\" /></td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> How can i get another row called "awardcomment" and display this when a user hovers over my image with their cursor? thanks
-
First one works a treat, thankyou very much
-
is this the correct way to make this a jpg? echo "<td><img src=\"images/awards/'.$awardtype.'.jpg'\" width=\"8\" height=\"18\" /></td>"; thankyou
-
How can i combine the following? I really have no idea where to even begin here? <table><tr> <td colspan="10"><b><u>Awards:</u></b></td> <tr> <?php function awards($type) { $images = array ( 'league1' => 'first.jpg', 'league2' => 'second.jpg', 'league3' => 'third.jpg' ); if(array_key_exists($type, $images)) return '<td><img src="images/awards/'.$images[$type].'" width="8" height="18" /></td>'; return false; } $awarduser = mysql_real_escape_string($req_user_info['username']); $res=mysql_query("SELECT awardtype FROM ".TBL_AWARDS." WHERE awarduser = '$awarduser' ORDER BY awarddate"); while($row=mysql_fetch_assoc($res)){ $type=$row['awardtype']; echo awards($type); } ?> </tr> </table> and <table cellspacing="3" cellpadding="3"> <?php $query = "SELECT awardtype FROM ".TBL_AWARDS." WHERE awarduser = '$awarduser' ORDER BY awarddate"; $result = mysql_query($query) or die("There was a problem with the SQL query: " . mysql_error()); if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 10; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product if($awardtype != "" && $awardtype != null) echo "<td>$awardtype</td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> Thankyou
-
Ok i have the following <table><tr> <td colspan="10"><b><u>Awards:</u></b></td> <tr> <?php function awards($type) { $images = array ( 'league1' => 'first.jpg', 'league2' => 'second.jpg', 'league3' => 'third.jpg' ); if(array_key_exists($type, $images)) return '<td><img src="images/awards/'.$images[$type].'" width="8" height="18" /></td>'; return false; } $awarduser = mysql_real_escape_string($req_user_info['username']); $res=mysql_query("SELECT awardtype FROM ".TBL_AWARDS." WHERE awarduser = '$awarduser' ORDER BY awarddate"); while($row=mysql_fetch_assoc($res)){ $type=$row['awardtype']; echo awards($type); } if($res && mysql_num_rows($res) > 0) { $i = 0; $max_columns = 10; while($row = mysql_fetch_array($res)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product if($awardtype != "" && $awardtype != null) echo "<td>$awardtype</td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> This doesnt seem to change anything though? Any ideas?
-
I have just taken a look thankyou. I'm unsure how to adapt this into my code though?
-
Hey, I have a function that displays awards in the form of images. However, after every 10 images, i want it to start a new line or <tr>. Here is the code. <table><tr> <td colspan="10"><b><u>Awards:</u></b></td> <tr> <?php function awards($type) { $images = array ( 'league1' => 'first.jpg', 'league2' => 'second.jpg', 'league3' => 'third.jpg' ); if(array_key_exists($type, $images)) return '<td><img src="images/awards/'.$images[$type].'" width="8" height="18" /></td>'; return false; } $awarduser = mysql_real_escape_string($req_user_info['username']); $res=mysql_query("SELECT * FROM ".TBL_AWARDS." WHERE awarduser = '$awarduser' ORDER BY awarddate"); while($row=mysql_fetch_assoc($res)){ $type=$row['awardtype']; echo awards($type); } ?> </tr> </table> How would I go about getting the images to display 10 per row (td)??
-
Hey guys, i have 3 tables that I want to align like 1 2 3 at the moment they are 1 2 3 any ideas, here is the code i have <form action="process.php" method="POST" class="style1"> <table width="20%" style='border: 1px dotted;' bgcolor="#eeeeee" cellspacing="0" cellpadding="3"> <tr> <td>Xbox 360 GT:</td> </tr> <tr> <td><input type="text" name="x360gt" value="x360" /></td> <td></td> </tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subedit1" value="1"> <input type="submit" value="Edit Gamertag"></td></tr> </table> </form> <br> <form action="process.php" method="POST" class="style1"> <table width="20%" style='border: 1px dotted;' bgcolor="#eeeeee" cellspacing="0" cellpadding="3"> <tr> <td>PS3 GT:</td> </tr> <tr> <td><input type="text" name="ps3gt" value="ps3" /></td> <td></td> </tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subedit2" value="1"> <input type="submit" value="Edit Gamertag"></td></tr> </table> </form> <br> <form action="process.php" method="POST" class="style1"> <table width="20%" style='border: 1px dotted;' bgcolor="#eeeeee" cellspacing="0" cellpadding="3"> <tr> <td>PC GT:</td> </tr> <tr> <td><input type="text" name="pcgt" value="pc" /></td> <td></td> </tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subedit3" value="1"> <input type="submit" value="Edit Gamertag"></td></tr> </table> </form> Could anyone help me out please
-
I have tried the list and that doesnt work? Anyone else got any ideas?
-
I did dude it didnt list like i will try again
-
Can anybody help me on this, its driving me nuts