Reading from a database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Reading from a database

Post by jackpf »

Well, take that last error for example. Surely you could have figured that out? It's saying that the column doesn't exist...

And the one about mysql_fetch_array() not having a valid resource handler...that means that mysql_query() isn't returning a resource handler, so it's probably returning false (you can check with var_dump()). That means your query is failing, so you should debug that.

Just stuff like that. I'm not trying to be mean; I'm just trying to show you how you should go about errors, saving yourself time posting here. Don't get me wrong, I have no problem helping you, otherwise I wouldn't do it, but I't'll be better for you in the long run...
Adam_C
Forum Newbie
Posts: 22
Joined: Wed Jul 22, 2009 1:45 pm

Re: Reading from a database

Post by Adam_C »

thanks for the advice (not sarcastic :)) but for things like the last one fair enough but i dont really know any php and aren't able to understand errors etc :)

is there a site which lists such errors etc ? :)
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Reading from a database

Post by jackpf »

Not that I know of...

But tbh, I think PHP and MySQL errors are actually rather generous, as in they're pretty self explanatory.

If you read the error, and think about what it says and what could be causing it, you can usually figure out what's wrong.

They usually give you line references as well, so you know exactly what line is causing the problem. That's possibly the most useful thing ever - especially when you've got scripts several thousand lines long.
Adam_C
Forum Newbie
Posts: 22
Joined: Wed Jul 22, 2009 1:45 pm

Re: Reading from a database

Post by Adam_C »

cool, thanks again :) how did / do you learn so much web script then ? I'm only 15 and want to become a webdesigner or something like that. any tips? :)
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Reading from a database

Post by jackpf »

Well, I'm only 16, so.... :P

Pretty cool tbh, because most of the people on forums such as this are like 30, and "professional" web developers, and I'm teaching them stuff...

Idk, I knew a bit of C beforehand, and the two languages are very similiar. To be perfectly honest, I've probably learnt most of what I know from helping people on forums like this.

If someone has a problem that I don't understand, I'll go and research it until i find a solution. In the process I'll probably teach myself something new as well, which I'll update or implement in my own code.

Oh, and read the manual. Seriously. :P
Adam_C
Forum Newbie
Posts: 22
Joined: Wed Jul 22, 2009 1:45 pm

Re: Reading from a database

Post by Adam_C »

wow ! that makes sense too ! :)

btw, what manual ? :)
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Reading from a database

Post by jackpf »

The manual for whatever language you're coding in.

php manual
mysql manual
Adam_C
Forum Newbie
Posts: 22
Joined: Wed Jul 22, 2009 1:45 pm

Re: Reading from a database

Post by Adam_C »

thank you very much, i didnt know about these :)

hope to speak to you again :)

Adam
Adam_C
Forum Newbie
Posts: 22
Joined: Wed Jul 22, 2009 1:45 pm

Re: Reading from a database

Post by Adam_C »

by the way, you wouldn't know about javascript would you, is there a way of showing the error like php ?

I am trying to make a validation form :)
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Reading from a database

Post by jackpf »

I would call myself capable :P

If you download something like firebug, or just use the firefox error console you can see errors.
Post Reply