Jump to content

quick question


paulman888888

Recommended Posts

I get this error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.175.53, 06.20.08)' at line 2

 

and this is my code

<?php include("connect.php"); ?>
<?php
$ipaddress =$_SERVER['REMOTE_ADDR'];
$thedate = date("m.d.y"); 


mysql_query("INSERT INTO intowar1 
(ipaddress, thedate) VALUES($ipaddress, $thedate)") 
or die(mysql_error());  
?>

 

Please can you tell me what i have done wrong?

 

Thankyou

paul

Link to comment
Share on other sites

have i got to do the same with this one as well?

<?php include("connect.php"); ?>
<?php
$query = "SELECT * FROM intowar1"; 

$result = mysql_query($query) or die("ERROR LEVEL 3");


$row = mysql_fetch_array($result) or die("ERROR LEVEL 4");
echo $row['ipaddress'];

mysql_query("DELETE FROM example WHERE ipaddress=$row['ipaddress']") 
or die("ERROR LEVEL 5");  

?>

and the error code

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/www/something.com/something.php on line 11

Link to comment
Share on other sites

I get this error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.175.53, 06.20.08)' at line 2

 

and this is my code

<?php include("connect.php"); ?>
<?php
$ipaddress =$_SERVER['REMOTE_ADDR'];
$thedate = date("m.d.y"); 


mysql_query("INSERT INTO intowar1 
(ipaddress, thedate) VALUES($ipaddress, $thedate)") 
or die(mysql_error());  
?>

 

Please can you tell me what i have done wrong?

 

Thankyou

paul

 

you just need '' around the variables in the value section dont you?

 

mysql_query("INSERT INTO intowar1 
(ipaddress, thedate) VALUES('$ipaddress', '$thedate')") 
or die(mysql_error());  

 

and for your second example:

<?php
mysql_query("DELETE FROM example WHERE ipaddress='$row['ipaddress']'")

Link to comment
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.