Jump to content

echo in an echo..


techker

Recommended Posts

hey guys i need to echo a link with and echo in it..

 

like this

content=4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data=echo{$info['bin_data']}>";
[php
i tryed it and it does not work? the page show this when it links
"; } ?>
se the reason why is this is a picture delter and it redirects to a thumbnail deleter but i need to echo the name so it can delete it.

[code]
<? include'connection.php'?>

<?
$file = $_GET['bin_data'];
if (!unlink($file))
  {
  echo ("Error deleting $file");
  }
else
  {
  
  echo ("Deleted $file");
  echo "You'll be redirected to Home Page after (4) Seconds";
          echo "<meta http-equiv=Refresh content=4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data=echo{$info['bin_data']}>";
  }



?>

 

Link to comment
https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/
Share on other sites

you dont need to echo 2 times.

 

<?php

echo "<meta http-equiv=Refresh content=4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data=$info[bin_data]>";

?>

 

or....

 

<?php

echo "<meta http-equiv=Refresh content=4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data=" . $info['bin_data'] . ">";

?>

Link to comment
https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511370
Share on other sites

Use:

<?php

include'connection.php';

if(isset($_GET['bin_data']) && !empty($_GET['bin_data']))
{
    $file = $_GET['bin_data'];

    echo "<p>Deleted $file<br />\n" .
         'You\'ll be redirected to Home Page after (4) Seconds<p>';

    echo '<meta http-equiv="Refresh" content="4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data=' . $info['bin_data'] . '">';
}
else
{
    echo "Error deleting $file";
}

?>

When using variables in strings use concatenation. Also to use double quotes in strings which start with double quotes escape them, ge:

echo "A string with \"double quotes\" in";

// OR

echo 'A string with \'single quotes\' in';

// Another example

echo "A string with 'single quotes' and \"double quotes\" in";

 

Notice the pattern?

Link to comment
https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511371
Share on other sites

i only wish it would work now..lol

 

i think it is at the connection.

 

<?php
mysql_connect("localhost", "root", "") or die(mysql_error()) ;
mysql_select_db("eppa") or die(mysql_error()) ;

$SQL=" SELECT * 
FROM `supps`WHERE bin_data = ".$_GET['bin_data']." 
LIMIT 0 , 30 "; 

$fileSQL=mysql_query($SQL); 

?>

Link to comment
https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511446
Share on other sites

error check your queries before assuming they are working

<?php
mysql_connect("localhost", "root", "") or die(mysql_error()) ;
mysql_select_db("eppa") or die(mysql_error()) ;

$SQL=" SELECT * 
FROM `supps`WHERE bin_data = ".$_GET['bin_data']." 
LIMIT 0 , 30 "; 

$fileSQL=mysql_query($SQL) or die(mysql_error()."<br /><br />".$SQL);

?>

Link to comment
https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511451
Share on other sites

ok i got it deleteing but the funy thing is it says it deleted the pic but it still there?lol

 

the redirecting does not work do

 

echo '<meta http-equiv="Refresh" content="4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data='.$info['bin_data'] . '">';

Edit:

 

ok i replace

bin_data='.$info['bin_data'] . '">';

by

bin_data='.$file. '">';

 

but it still does not delte.it says it does..

 

 

Link to comment
https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511490
Share on other sites

its not a query it only an delete image

cause i insert the path of the image in the databse not the image it self.

 

<?php
include('connection.php'); 


if(isset($_GET['bin_data']) && !empty($_GET['bin_data']))
{
    $file = $_GET['bin_data'];

    echo "<p>Deleted $file<br />\n" .
         'You\'ll be redirected to Home Page after (4) Seconds<p>';

    echo '<meta http-equiv="Refresh" content="4;url=/marlon/photo/thumbs/delete_pic_tn.php?bin_data='.$file. '">';
}
else
{
    echo "Error deleting $file";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511496
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.