techker Posted April 7, 2008 Share Posted April 7, 2008 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']}>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/ Share on other sites More sharing options...
mpharo Posted April 7, 2008 Share Posted April 7, 2008 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'] . ">"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511370 Share on other sites More sharing options...
wildteen88 Posted April 7, 2008 Share Posted April 7, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511371 Share on other sites More sharing options...
techker Posted April 7, 2008 Author Share Posted April 7, 2008 wow.thx alot guys. wildteen88 thx for the examples. Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511373 Share on other sites More sharing options...
techker Posted April 7, 2008 Author Share Posted April 7, 2008 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511446 Share on other sites More sharing options...
cooldude832 Posted April 7, 2008 Share Posted April 7, 2008 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511451 Share on other sites More sharing options...
Barand Posted April 7, 2008 Share Posted April 7, 2008 if $_GET['bin_data'] is a string value it needs to be inside single quotes $SQL=" SELECT * FROM `supps`WHERE bin_data = '".$_GET['bin_data']."' LIMIT 0 , 30 "; Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511473 Share on other sites More sharing options...
techker Posted April 7, 2008 Author Share Posted April 7, 2008 i was just looking at that..thx.i still get an error message saying that it did not delete the pic. think it could be my wamp that does not accept deleting images?it there an easyer way? Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511479 Share on other sites More sharing options...
techker Posted April 7, 2008 Author Share Posted April 7, 2008 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.. Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511490 Share on other sites More sharing options...
Barand Posted April 7, 2008 Share Posted April 7, 2008 What does your DELETE query look like? Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511494 Share on other sites More sharing options...
techker Posted April 7, 2008 Author Share Posted April 7, 2008 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/100000-echo-in-an-echo/#findComment-511496 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.