Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Most probably it's because id is an integer and you're using WHERE id = '$id' rather than WHERE id = $id. Follow this advice, will help you figure it out.
  2. 2 things: -change your fetch to mysql_fetch_assoc() - use foreach()
  3. You don't. You upload it, save it, then use that file to generate any thumbnails you need and store those either in a different directory with the same name or with a slightly varied name like "tn_file.jpg".
  4. --Holding card to my turban "The problem is .... on line... 32!!!" Yes check line 32.
  5. sunfighter has some pretty decent assumptions, however, the code could just as easily be creating the radio button on the fly using a lookup table. If that's the case, the only thing needed would be a new row in that lookup table, and no change of code. Without some code (just remove any database credentials, usernames or passwords) first.
  6. You might try explaining better what you're trying to do. In general, no, joins are based on values matching in particular columns. There is no way for mysql to guess what column you want to join on or alter that on a row by row basis. A lot of times when someone is looking for something like that it reflects that their database structure is not relational.
  7. It's not like you googled first, and came back and said: i googled this, and found these sites and aI looked at them but none of them helped me because ---- What we do here is try and help people with specific questions. There's nothing in it, for me to put in some google queries for you, and there's no real value to this community either. At least, you admitted that you were basically trying to cut corners. Sure, I could have done what Maq did, but really, should someone here have to make a link for you to the php manual? It's a SQL database with a prepare and execute api. There's not much more that needs to be said --- write some code and come back when you actually encounter a problem.
  8. This is easy to do with html tables. -You start an outer table. -You set a counter variable $x = 1. -you set a column variable $c = 1; -start your fetch loop - if $x == 1 then emit a -emit a rowdata -if $x == $rows (your rows per column variable calculated above) AND $c --- $c++ --- $x = 1 --- emit a to close that nested table and column. - $x++ When the loop finally exits because all data has been fetched you have to close the nested table, last column, the tr and the outer table. -- You'll have the exact format you wanted, and overflows will go into the last nested column/table , exactly as you mocked it up.
  9. I agree with jesirose's basic advice. For a production server, you should turn this off http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors. You should however log errors to a log file. With that said, if you are using mysql error handling those are not php errors. So if you're doing this or something similar: if (!$result) { echo mysql_error(); } else { then you need to instead, write that to an error log of your own making.
  10. Thanks for reporting back your results. I didn't think that you could use LIKE in a check constraint, but then my Oracle skills are getting pretty rusty these days.
  11. Yeah i do use that as well, but it does sort of defeat the purpose, because on one hand you're chiding them for being lazy but on the other hand you're doing the very thing for them that you wanted them to do in the first place. When I see a poster here with one post, I can't be bothered to make that effort, because in most cases it just goes over their head. lmgtfy.com is just a brilliant idea in its simplicity and I bet the guy who did that site makes a good amount of money from something that probably took him or her no more than a day to code up. I'm envious.
  12. **EDITED** nevermind Ken helped pinpoint your error. I've noted that you didn't tell us the truth when i asked you early on if the test query was the same one you were using in phpmyadmin.
  13. No idea on that but there's no issue that I know of, and nothing special going on. There were some server drive issues a while back, and it could be that your avatar was one of the victims when eric had to move the site data onto a new box. I don't know how I missed someone who has made over 3500 posts here, but ... great to see you back.
  14. Well let's get down to it... if you want to actually do something with that code other than display it, you're going to need to use eval(). With that said, eval() is one of the most dangerous functions in the language from an exploit vector -- right up there with the url wrappers built into include(). Any mistake that allows people to inject their own code, and you've given the the power to do anything that apache can do on your server.
  15. Yes, like jesirose pointed out, you query, but you don't setup a fetch loop. In database parlance: query -> executes the sql, makes a result set. The result set is sitting on the server. fetch -> grabs a row from the result set. If there are no rows, or no more rows, a fetch fails. Your code is missing entirely the fetch function. There are a variety of different functions, but for most people i recommend using mysql_fetch_assoc(). The php manual page shows EXACTLY how to use it, again as jesirose stated.
  16. Ok, are you using php4 because you're using php4 oop syntax? If you're using php4, then your initialization of a database handle in the constructor is not going to work unless you force it to pass by reference. You didn't post the code that defines the class... there's just this call $rs = $this->dbActions->execQuery($query); You have "function search" but no class definition. Why would you be using $this-> unless function search is a class method? Either way we need to see where you are instantiating the dbActions object. It looks like what is happening is that your database class wrapper isn't working.
  17. Echo out $query before you execute and cut and paste that into phpmyadmin. I bet you get an error.
  18. Work is work. It seems like you're complaining that you want new challenges, but only if someone will pay you to take them on. That doesn't happen for people unless they are known to be experts in their field, and are highly sought after. It seems like your niche is doing boring run of the mill websites that have the same 5 features. Purely from a business standpoint, one solution to your conundrum is to create a framework or CMS that does those things extremely well, and sell either the package, services around the package, or software as a service. Wordpress would be an excellent example of that -- there were many blog services out there before wordpress, and wordpress is not even the best written and architected php blog package, but it took over the market because the author saw early on that an open source package that was used as the basis for his own SAS business would be a successful strategy. If at the end of the day, technology, programming and web development bore you, maybe the answer is that you should switch careers and find something that does interest you.
  19. That line dynamically adds an element to the $rows array. No you can't use position as the array key, because in doing so, you would overwrite the previous value every time you had a position with more than one element. var_dump() on an array like that is a good way to see what it looks like once you've built it.
  20. Just because you queried the database doesn't mean you have to fetch and process. You can fetch all the rows into an array and then foreach through them. This would allow you to implement your "posn" easily in a simple foreach loop. $score = -1; $pos = 0; while($row = mysql_fetch_array($r_lastcomp)){ if ($row['score'] != $score) { $pos++; $score = $row['score']; } $row['pos'] = $pos; $rows[] = $row; } // Now you foreach through rows[] and you have added the 'pos' column which tells you their rank, accounting for ties foreach ($rows as $row) { // ... your handicap computation code here
  21. Huh? Port 80 is reserved for HTTP, so that socket would be grabbed by a webserver if running. It also has nothing to do with TCP/UDP. TCP is a connection oriented protocol whereas UDP is a datagram protocol.
  22. A check constraint is like a little piece of validation code, that must evaluation to true or false. It is not a query. I'm not really sure what you're going for, but if you literally expect that the subjectid will be the strings 'COMP%' or 'INFO%', then you should have add ... check( subjectid in ('COMP%', 'INFO%', 'SYS%')) If you literally are trying to get "LIKE" behavior so that you only allow words that start with COMP, INFO and SYS, but are actually COMPUTER, INFORMATION etc., then you might try using SUBSTR() to get the first 3 characters, although I don't know if that will work in a constraint.
  23. gizmola

    Which?

    No I'm not saying that you go with Zend once you learn symfony. They are both fully capable of doing even complicated applications and have very similar features, approaches and capabiltiies. Symfony is just simpler and easier to learn, and because it generates code will get you up and running faster. ZF is more flexible, and also has general purpose features. For example, I wrote some rss feeds for a company that had completely custom code. I could do that because ZF includes rss feed classes. Other frameworks might have those included somewhere but they weren't designed to be a class library. Based on what I know about both frameworks and my own experience, it's my opinion that someone who is newer will have an easier time with Symfony, partly because they have a "symfony" way of doing things, and also probably because most of it was designed by a single person, whereas ZF is an amalgam of a lot of different classes written by different people. In summary, you use a framework for a number of reasons, not the least of which is that it should do a lot of thing for you. If you want to call that "laziness" well that's not really a bad thing. The longer you work with a framework the more you will come to learn about its internals. You also will probably have to learn a fair amount about PHP oop to keep your bearing in any decent PHP framework these days. No matter how good the docs, there will be questions that come up, and issues debugging code, and you need to have an idea how to get your bearings. That's actually another thing about symfony that reflects its pragmatism, in that it comes with a developer controller that displays a debugging bar for when you're developing. With ZF, while they have classes that help with debugging and logging, they don't give you an out of the box solution like symfony.
×
×
  • 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.