PDA

View Full Version : PHP Help (Very simple!)



iUnknown
05-07-2008, 03:06 PM
Hello,

I'm making a PHP script and I've got a problem.

I get this error:

Parse error: syntax error, unexpected T_VARIABLE in /home/techhos/public_html/staff/radiospy.php on line 68

Here is line 66 - 68 (67 has nothing on it).

$spydata5 = mysql_fetch_array($get_spy_info5);

$open = fsockopen(""$spydata1['ip']"",""$spydata1['port']"");

If anyone has any ideas what I'm doing wrong, let me know. Thanks.

Decode
05-07-2008, 03:08 PM
Hello,

I'm making a PHP script and I've got a problem.

I get this error:

Parse error: syntax error, unexpected T_VARIABLE in /home/techhos/public_html/staff/radiospy.php on line 68

Here is line 66 - 68 (67 has nothing on it).

$spydata5 = mysql_fetch_array($get_spy_info5);

$open = fsockopen(""$spydata1['ip']"",""$spydata1['port']"");

If anyone has any ideas what I'm doing wrong, let me know. Thanks.
I think this should work;



$spydata5 = mysql_fetch_array($get_spy_info5);

$open = fsockopen($spydata1['ip'], $spydata1['port']);


or if not, then this;



$spydata5 = mysql_fetch_array($get_spy_info5);

$open = fsockopen(" . $spydata1['ip'] . ", " . $spydata1['port'] . ");

iUnknown
05-07-2008, 03:16 PM
From my knowledge of PHP (not very much... but yeah) the second one should be the one I'm looking for ! Thanks very much. I'll test it and confirm then +rep ;)

sorry tom! gotta spread! :(

thread closed.

Agnostic Bear
05-07-2008, 03:18 PM
You want the first one, the second wont work.

Dentafrice
05-07-2008, 03:24 PM
<?php
$spyData = mysql_query( "SELECT * FROM table ORDER BY id DESC" ) or die( mysql_error() );
while ( $spyRow = mysql_fetch_array( $spyData ) ) {
$ip = $spyRow["ip"];
$port = $spyRow["port"];
$check = @fsockopen( $ip, $port );
if ( $check == false ) {
echo "Not online..";
}
else {
echo "Online";
}
}
?>


Something like that should work.

iUnknown
05-07-2008, 03:25 PM
Just to answer your questions, the second one works, and now I've got the script 100% working, wahay.

Thanks Dentafrice and Tom who helped out along the way.

Want to hide these adverts? Register an account for free!