Jump to content

Recommended Posts

Hi, in this script I have tried to find the users ip and see if it is in the database. Currently I have been having problems.

 

Parse error: parse error, unexpected T_VARIABLE in /home/www/cooladverts.freehostia.com/index.php on line 11

 

<html>
<head />
<body>
<?php 
$ip=$_SERVER['REMOTE_ADDR'];

$con=mysql_connect('***********','****','****');
mysql_select_db('servers');

$get=mysql_query('SELECT ip FROM server1 WHERE IP='$ip'');

$ip_exist=mysql_num_rows($get)

if($ip_exist > 0){
echo "welcome again"
}
?> 

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/138215-solved-confused/
Share on other sites

Thank you for that, im always forgetting them.

 

Also, when i add an else statement it gives me an error.

 

Parse error: parse error, unexpected T_ELSE in /home/www/cooladverts.freehostia.com/index.php on line 17

if($ip_exist > 0){
echo "welcome again";
else {
echo "new user";
}
}

Link to comment
https://forums.phpfreaks.com/topic/138215-solved-confused/#findComment-722602
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.