Djkanna Posted April 10, 2011 Posted April 10, 2011 Because there is no value for the specific key, try this; $array_gete = array($_GET); while ($tick = current($array_gete)) { $thekey = key($array_gete); if (isset ($_GET[$thekey])) { $_GET[$thekey] = str_replace('=', '', htmlspecialchars($_GET[$thekey])); } next($array_gete); } Quote
Daron Posted April 10, 2011 Author Posted April 10, 2011 ah another isset. i tried it myself but it didnt work. i must have put it in wrong unless u did something else besides adding a isset. Quote
Daron Posted April 10, 2011 Author Posted April 10, 2011 WARNING: mysql_fetch_array() expects parameter 1 to be resource, boolean $blah=mysql_query("SELECT * FROM comments WHERE cmtTO={$r['userid']} ORDER BY cmtTIME DESC limit 5", $c); while($cmnt=mysql_fetch_array($blah)) { $they=mysql_query("SELECT * FROM users WHERE userid={$cmnt['cmtFROM']}",$c); $them=mysql_fetch_array($they); $sent=date('F j, Y, g:i:s a',$cmnt['cmtTIME']); print"<td width=25%><b>{$them['username']} [{$them['userid']}]</br></br></b>$sent</td><Td>{$cmnt['cmtTEXT']}</td>"; if($ir['userid'] == $r['userid'] || $ir['user_level'] > 1) { print"<td width=10%><a href=comments.php?action=delete&ID={$cmnt['cmtID']}>Delete</a></td>"; } on line 2 i tried adding a table called comments to db & made it varchar(140) but that didnt work. Quote
rulerofzu Posted April 10, 2011 Posted April 10, 2011 The way your going about it. If the player has no comments then it will throw that error as there is no userid in the table. So you should check if there is going to be any rows (mysql num rows) if it returns 0 then no need for a query or continue if there is. If your getting that error and there is content in the table then most likely the $r['userid'] is incorrect or not referenced. Quote
Daron Posted April 10, 2011 Author Posted April 10, 2011 ok so i changed the code up but i still get the Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean Its on line 2 $Data=mysql_query("SELECT g.`ID`,g.`SenderID`,g.`RecieverID`,g.`Comment`,u.` userid`,u.`username` FROM `gComments` g LEFT JOIN `users` u "."ON g.`SenderID` = u.`userid` WHERE (`RecieverID` = ".abs(intval($_GET['u'])).") LIMIT 20"); while($cData = mysql_fetch_array($Data)) { echo (' <tr> <td width = "15%">'.htmlentities($cData['username']).'</td> <td>'.stripslashes(htmlentities($cData['Comment'], ENT_QUOTES)).'</td>'); if($ir['userid'] == $r['userid'] || $ir['user_level'] > 1) { print"<td width=10%><a href=comments.php?action=delete&ID={$cmnt['cmtID']}>Delete</a></td>"; } print"</tr>"; } print"</table>"; Quote
Djkanna Posted April 10, 2011 Posted April 10, 2011 $Data = mysql_query ('SELECT `g`.`ID`, `g`,`SenderID`, `g`.`RecieverID`, `g`.`Comment`, `u`.`userid`, `u`.`username` FROM `gComments` `g` LEFT JOIN `users` `u` ON `g`.`SenderID` = `u`.`userid` WHERE (`g`.`RecieverID` = '.abs(intval($_GET['u'])).') LIMIT 20') or trigger_error(mysql_error()); Quote
Daron Posted April 10, 2011 Author Posted April 10, 2011 YES! im so smart! while i was waiting for u to reply i had ended up curing it on my own. i had inserted a echo mysql_error() and it said unknown column u.userid i field list, so i just erased all the 'u' and it worked :) i got the whole comment system done, i had to outsource and mix someone's free mod on her with my own. i did half & half and i got it right. Quote
Daron Posted April 10, 2011 Author Posted April 10, 2011 yup but i tried using what u did earlier to solve another undefined offset. heres what i tried that didnt work error on 4th line while ($tick = current($array_poste)) { $thekey = key($array_poste); if (isset ($_POST[$thekey])) { $_POST[$thekey] = str_replace("=", "", htmlspecialchars($_POST[$thekey])); next($array_poste); and here is the orignal code error on line 3 while ($tick = current($array_poste)) { $thekey = key($array_poste); $_POST[$thekey] = str_replace("=", "", htmlspecialchars($_POST[$thekey])); next($array_poste); Quote
Djkanna Posted April 10, 2011 Posted April 10, 2011 yup but i tried using what u did earlier to solve another undefined offset. heres what i tried that didnt work error on 4th line while ($tick = current($array_poste)) { $thekey = key($array_poste); if (isset ($_POST[$thekey])) { $_POST[$thekey] = str_replace("=", "", htmlspecialchars($_POST[$thekey])); next($array_poste); and here is the orignal code error on line 3 while ($tick = current($array_poste)) { $thekey = key($array_poste); $_POST[$thekey] = str_replace("=", "", htmlspecialchars($_POST[$thekey])); next($array_poste); Close the brackets. After the $_POST[$thekey] = str_replace( ... ); add } Quote
Daron Posted April 10, 2011 Author Posted April 10, 2011 thanx it worked. i feel like i been really working you lately lol srry if i have. but before i begin this process, i wanna know do i suppose to use windows task schelduer to make my cron jobs? i realized my energy & things are replenishing. i know i need to set cron jobs but im not sure is windows task schelduer is right thing to do. Quote
Djkanna Posted April 10, 2011 Posted April 10, 2011 I'm not sure, I'm not even sure what Windows Task Scheduler is, this part isn't my forte sort to speak, maybe RulerOfZu can help you out here. ;) Quote
Daron Posted April 11, 2011 Author Posted April 11, 2011 ok i was told by a freind to skip crons for now since its a offline wbsite. he crons is a given with a host. but do u know how to create weapons & shops? like i see the tables in the db but i have no clue how to make the shops & items. especially items, like how to set the damage formula for weapons & etc. Quote
rulerofzu Posted April 11, 2011 Posted April 11, 2011 I'm not sure, I'm not even sure what Windows Task Scheduler is, this part isn't my forte sort to speak, maybe RulerOfZu can help you out here. ;) http://cronw.sourceforge.net/ As for the items etc. Thats what your admin staff panel is used for :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.