Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. are you calling session_start() at the beginning of each page?
  2. Ah I getcha :) I got confused for a second.
  3. What is a session cookie? A Cookie is different than a Session
  4. I know how to do it the other way :) What are you trying to do? There might be an easier way.
  5. you can put what I wrote for you. Should search be a number or string? If it's the string, IE: Government, change this line also: $sql = mysql_query("SELECT * FROM services WHERE category LIKE '".$category[$_GET['search']]."%';") or die(mysql_error());
  6. it's the value in the array. Foreach works like this: $arr = array($key=>$value); So foreach is foreach($arr AS $key=>$value){ } But you can call $key and $value whatever you want. $cat is short for $category.
  7. Will You Be Coding In Camel Case As Well? Have them register with a username and password. The other methods are flawed because: Sessions die when the user leaves, or if it times out they may start a new one. IP: IPs can be dynamic, or shared. My husband and I use the same IP at home, but then I use a different one at work, and we change ours regularly. Cookies: Can be blocked, cleared, etc.
  8. When we ask for an error, we mean the error you see, not just telling us where it is. Change to this: $query="SELECT * FROM Headshot WHERE valid = 1 AND location='".$_SESSION['locc']."' ORDER BY name ";
  9. Where? You didn't do anything with it. If you mean in the links, that doesn't make any sense. I think you want something like this [code]$category = array('Employment', 'Government' ); // etc [/code] then [code] foreach($category AS $id=>$cat){   echo '<a href="?search='.$id.'">'.$cat.'</a> <br>'; } [/code] Finally [code]if ($category[$_GET['search']]){[/code] Try that.
  10. is $category an array? Where is it defined?
  11. link to it like you would to a page on your site. Like <a href="/uploads/filenamehere">Link</a> When you're uploading it, you'll need to get the name of it and save it somehow so you know what the link should be.
  12. Ted, you're full of something. I have skipped the quotes on numbers. Maybe it's a mysql version thing, but it works for me. However, it's a good idea to use the quotes just in case.
  13. Chris, here's my code for my index.php It allows you include multiple files as you need, so you can get pretty advanced. Feel free to ask me if you need help with it, if you decide to use it. [code] $url = $_SERVER['REQUEST_URI']; // Take off any initial slashes if(substr($url, 0, 1) == '/'){ $url = substr($url, 1, strlen($url)-1); } //Get the url minus any GET vars if(strrpos($url, "?")){ $url = substr($url, 0, strrpos($url, "?")); } // Take out the trailing slash if(substr($url, strlen($url)-1, strlen($url)) == '/'){ $url = substr($url, 0, strlen($url)-1); }else{ //header('Location: '.$siteURL.$url.'/'); } // Split the url into an array $url_parts = split('/', $url); // If any page $inc[0] = $basePath.'pages/'.$url_parts[0].'.php'; $incs = true; // if index Index if(!$url_parts[0] || $url_parts[0] == 'index'){ $inc[0] = 'base.php';  /// what you'd normally have on index. $incs = true; } //if processing page, for forms, etc. if($url_parts[1] == 'process'){   $inc[0] = 'process_'.$url_parts[0].'.php';   $incs = false; } //If the page is supposed to be wrapped in html if($incs){ require_once($incPath.'header.php'); if($inc){ foreach($inc AS $in){ require_once($in); } } require_once($incPath.'footer.php'); }else{ if($inc){ foreach($inc AS $in){ require_once($in); } } } [/code] and my htaccess RewriteEngine on RewriteRule ^([A-Za-z0-9_/]+)$ /index.php [NC]
  14. Ted, there is no about folder, let alone an index file in there. It's using mod_rewrite.
  15. Ted: not if it's a number, but it's a good idea to do it anyway. felix, what doesn't work? Error, etc? More code? We need more info.
  16. You can do a similar thing with mod_rewrite. What I do is have my mod_rewrite direct anything to index.php, then index.php gets the url using $_SERVER['REQUEST_URI'], then include the relevant page. So I have mysite.com/about/ - that will include about.php
  17. I think this may be your end. Either your browsers are misconfigured...or you're imagining some stuff.
  18. Every time you have a " inside a string with a ", you have to escape it. You're still not doing that. If you want to always use " use this: \" echo("<form method=\"post\"
  19. The solved button got removed in an update, apparently :/
  20. If you mean on a web site in your browser, that's Javascript, not Java. If you mean a program you run on your computer, yes, PHP can make those too, but it's meant for dynamic web sites, not applications.
×
×
  • 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.