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