Jump to content
MakeWebGames

Notice: Undefined Index: fd ??? Help please


Recommended Posts

Posted

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);
}
Posted

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.

Posted

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.

Posted

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>"; 
Posted
$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());
Posted

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.

Posted

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); 
Posted
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 }

Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...