-3

My question is I don't see why it won't actually work?I am also new to php so I am learning this PHP. I do not know why it is an unexpected T_VARIABLE and I'm assuming it means " $ "

<?php
   include('database.class.php');
   $sql = new Database(NULL);

   $ids = $sql->select('*', '`ids` ORDER BY `UserId` ASC', NULL, NULL, NULL, true, true);

   $dump = array();
   foreach($ids as $index=>$id);
        $dump[] = $id['UserId'].' | REGLINK - http://xat.com/web_gear/chat/register.php?UserId='.$id['UserId'].'&k2='.$id['k2'].'&mode=1'

   $DumpFile= 'ids.txt';

   if(file_exists($DumpFile)) {
        unlink($DumpFile);
   }
   file_put_contents($DumpFile, implode("\r\n", $dump));
   die(count($dump).' ids were dumped into the list.'."\n");
?>
Kailash Ahirwar
  • 771
  • 3
  • 14
Lexi Schmitt
  • 31
  • 1
  • 1
  • 1
  • 2
    You have missed semicolon `;` after `'&mode=1'`. – BlitZ Sep 21 '13 at 07:44
  • i'm asking for help on my code not a reference guide really. – Lexi Schmitt Sep 21 '13 at 07:45
  • 1
    It is not only for you. It is for those, who may see this thread. SO is not a debugger tool. Still, check my second comment. – BlitZ Sep 21 '13 at 07:46
  • 1
    @LexiSchmitt Put the semicolon as CORRUPT said, and let us know if it helped – user4035 Sep 21 '13 at 07:47
  • Well it's now saying it has a PHP Notice: Undefined variable: id in /root/Desktop/generator/dump.php on line 11 *edit sorry about my rude comment – Lexi Schmitt Sep 21 '13 at 07:48
  • 1
    @LexiSchmitt Undefined variable means, that something is wrong with $ids. var_dump($ids); before foreach. What does it say? – user4035 Sep 21 '13 at 07:50
  • I guess i did not post the full error sorry, PHP Notice: Undefined variable: arrReturn in /root/Desktop/generator/database.class.php on line 127 PHP Warning: Invalid argument supplied for foreach() in /root/Desktop/generator/dump.php on line 10 PHP Notice: Undefined variable: id in /root/Desktop/generator/dump.php on line 11 PHP Notice: Undefined variable: id in /root/Desktop/generator/dump.php on line 11 PHP Notice: Undefined variable: id in /root/Desktop/generator/dump.php on line 11 – Lexi Schmitt Sep 21 '13 at 07:52
  • You should totally read the link @CORRUPT sent you on his first comment its a reference of what the most common errors in PHP mean, and it list both of the errors you have mentioned it would be a great reference guide for you to keep for when u get other errors. – Prix Sep 21 '13 at 07:52
  • Well you haven't posted `/root/Desktop/generator/database.class.php` as that is where one of the errors is. – Prix Sep 21 '13 at 07:53
  • 1
    SO is NOT your debugger tool. Find a _specific_ problem, try to solve it yourself first, then bring the problem and your solution here. – raina77ow Sep 21 '13 at 07:55
  • is there a way i can close my account on this website? it's no use to me because most of the "help" or answers are irrelevant – Lexi Schmitt Sep 21 '13 at 08:00
  • See how to delete an account - http://meta.stackexchange.com/q/5999/184631 And http://stackoverflow.com/help/deleting-account – Ashwini Agarwal Sep 21 '13 at 08:34

1 Answers1

1

you have to put semicolon ; after &mode=1' like :

$ids = $sql->select('*', '`ids` ORDER BY `UserId` ASC', NULL, NULL, NULL, true, true);

$dump = array();
foreach($ids as $index=>$id);
        $dump[] = $id['UserId'].' | REGLINK - http://xat.com/web_gear/chat/register.php?UserId='.$id['UserId'].'&k2='.$id['k2'].'&mode=1';

$DumpFile= 'ids.txt';

if(file_exists($DumpFile)) {
        unlink($DumpFile);
}
file_put_contents($DumpFile, implode("\r\n", $dump));
die(count($dump).' ids were dumped into the list.'."\n");
?>
Osama Jetawe
  • 2,697
  • 6
  • 24
  • 40