Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. Then you need to dynamically generate it like I suggested before. For each of the fields they submit, put it in an array like this: "fieldX = 'SearchX'" then use explode to add the ' AND '
  2. Then you're not using it right...your code only shows stripslashes which will do the OPPOSITE. You don't have anything to escape data.
  3. I always say there's a reason they called it GD. It's a G--D--- pain.
  4. You can use CURL to fetch data from other websites.
  5. You have an extra $ in there, but after I removed it it still didn't work. Still got:
  6. So you have your answer now. Use OR and put in the 7 fields...
  7. I prefer to use the filesystem for files, so I never store images in my db. You create the image the same way he said, only output it to a file instead of a string. http://php.net/imagejpeg - look at the arguments you can send it.
  8. That's why it sucks to have big tables You could create an array of the fields names and dynamically create the WHERE clause using explode. You should probably look into fulltext searches, for one thing.
  9. This should be in third-party scripts. As the errors say, you need to use your FTP client to change the permissions of those files. It depends on what client you're using, but try right clicking on the files and selecting Permissions. Then type in what the error says to.
  10. The problem is in your HTML, not PHP. As revras said, you need a form element. Here's a good tutorial: http://www.tizag.com/htmlT/forms.php
  11. You will want to use OR "SELECT * FROM table WHERE field1 = 'search' OR field2 = 'search'"
  12. You need to research "SQL Injection" to find out why you need to escape and sanitize data and sql statements, and you should find articles with techniques on how to fix your problem.
  13. I have tried both: array_walk(&$files, 'htmlentities'); array_walk($files, 'htmlentities'); Using PHP5 Nothing changes, it still prints & instead of & Do I have to wrap htmlentities in a in a custom function or am I doing something wrong? EDIT: I tried wrapping it in a function and no change. $h = create_function('$txt', 'return htmlentities($txt);'); array_walk(&$files, $h); print_r($files);
  14. '5' Is a string, 5 is a number. I think MySQL has stricter typing than PHP so if that doesn't work try just 5.
  15. You can use a combination of substr and strpos.
  16. Sweet, now I get all 5 folders The only problem is it shows the entire directory, so I'm going to figure out some way to remove the main directory and just show the folder on the subdirectories. Thanks! Edit: Here's my version now. I changed the code to my style so I'd be able to read it later function dirList($folder, $add='') { $out = array(); $han = opendir($folder); $f = (!empty($folder)) ? $folder . '/' : ''; while($file = readdir($han)) { if($file != '.' && $file != '..'){ if(!is_dir($f.$file)) { $out[] = $add.$file; continue; } $out = array_merge($out, dirList($folder.$file, $file.'/')); } } return $out; } Works great, I get all my folders and files. I spent an hour on this, should have come here a bit sooner
  17. Appends the results from the dirList of the subdirectory to the current list of results. I changed it to: $results += dirList($directory.$file, $file.'/'); And now it shows the first subdirectory for the first print_r, and for the other three, the first TWO subdirectories only. I am so confused, it has got to be something simple. Corbin: I don't want to use empty folders, just the files, so I'll try yours. Thanks!
  18. I am using this function to get all of the files in a directory, and also in any subdirectories in that directory. For the subdirectories, it needs to append the subdirectory to the file. Here is what I am using: function dirList($directory, $add=''){ $results = array(); $handler = opendir($directory); while($file = readdir($handler)){ if($file != '.' && $file != '..'){ if(is_dir($directory.$file)){ $dirResults = dirList($directory.$file, $file.'/'); $results = $dirResults+$results; print_r($results); }else{ $results[] = $add.$file; } } } closedir($handler); return $results; } However, my print_r() only shows the results for the current subdirectory - just $dirResults, not $dirResults+$results. There are four subdirectories, after the first subdirectory it should show the contents of both the first and second in results, then first, second and third, etc. The final array returned has the last subdirectory and all of the files in the main folder. Help Please?
  19. In the past you could use $id to mean the value of id passed in the URL or Posted. Now you need to do $id = $_POST['id']; or $id = $_GET['id']; depending if it was posted or in the url. You also need to sanitize your data, look up SQL injection on google.
  20. Yes, if they are hotlinking your image, everytime someone views their website with the image on it, it uses your site's resources. Use a decent host MediaTemple is a great one.
  21. As much as I hated template engines for the first few years I used PHP, I've recently started using Smarty and I finally understand why template engines exist. The syntax is really not that difficult, I learned how to use it effectively in a few hours. The separation of code and presentation is important to some people or in some cases, and for them, I'd suggest Smarty.
  22. mysql_result is slower than mysql_fetch_assoc (according to w3schools), and its about the same amount of coding. Please don't answer my question with another question. Haven't you ever heard of the Socratic Method?
  23. Make a function which checks if they are logged in or not, and call it on every page.
  24. In each category you need to store it's parent category, then select out all of the categories with parentID of the current category.
×
×
  • 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.