Help No output??? php noob

Reply

Join Date: Oct 2005
Posts: 240
Reputation: Inny is an unknown quantity at this point 
Solved Threads: 6
Inny's Avatar
Inny Inny is offline Offline
Posting Whiz in Training

Help No output??? php noob

 
0
  #1
Mar 13th, 2008
What on earth is wrong with it?

  1. <span class="ad_notxt"><code class="inlinecode">
  2. <?
  3.  
  4. Header("content-type: application/x-javascript");
  5. $chatnames = file('http://client11.addonchat.com/scwho.pl?id=292747&plain=1');
  6.  
  7.  
  8. $indx = count($chatnames);
  9. $indxcom = $indx - 1;
  10.  
  11. if ($indx == 0){
  12. echo "document.write(\"No one is in the chat room at the
  13.  
  14. moment"\)";
  15. }
  16.  
  17. else{
  18. echo "document.write(\"<b>Members Chatting:</b>"\)";
  19.  
  20.  
  21. for($i = 0; $i < $indx; $i++) {
  22.  
  23. $name = explode(' ', $chatnames[$i], 2);
  24.  
  25. echo "document.write(\"$name[0]"\)";
  26.  
  27. if ($i < $indxcom) {
  28.  
  29. echo "document.write(\","\)";
  30. }
  31.  
  32. }
  33. }
  34. ?>
  35.  
  36. </code></span>
  37.  

  1. <script type="text/javascript" src="http://h1.ripway.com/Inny/chat.php"></script>
Last edited by Inny; Mar 13th, 2008 at 3:39 pm.
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 100
Reputation: petr.pavel is an unknown quantity at this point 
Solved Threads: 14
petr.pavel's Avatar
petr.pavel petr.pavel is offline Offline
Junior Poster

Re: Help No output??? php noob

 
0
  #2
Mar 13th, 2008
Hi Inny, read the whole reply to find the error at its end. I'll keep the rest of my original post to show you my track of thoughts which could be helpful for you some other time.

Maybe fopen wrappers aren't enabled. (file('http://...)
Or maybe short_open_tag is off. (<?php versus <?)

Try placing this at the top and call it not with the <script> tag but directly:
  1. error_reporting(255);
  2. ini_set('display_errors','On');

Well, I just called it directly and there are run-time errors that tells you what's wrong:
http://h1.ripway.com/Inny/chat.php

It's difficult to count for me which line is the 13th but I guess you placed a backslash before parenthesis and not before quotation marks:
  1. echo "document.write(\","\)";
  2.  

You should use a text editor with syntax highlighting (e.g. http://www.pspad.com/). Even DaniWeb syntax highlighter would have pointed out the error for you.

Happy coding.
Petr 'PePa' Pavel

The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 240
Reputation: Inny is an unknown quantity at this point 
Solved Threads: 6
Inny's Avatar
Inny Inny is offline Offline
Posting Whiz in Training

Re: Help No output??? php noob

 
0
  #3
Mar 13th, 2008
Your Absolutely Right! I did.
Unfortunately I discovered the main issue: The file no longer exist!

lol

Thanks for your help!
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC