-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
I don't think anybody is really arguing that the GD library is very "limited;" the real point we're trying to make is that php was not really designed for graphic application. It's a server side language, used for interacting with databases and files and producing dynamic output. Are there other miscellaneous and creative uses for PHP? Sure. But that's not it's primary function. And when you think about it, all graphic application functions boil down to writing things 1 pixel at a time. Other languages or engines just make it easier for you. They give you the programmer extra functions to say, draw a line starting from x1,y1 to x2,y2. But internally, it's really no different than you having made some loops and conditions to print (or not print) it pixel by pixel. And they also do it a lot faster because they are designed to make use of lots of RAM and graphics cards, etc.. on a computer more suited for graphic application. A server is not the same as some random Joe's computer. Well I mean, it's a computer, but it doesn't need things like graphics cards. So you see, it's not really php's fault. It just doesn't have prefab functions to make life easier for you, even though those prefab functions don't really do anything that php can't. It's more the environment it's being run in. The bottom line is that if you want to do something with heavy graphics, you're going to have to use a more "traditional" language like c++, vb, java, delphi, etc... I mean hell, if you're really bent on doing it with php, you could write your own extension for it. Hell, you can even make it interact with directX or <insertsomegraphicsenginehere>. But like I said, it's not really php that's the culprit here, it's the fact that it's being run on a server.
-
That's a good question. These guys make complex 3D captchas and use PHP+GDLib, and it works out just fine. http://www.ocr-research.org.ua/index.html ooh pretty
-
Let's say you have a table called fruit with a couple of columns called id, name, color Fruit idnamecolor 0applered 1orangeorange 2bananayellow 3watermelongreen 4grapepurple If we ran the following code: $sql = "SELECT id, color, name FROM fruit"; $result = mysql_query($sql); Using mysql_fetch_row will return a numeric array for each row of the table. A numeric array is an array where each element's key is a number. We would access each element with a number like so: while ($list = mysql_fetch_row($result)) { echo "id: {$list[0]} <br />"; echo "name: {$list[1]} <br />"; echo "color: {$list[2]} <br />"; } Using mysql_fetch_assoc will return an associative array for each row of the table. An associative array is an array where each element's key is a word. When retrieving an associative array from a db result source, the keys correspond to the column names returned from the query. So, we would access each element with the column name like this: while ($list = mysql_fetch_assoc($result)) { echo "id: {$list['id']} <br />"; echo "name: {$list['name']} <br />"; echo "color: {$list['color']} <br />"; } mysql_fetch_array returns both a numeric and associative array. If you were to put mysql_fetch_array instead of _row or _assoc in either one of those loops above, it would produce the same result. mysql_fetch_array will take an optional 2nd argument. The default is MYSQL_BOTH which returns both numerical and associative. That's what's returned by default if you don't specify the 2nd argument. But you can specify for it to only return one or the other, using MYSQL_ASSOC for associative or MYSQL_NUM for numerical. Yes, specifying for only 1 or the other makes it the exact same as just using _assoc or _row. Overkill. There's no such thing as mysql_fetch_result. There is however, mysql_result. Go back up and look at the table with the data. Let's do the same query as before: $sql = "SELECT id, color, name FROM fruit"; $result = mysql_query($sql); This will return all the data from all of the rows. With mysql_result you can retrieve the data from the specific row and column like with x,y coordinates on a grid. So let's say we wanted to print "green" from that table, we would do this: echo mysql_result($result, 3, 2); The first argument is the result source. The second argument is which row. "green" is in the 4th row, but rows start at 0 so it's on row 3. "green" is in the 3rd column, but numerical arrays start at 0 too, so it's column 2. mysql_result will take either a numerical or associative key as the 3rd argument, so we could have done "color" instead of 2. As far as "when to use" which one... There's really very little circumstances where you *need* to have both an associative and numeric array returned, so mysql_fetch_array should rarely be used. As far as whether to use mysql_fetch_assoc vs. mysql_fetch_row ... well, it depends on the situation. But overall, it's easier to read and understand what's going on in your code if you use _assoc wherever possible. As far as mysql_result goes... to be honest, I have yet to be in a situation where this is actually useful. One of the comments in the manual mentions utilizing it to "look ahead" to the next row's data while looping through rows, which I suppose is useful, but whatever. So yeah... that's about it.
-
sql does not get confused by dash marks if it's wrapped in quotes as a string, which I'm assuming his data is: a string type. As far as the question goes: be more specific. Are you wanting to select all data that has a dash in it? Are you wanting it to be able to find TL-100 whether it has a dash in it or not, as in, you want sql to see TL100 and TL-100 as the same thing?
-
$arr = array('red', 'green', 'blue'); foreach ($arr as $key => $val) { if ($val == "green") { unset($arr[$key]); } }
-
please do not make multiple threads asking the same thing.
-
I think the problem is with your query string. You're selecting data from two different tables but your where clause only restricts one of them. I think you're going to need to add a JOIN in there somewhere. I think. I'm really not that great at query strings. But I'm pretty sure it's your actual query string. I can move this over to the sql forum if you want...
-
file() foreach() stripos()
-
SELECT * FROM table WHERE NOW() BETWEEN StartDate AND EndDate
-
Okay I'm no expert, but if I read that correct: 1) SELECT SUM(amount) AS count FROM sprites 2) SELECT author, count(amount) AS count FROM sprites GROUP BY author ORDER BY count DESC
-
Any chance or resurrecting the Calendar Tutorial?
.josh replied to sugarengine's topic in PHPFreaks.com Website Feedback
I just looked through the list of tutorials that was salvaged from the previous site and I'm sorry to say that unless Dan or Ober happens to have some previous ancient sql dump, that one was not salvaged. Only 62 tutorials were salvaged :*( -
Well the technology to make a "virtual world" is already here. Like I said, this is nothing new to MMO gamers. It's just not very practical though, due to limited means of interacting. That is, we're still limited to using a mouse and keyboard, which isn't very practical. That's why I don't think any "leaps" into it will be serious, until physical interfaces catch up to it. You also have to consider communication obstacles. In order to make it "virtual," or "visual," an agreed upon language of symbols or images will have to become the norm. I mean, that's the whole point of words. Words are the current visual representation of thoughts and intentions. That's not going to be easily replaced. In fact, I don't think it's going to be possible to replace it at all. At least, not completely. It's always going to boil down to text. And text is always going to most efficiently be arranged the way it already is.
-
No we don't...tell us why you are catering to all those versions please. I'm really interested in knowing why you think you need to cater to IE 3.0 (or 4.01, or 5.01, or 5.5...) but not firefox 2, when firefox 3 was only recently released as a final.
-
- The token system is a way of authenticating the form itself, and does not really have anything to do with "time." - You can very easily have a bot "sleep" for a couple of seconds on each input to get around your time limit. - It's really not that hard to make your own browser in c, vb, java, etc.. at least the basics. Like seriously, it's just a couple lines of code to send and receive data. And the point to that is that your easily made browser would have no such limitations on "events" etc...
-
People can make their custom little avatars and their custom little homes and all that stuff but it's not "productive." It's just a spruced up chatroom. But try and introduce an economy into that. It's not so easy. Just look at any MMO. Look at World of Warcraft, a very popular MMO. You have to move your avatar close enough to someone to trade with them. Or go to 1 of a handful of auction houses throughout the world. Or mail it to them (which there is a delay, but that's game mechanics). Wouldn't it be more convenient to be able to type in a name, or click and instantly deal with them, regardless of where they are "at?" Yes it would, but that's the problem. That kind of makes the whole avatar/world thing pointless, now doesn't it? A "virtual world" does nothing but impose limitations on what you can do. None of this stuff is anything new to MMO gamers. I think there will eventually be a virtual reality or at least, a more "visual" way of surfing the internet, but not like all these things people are doing. At least, not until we all have VR goggles and gloves or implants to jack into to really "be" there, because as of right now, it doesn't matter how you put it up on the screen, you still got to use your hands on a mouse and keyboard. A 2d menu type interface will always be the fastest, most efficient way to do things on the internet, so long as most people are restricted to these things. We need to move beyond our current input technology in order to advance further with our output technology.
-
Do those words actually mean something in some other language? Because in English, they have no relevancy to a community system.
-
or you can do this: echo "{$myrow['Firstname']} {$myrow['Surname']}"; I'm kind of surprised you didn't at least do this though: echo $myrow['Firstname']; echo " "; echo $myrow['Surname'];
-
Where is your code that passes "message" via the GET method? And on that note, why are you even using the GET method like this? It doesn't look like anybody could do any real harm by changing the value of "message" here, but still... you should be passing data through a session var. But regardless, where is your code that passes your 1 or 3 to this script?
-
ALTER TABLE tablename AUTO_INCREMENT = 0
-
Yeah I get the feeling they told you they couldn't help because you aren't showing any kind of code or explaining anything about the code. Your first warning is obvious: you're script is trying to divide something by zero. Why is it doing that? I wouldn't know, because you didn't provide any code. Your other errors are most likely related to each other. Your 2nd error means that you provided 1 or more wrong of the following: host, username, or password (for your database). Since you provided wrong info, the 3rd error probably happened. And since you have no connection, your 4th and 5th error is due to not having a result returned.
-
You're going to have to post relevant code. A couple lines of html doesn't really help us out. Also, what have you tried? Did you get any error messages? Not understanding the process itself, or what functions to use? We aren't psychic. http://www.phpfreaks.com/tutorial/php-basic-database-handling
-
[SOLVED] PHP only prints errors when it feels like it?
.josh replied to matthewhaworth's topic in PHP Coding Help
Messages that happen sometimes and sometimes not are usually due to a logic bug. You're going to have to post some (relevant) code and also explain as best you can what it's supposed to be doing. -
http://www.phpfreaks.com/tutorial/basic-pagination