Warning: fopen(graphic_design/files/thread-562-1.txt) [function.fopen]: failed to open stream: Permission denied in /graphic_design/global.php on line 421
file NOT opened trying to teach myself php: HELP! -
PDA

View Full Version : trying to teach myself php: HELP!


Glyphon
03-23-2004, 07:45 PM
i'm trying to teach myself php, and its going less than smoothly. i guess my first mistake was going to webmonkey. but anyways. i did. and i was trying to make their php photo gallery work. and i'd guess that its about 70-80% there. when i first displayed their code, it did nothing but spit out error codes in both safari and IE.

i've gotten it to the point when you open the index page, it displays the first page of thumbnails. and when you click on a thumbnail it opens a new window with the picture in it. and this is where it starts to malfunction.

in safari, the link opens the photo exactly like it should.

in IE, it opens the new window, and then the thumbnail page "updates" and the only thing on the page is [object].

the next issue doesn't work in either safari or IE.
when you click on "next page", it is supposed to change to the view.php page and display the next 20 pictures and have a link to the next 20 as well as the previous 20. but the only thing that happens is it has a link to the previous page, and that's it.

so. enough of that.
here (http://209.187.167.115/chattanooga/) is the page in question (running off of my computer, so it will be slow. sorry).
and here (http://209.187.167.115/chattanooga/code.html) is the code running the 2 pages.

here is what i'm running (from server logistsics (http://www.serverlogistics.com/))
Complete Apache 2.0.48
Complete PHP 4.3.4R2

thanks in advance

oh, and can anyone suggests any good php books?

Octane
03-23-2004, 08:57 PM
without looking too deeply, i would suggest that you have register_globals off ... which is a good thing for security. But, then you need to reference variables directly ... ie. the line that says isset($start), should probably read isset($_GET['start']) ... or, add something at the top of the page like extract($_GET); which will write all your $_GET values directly to their index value.
as for the [object] error, that usually gets spit out by a class when trying to echo or print it and it's unable to ... however, it looks as though it has something to do with the javascript (as the title of the page is the javascript function that was called) ... not sure exactly what to do about that without playing around a bit ... Joel might have a better idea ...

Glyphon
03-23-2004, 10:37 PM
sweet. i added extract($_GET); in the head tag, and it works now :grinning:

now i just got to figure out a work around for the javascript image opener, but at this point, i'm freaking happy :alc: :bowdown:

Koobi
05-20-2004, 11:45 AM
I'm glad you've got the PHP bit working :)

About books, I bought the PHP bible. Honestly speaking, it wasn't so great. I learnt much more from the online PHP manual and from tutorials on the net at reputed places such as http://phpfreaks.com/ so have a look at those and experiment as well on various platforms :)

Arch Stanton
05-20-2004, 12:22 PM
Good one octane. I would have said the same thing.

I have this


@extract($HTTP_GET_VARS);
@extract($HTTP_POST_VARS);


or


@extract($_GET);
@extract($_POST);


in my global include file, because I was sick of putting a script on a new server and it not working.

If there are no GET or POST vars, you'll get an error, so put the @ in front to suppress error messages.

On another quick note, if a PHP page works in one browser, but not another, chances are that it's not a problem with the PHP, but the HTML it is outputting.

Koobi
05-20-2004, 12:42 PM
On another quick note, if a PHP page works in one browser, but not another, chances are that it's not a problem with the PHP, but the HTML it is outputting.

Yeah...last week I was surprised to find out that IEx.x won't render anything visible if you don't close the script tag in the header like so:

<script type="text/javascript" src="js.js"></script>


as opposed to the method I think makes more sense:

<script type="text/javascript" src="js.js" />


So the first example is the standard one...


I spent a whole day on that..:( Firefox rendered it fine though :)

Nemesis
05-20-2004, 03:21 PM
If you are shooting digital and want to display EXIF info then look at this post:

http://steeldolphin-forums.com/showthread.php?t=817&highlight=exif

And here's how far I got with it:

http://www.fotografika5000.com/photography/test

Arch Stanton
05-20-2004, 03:29 PM
as opposed to the method I think makes more sense:

<script type="text/javascript" src="js.js" />




Whats your doctype with that?

Koobi
05-20-2004, 04:26 PM
Strict as usual :)

Ref: http://koobi-studio.com/gf/ieScript.htm
IE users can't see it and it's not XHTML Strict 1.0 valid because the specification apparently says the other method is the right way. Habits habits...I'm so used to closing my script tag within itself.

Jeff O.
05-20-2004, 04:28 PM
Not the prettiest site, and the ads are annoying, but PHPBuilder (http://www.phpbuilder.com/) is a pretty good resource to bookmark. There are also some great PHP books out there. I recommend anything by Peachpit (http://www.peachpit.com/search/index.asp?searchstring=php&searchgroup=Books&searchtype=Title&imageField.x=35&imageField.y=5) or O'Reilly (http://catsearch.atomz.com/search/catsearch/?sp-a=sp1000a5a9&sp-f=ISO-8859-1&sp-t=cat_search&sp-q=php). :)

Koobi
05-20-2004, 04:35 PM
Here's a list of links I found:

An article about HTTP and CGI (a very highly recommended read)
http://www.garshol.priv.no/download/text/http-tut.html

http://phpfreaks.com/
http://hotscripts.com/
http://phpbuilder.com/

http://devshed.com/
http://www.sitepoint.com/subcat/98
http://thescripts.com/serversidescripting/php/
http://www.w3schools.com/php/
http://smarty.php.net/
http://pear.php.net/
http://www.php.net/sites.php
http://codewalkers.com/
http://zend.com/

The PHP Bible downloadable source files from their site
http://www.troutworks.com/phpbook/

Arch Stanton
05-20-2004, 04:37 PM
Yeah, thats what I figured, wasn't to sure though. Script tag is a container tag, it's like doing this <p />.