Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9265433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:04:06+00:00 2026-06-18T14:04:06+00:00

I ask for help with PHP code. Simple unlink function works, but when it

  • 0

I ask for help with PHP code.
Simple unlink function works, but when it is in loop, it doesnt work. There has to be a problem somewhere. So heres the problem. I have a simple page where you can delete the navigation items. If user deletes navigation item (hes an administrator) and that link to page with some photos in it, I want to delete these photos when the user delete whole page.
The PHP code:

$sql2 = "SELECT * FROM foto WHERE ID=".$inid;
    $vysledek = mysql_query($sql2) or die (mysql_error());
    while ($zaznam= MySQL_Fetch_Array($vysledek)) {
                $path = "maly/maly".$zaznam["url_v"];
                unlink($path);
                $path2 = "uploads/".$zaznam["url_v"];
                unlink($path2);     
            } 

This code wont delete all matched photos.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:04:06+00:00Added an answer on June 18, 2026 at 2:04 pm

    First the statement

    $sql2 = "SELECT * FROM foto WHERE ID=".$inid;
    

    Might be incorrect, perhaps

    $sql2 = "SELECT * FROM foto WHERE ID='".$inid."'";
    

    (ignoring the fact of potential SQL injection).

    But,

    Why not echo the values of the current working directory along with $path and $path2 to find out what is going wrong?

    Otherwise it is difficult to tell.

    BTW – mysql_* libraries are deprecated. Should move to summat like PDO or mysqli.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to ask if anyone could help he get this code to work.
I'd like to ask your help on a longstanding issue with php/mysql connections. Every
I'm stuck with a problem and ask for your help. It's about navigation within
everybody! Could I ask you to help me to decode this JSON code: $json
I want to ask a question in php this is html form code <form
Actually i once saw some PHP code on php.net but i forgot its name
I do not have any other option, but to ask here again... and problem
I really hate to ask these vague questions, but I could use some help
i wanna ask again,still have problems with my php code i wanna ask how
I don't know if someone can help me, but i'll ask anyway. I'm creating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.