Topic awaiting preservation: What have I done wrong this time? (Page 1 of 1) |
|
---|---|
Obsessive-Compulsive (I) Inmate From: A Library Dungeon |
posted 03-20-2007 06:35
Sorry to be a gigantic problem in everyone's butt... But I've followed yet another tutorial for a PHP Image Gallery only for nothing to work! I go to upload the image, hit "submit" and then the file and description disappear with nothing happening! No uploading or anything! code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Browse Upload Files</title> </head> <body bgcolor="white"> <?php include 'db.inc'; $query = "SELECT id, shortName, mimeName FROM gallery"; if (!($connection = @ mysql_pconnect($hostName, $username, $password))) showerror(); if (!mysql_select_db("tutorial", $connection)) showerror(); if (!($result = @ mysql_query ($query, $connection))) showerror(); ?> <h1>Image database</h1> <h3>Click <a href="insert.php">here</a> to upload an image.</h3> <?php if ($row = @ mysql_fetch_array($result)) { ?> <table> <col span="1" align="right"> <tr> <th>Short description</th> <th>File type</th> <th>Image</th> </tr> <?php do { ?> <tr> <td><?php echo "{$row["shortName"]}";?></td> <td><?php echo "{$row["mimeName"]}";?></td> <td><?php echo "<img src=\"view.php?file={$row["id"]}\">";?></td> </tr> <?php } while ($row = @ mysql_fetch_array($result)); ?> </table> <?php } // if mysql_fetch_array() else echo "<h3>There are no images to display</h3>\n"; ?> </body> </html>
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 03-20-2007 11:16
First off, get rid of the @s - you don't want to hide your errors, you want to see them! |
Maniac (V) Mad Scientist From: :morF |
posted 03-20-2007 13:35
If you don't want to paste the code here (which is probably a good idea if there's a lot of it) then you can make copies of the files, but with the extension .phps. This will tell your webserver to send them to the PHP interpretor as source files, and it in turn will display it for us to see, all nicely syntax highlighted. |
Obsessive-Compulsive (I) Inmate From: A Library Dungeon |
posted 03-21-2007 02:15
Ha, and here I was thinking I was being so smart moving them into a directory away from the index... I didn't even think that you guys couldn't read it! I also renamed the .inc file because I wasn't sure about that one. |
Maniac (V) Mad Scientist From: :morF |
posted 03-21-2007 11:43
@ is an interpreter signal in PHP. It says "supress any error messages this function may produce" because (it assumes) you're going ot handle those yourself. |
Obsessive-Compulsive (I) Inmate From: A Library Dungeon |
posted 03-22-2007 00:24
Ohhhhh... Thanks! I'll get right to removing them... |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 03-22-2007 20:24
Okay it's probably an error with the insert.php file |
Obsessive-Compulsive (I) Inmate From: A Library Dungeon |
posted 03-23-2007 03:47
What is "error_reporting(E_ALL);" supposed to do? I've done what you suggested with the $short and $userfile and I've added the error reporting, but it's still doing it |
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 03-23-2007 16:38
php->error_reporting ( that link goes to the manual) makes sure you can actually see the errors and warnings your script encounters. |