Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. What is a select case? Do you mean a switch? If you're only going to have those two options of Edit and Add that's a bit overkill.
  2. That is indeed a constant. You can do anything with it like a string so you can do print PATH.'myfile.php'; And good for you for learning more on your own, it's all too easy to become dependent on something like dreamweaver and not actually understand what is going on with the code! You can store your config file wherever you want, I guess. I have a framework I wrote so all of my pages are in pages/, my processing stuff is in actions/, etc. Then the base file is the config info (paths, db connection, etc) and then it takes the URL given (such as mysite.com/process/login/) and loads the /actions/login.php file.
  3. Or give them different names. <td><input type="submit" name="Add" value="Add Entry"></td> <td><input type="submit" name="Edit" value="Edit/Delete Entry"></td> Then <? if(isset($_POST['Edit'])){ //edit here }else if(isset($_POST['Add'])){ //Add here } ?>
  4. That is a good idea if you will have houses without owners. If a house has to have an owner (hey, even IRL it's the bank, right? ) then this is not needed, but good idea if they can be ownerless! Thanks!
  5. Well if $company is never defined in that file, that would be why. If $company is defined in the file you were previously including the CSS in, it won't work. I usually set up my files to all use one config file, where I put important stuff like file paths (as constants.) and session_start() So on every page I have I would start it off by require_once('config.php'); Then in my css file I'd be able to use any vars I defined in config. This probably sounds like overkill for one or two files but it pays off in the end when you don't have to go back and edit every file to change one variable you used in them. (Actually, I use a .htaccess file to redirect everything to a base file which includes the file then, but that is probably a bit advanced, no offense!) Edit: I don't know why your margin would not work, are you using the same browser as before? You can do margin: 0 0 0 0; to save a few lines, btw. (top, right, bottom, left.)
  6. Not really. Why would a country have a city id? You just said the countries can have more than one city, so how many entries are in your country table? I would do it like this: Country Table (just one entry per country.) CountryID Name City Table (just one entry per city, but there will be many cities with the same country ID.) CityID Name CountryID <- This is the county it is in. House Table (etc as above with city - one entry per house, many or no houses per user) HouseID UserID CityID <- From this, you can extrapolate the Country ID. User Table UserID Any other info, but No House ID - You said they can have more than one house! You can't store just one ID for them if they have more than one. If they can ONLY ever have one house, you can store all the info in the user table, but since they can't each item needs it's own table. Then you write the statements to get their house info. If you know just the userID: (You'll probably have to edit this to fit your variable names! SELECT house.*, city.*, country.* FROM house, city, country WHERE house.userID = $userID AND city.cityID = house.cityID AND city.countryID = country.countryID. That will give you ALL of the info on every entry for a user. If you just have the house ID it's similar SELECT house.*, city.*, country.* FROM house, city, country WHERE house.houseID = $houseID AND city.cityID = house.cityID AND city.countryID = country.countryID.
  7. This is a bit confusing. It sounds like you could have more than one "House" with the same CityID, so how do you know which CityID from the House table you are selecting? Can you provide a bit more info? It sounds like your table structure might be a bit out of whack. A country should not have a CityID, a city is inside a country and more than one city per country, so your cities should have countryIDs, like how your houses have cityIds. What you've said so far is like this: SELECT countryName FROM country WHERE country.cityID = house.cityID;
  8. Or even better, do this: <link rel="stylesheet" href="css.php" type="text/css" media="all"/> And have your css.php file start with this: <? header("Content-type: text/css"); That way you keep your css file seperate.
  9. "often times if you header() immediately to the following page, users will be left wondering whether their edit was successful or not." That's why you display a success or failure message on the next page.
  10. add ORDER BY timestamp_column_name_here DESC to your sql
  11. I'm no good with server issues. Good luck.
  12. You could read the manual: http://us2.php.net/str_replace Read the Notes: Notes Note: This function is binary-safe. Note: This function is case-sensitive. Use **GO FIND OUT** for case-insensitive replace. At the bottom of most function's entries is a list of related functions.
  13. You need to change the max execution time then. Use ini_set: http://us2.php.net/manual/en/function.ini-set.php http://us2.php.net/manual/en/ref.info.php#ini.max-execution-time
  14. Well, you could make the page static text, and then have a script run with cron every 15 minutes which overwrites that file with the new page.
  15. Are there really that many classes that teach PHP? Just a few years ago my HS made the switch from C++ to Java, and my university never offered any PHP classes. I understand we don't do homework for people, but is it that often that someone has PHP homework? How can someone get "better marks" than you if it's not homework? And what class is it for?>
  16. because < and > are HTML open and close tags. So the browser thinks that is HTML. Use < and > instead or run htmlentities on it first. I've been gone a while but maybe the forum has a no-chatspeak rule
  17. $name=$_post[name]; I think you need to change this to $name=$_POST['name']; Add this to the top of your pages: ini_set('display_errors', 1); error_reporting(E_ALL);
  18. You need to put quotes around a string. site='Cash'.
  19. That is a lot different than your original question about https://
  20. One of your opening tags is a short tag <? instead of <?php Do you have short tags enabled? Try this: ..... </frameset><frameset rows="25 <?php if ($fetch->bar == "1"){ print ',*'; } print '" cols="*" framespacing="0" frameborder="NO" border="0">'; if ($fetch->bar == "1"){ print '<frame src="mini.php" name="topFrame" scrolling="NO" noresize >'; } ?> <frameset rows="*" cols="200,*" framespacing="0" frameborder="NO" border="0"> ......
  21. php.net/sort(); Put the $val s into an array and sort it.
  22. Not to be rude, but you proved my point that you get what you pay for. They get you for free, so they get someone who is asking other people to do it for free. If they moved the question AND told you basically not to post in help with the same question, why did you? Seems like you're just trying to break the rules If you need help with a third-party script, they moved it to the right place.
  23. You need to contact your host then. If it says the function is not found, then it sounds like you're running PHP4, not PHP5. You can also try changing the file extension from .php to .php5 but I think it will have the same result. (Remove the .htaccess file tho.)
  24. Did you look at the LINE it references? We can't help without the code. Edit: Well, maybe someone will download your attachment, but certainly not me. POST the relevant code.
×
×
  • 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.