Unstoppable Domains โ€” Get your daily AI drops report

Php/mysql help needed

SpaceshipSpaceship
Watch

dx3k

Established Member
Impact
2
hey

can you tell me what is wrong with this script please i keep getting "unexpected ) on line 18"


PHP:
<?
include('sqlinfo.php');
$connect = mysql_connect($host, $account, $password);
$db = mysql_select_db("dx3k_logger)";       <<<< this is line 18
$query = "INSERT INTO ip VALUES (''$ip");

?>


thanks

dx3k
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
$db = mysql_select_db("dx3k_logger)";


should be

$db = mysql_select_db("dx3k_logger");
 
0
•••
still dont want to work

this is what i have now



PHP:
<?
$ip = $REMOTE_ADDR;
echo "$ip"; 
?>
<?
include('sqlinfo.php');
$connect = mysql_connect($host, $account, $password);
$db = mysql_select_db("dx3k_logger");   <<< line 18
$query = "INSERT INTO 'ip' VALUES (''$ip");

?>
 
0
•••
$query = "INSERT INTO 'ip' VALUES (''$ip");

that is wrong as well, you opened the quotes outside of the bracket but closed them in the bracket also wht do you have ''$ip

try :-

$query = "INSERT INTO 'ip' VALUES ('".$ip."')";
 
0
•••
now it is on about a T_STRING erro on line 18 ( i h8 this line lol) what is a t_string?




<?
include('sqlinfo.php');
$db = mysql_connect("$host", "$account");
mysql_select_db("dx3k_logger",$db);
$query = INSERT INTO `data` ( `ip` , `browser` )
VALUES (
'$ip'
);

?>



thanks

dx3k
 
0
•••
<?
include('sqlinfo.php');
$db = mysql_connect($host,$account);
mysql_select_db("dx3k_logger",$db);
$query = "INSERT INTO `data` ( `ip` , `browser` ) VALUES ('$ip')";
?>

That should work. Just note that you have two fields defined in the fields list and only one value, in case you intend to run the query.

I must really recommend you to read a few PHP beginner tutorials.
 
0
•••
i am already , most of the script i copyd from the book
 
0
•••
dx3k said:
now it is on about a T_STRING erro on line 18 ( i h8 this line lol) what is a t_string?




<?
include('sqlinfo.php');
$db = mysql_connect("$host", "$account");
mysql_select_db("dx3k_logger",$db);
$query = INSERT INTO `data` ( `ip` , `browser` )
VALUES (
'$ip'
);

?>



thanks

dx3k
Can you print out the line 18 here?
Thanks
 
0
•••
One of the following ought to be line 18 as it aint enclosed in quotes:
$query = INSERT INTO `data` ( `ip` , `browser` )
VALUES (
'$ip'
);
 
0
•••
you will need to enclose them in quotes, also why are you only assigning ip when your query should be inserting 2 lots of data (ip and browser)
 
0
•••
yer i got it to work now 100% my fault... i hadnt added myself as a user to the database :red: :red: i am an idiot :hehe:
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back