Jump to content

quick question


paulman888888

Recommended Posts

please can someone tell me what i have done wrong.

I would of liked it to echo just the 1 ipaddress then delete it but i have done something wrong.

 

Below is me code.

<?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");  

?>

 

Please help me fix it.

 

Thankyou

Link to comment
https://forums.phpfreaks.com/topic/111161-quick-question/
Share on other sites

please can someone tell me what i have done wrong.

I would of liked it to echo just the 1 ipaddress then delete it but i have done something wrong.

 

Below is me code.

<?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");  

?>

 

Please help me fix it.

 

Thankyou

 

Should

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

or die("ERROR LEVEL 5"); 

 

be

mysql_query("DELETE FROM intowar1 WHERE ipaddress=$row['ipaddress']")

or die("ERROR LEVEL 5"); 

 

 

If thats not it, then what is your code doing? Is it not deleting anything?

Link to comment
https://forums.phpfreaks.com/topic/111161-quick-question/#findComment-570522
Share on other sites

sorry am confused.

I didnt use the while function or loop so i thought it should only put out 1 ipaddress.

 

Ill scrap that code then. Ill start again.

I got my table intowar1,

i would like it to pull out and echo the latest ipaddress, (i do have a column called id that is an auto number if that helps, highest number is the newest).

Then delete that row straight after.

 

Can someone please make an example please.

Link to comment
https://forums.phpfreaks.com/topic/111161-quick-question/#findComment-570539
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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