Jump to content

tobimichigan

Members
  • Posts

    207
  • Joined

  • Last visited

Everything posted by tobimichigan

  1. Hello Code Gents, I get so stretched breaking point when a trusted resuable code refuses to perform: Here's it <?php require_once("includes/start_session.php"); require_once("includes/cn.php"); $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $username=$_GET[$_SESSION['username']]; require_once("includes/nav_menu.php"); ///updates $msg=""; $aid=$_GET['aid']; $staff_id=$_GET['staff_id']; $come="select * from staff_payrolls where staff_id='$staff_id'"; $q1=mysqli_query($dbc,$come); $row=mysqli_fetch_array($q1); $aid = $row['aid']; $staff_id = $row['staff_id']; $basic = $row['basic']; $rent = $row['rent']; $pension = $row['pension']; $union = $row['union']; $tax = $row['tax']; $net = $row['net']; $gross = $row['gross']; if (isset($_POST['submit'])) { $renti=$basic*0.5; $pensioni=$basic*0.05; $unioni=$basic*0.03; $taxi=$basic*0.02; $neti=$basic+$rent; $grossi=$basic+$rent+$pension+$tax; // Grab the profile data from the POST //$staff_id = mysqli_real_escape_string($dbc, trim($_POST['staff_id'])); $basic = mysqli_real_escape_string($dbc, trim($_POST['basic'])); $rent = mysqli_real_escape_string($dbc, trim($_POST['rent'])); $union = mysqli_real_escape_string($dbc, trim($_POST['union'])); $pension = mysqli_real_escape_string($dbc, trim($_POST['pension'])); $tax = mysqli_real_escape_string($dbc, trim($_POST['tax'])); $net = mysqli_real_escape_string($dbc, trim($_POST['net'])); $gross = mysqli_real_escape_string($dbc, trim($_POST['gross'])); $error=false; if (!$error) { if (!empty($aid)) { //UPDATE `ak`.`staff_payrolls` SET `basic` = '' WHERE `staff_payrolls`.`aid` =1; $sql= "UPDATE `ak`.`staff_payrolls` SET `basic` ='$_POST[basic]', `rent`='$renti',`pension`='$pensioni',`union`='$unioni',`tax`='$taxi',`net` ='$neti',`gross` ='$grossi',`salary_date`=SYSDATE() where `staff_payrolls`.`aid` ='$aid'"; mysqli_query($dbc, $sql); } } // End of check for form submission } ?> <p><strong>Welcome to BODE COSMETICS PAYROLL MANAGEMENT SYSTEM.</strong></p> <p><?php echo("Welcome $_SESSION[username]. You can start by the top-pane Navigation") ;?> <p><?php //echo $err ; if (@mysqli_query($dbc, $sql)) { echo 'Record Updated';} $query = "SELECT * FROM staff_payrolls WHERE aid = '$aid'"; $data = mysqli_query($dbc, $query); $row = mysqli_fetch_array($data); $staff_id = $row['staff_id']; $basic = $row['basic']; $rent = $row['rent']; $pension = $row['pension']; $union = $row['union']; $tax = $row['tax']; $net = $row['net']; $gross = $row['gross']; ?> <table> <form name="login" method="post" action=""> <tr> <td> <th scope="col"><strong>STAFF UPDATE AREA</strong></th> </td> </tr> <tr> <td> STAFF ID <th scope="col"><input name="staff_id" type="text" value="<?php echo $row['staff_id']; ?>" disabled="disabled" /></th> </td> </tr> <tr> <td> BASIC SALARY<th scope="col"><input name="basic" type="text" value="<?php echo $row['basic']; ?>" /></th> </td> </tr> <tr> <td> RENT <th scope="col"><input name="rent" type="text" value="<?php echo $rent; ?>" /></th> </td> </tr> <tr> <td> PENSION <th scope="col"><input name="pension" type="text" value="<?php echo $pension; ?>" /></th> </td> </tr> <tr> <td> UNION <th scope="col"><input name="union" type="text" value="<?php echo $union; ?>" /></th> </td> </tr> <tr> <td> TAX <th scope="col"><input name="tax" type="text" value="<?php echo $tax; ?>" /></th> </td> </tr> <tr> <td> NET <th scope="col"><input name="net" type="text" value="<?php echo $net; ?>" /></th> </td> </tr> <tr> <td> GROSS <th scope="col"><input name="gross" type="text" value="<?php echo $gross; ?>" /></th> </td> </tr> <tr> <td> <th scope="col"><input name="submit" type="submit" value="Update_Salary" /></th> </td> </tr> </form> </table> </p> </div> <div class="footer"></div> </div> <div class="post"> <div class="header"> <?php require_once("includes/footer.php");?> The funny thing now is that when I press the submit button, nothing happens. Except for the display of what is in the database.
  2. Exellcent code...I like the way u implement your class with a good constructor besides your array seems ok 2 me.. but private function getAllItems() { $sql = 'SELECT * FROM `menu` ORDER BY `depth` ASC, `parent` ASC, `sort` ASC';//try and re-query this TROUBLE SPOT may be $sql = 'SELECT * FROM `menu` where clause=$clause;//better yet specify with an existing valid variable eg, $_session $database = new Database('default'); $database->connect(); $database->query($sql); $query = $database->getLastQuery(); while($row = mysql_fetch_array($query)) { $this->all_rows[] = $row; } } the select statement seems clumsy..I've corrected but modify that region as best suites you.
  3. It seems as if you're using short-tags, r u sure your ini.config recognizes that? Besides ur sql query has to prefectly draw a uniform and persistent data from the base. U should check this out too...
  4. It seems as if you're only showing part of your code..nonetheless if its working locally, why don't you check your variable connections if it matches the remote angle?
  5. Does any 1 have any good idea on how I can trap this error?
  6. Thorpe, her's my modified code: <?php // Start the session require_once('startsession.php'); // Insert the page header $page_title = 'Edit Profile'; require_once('header.php'); require_once('appvars.php'); require_once('connectvars.php'); // Make sure the user is logged in before going any further. if (!isset($_SESSION['user_id'])) { echo '<p class="login">Please <a href="login.php">log in</a> to access this page.</p>'; exit(); } // Show the navigation menu require_once('navmenu.php'); // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if (isset($_POST['submit']) && isset($_FILES['new_picture']['tmp_name'])) { // Grab the profile data from the POST $first_name = mysqli_real_escape_string($dbc, trim($_POST['firstname'])); $last_name = mysqli_real_escape_string($dbc, trim($_POST['lastname'])); $gender = mysqli_real_escape_string($dbc, trim($_POST['gender'])); $birthdate = mysqli_real_escape_string($dbc, trim($_POST['birthdate'])); $city = mysqli_real_escape_string($dbc, trim($_POST['city'])); $state = mysqli_real_escape_string($dbc, trim($_POST['state'])); $old_picture = mysqli_real_escape_string($dbc, trim($_POST['old_picture'])); $new_picture = mysqli_real_escape_string($dbc, trim($_FILES['new_picture']['name'])); $new_picture_type = $_FILES['new_picture']['type']; $new_picture_size = $_FILES['new_picture']['size']; list($new_picture_width, $new_picture_height) = getimagesize($_FILES['new_picture']['tmp_name']); $error = false; // Validate and move the uploaded picture file, if necessary if (!empty($new_picture)) { if ((($new_picture_type == 'image/gif') || ($new_picture_type == 'image/jpeg') || ($new_picture_type == 'image/pjpeg') || ($new_picture_type == 'image/png')) && ($new_picture_size > 0) && ($new_picture_size <= MM_MAXFILESIZE) && ($new_picture_width <= MM_MAXIMGWIDTH) && ($new_picture_height <= MM_MAXIMGHEIGHT)) { if ($_FILES['file']['error'] == 0) { // Move the file to the target upload folder $target = MM_UPLOADPATH . basename($new_picture); if (move_uploaded_file($_FILES['new_picture']['tmp_name'], $target)) { // The new picture file move was successful, now make sure any old picture is deleted if (!empty($old_picture) && ($old_picture != $new_picture)) { @unlink(MM_UPLOADPATH . $old_picture); } } else { // The new picture file move failed, so delete the temporary file and set the error flag @unlink($_FILES['new_picture']['tmp_name']); $error = true; echo '<p class="error">Sorry, there was a problem uploading your picture.</p>'; } } } else { // The new picture file is not valid, so delete the temporary file and set the error flag @unlink($_FILES['new_picture']['tmp_name']); $error = true; echo '<p class="error">Your picture must be a GIF, JPEG, or PNG image file no greater than ' . (MM_MAXFILESIZE / 1024) . ' KB and ' . MM_MAXIMGWIDTH . 'x' . MM_MAXIMGHEIGHT . ' pixels in size.</p>'; } } // Update the profile data in the database if (!$error) { if (!empty($first_name) && !empty($last_name) && !empty($gender) && !empty($birthdate) && !empty($city) && !empty($state)) { // Only set the picture column if there is a new picture if (!empty($new_picture)) { $query = "UPDATE mismatch_user SET first_name = '$first_name', last_name = '$last_name', gender = '$gender', " . " birthdate = '$birthdate', city = '$city', state = '$state', picture = '$new_picture' WHERE user_id = '" . $_SESSION['user_id'] . "'"; } else { $query = "UPDATE mismatch_user SET first_name = '$first_name', last_name = '$last_name', gender = '$gender', " . " birthdate = '$birthdate', city = '$city', state = '$state' WHERE user_id = '" . $_SESSION['user_id'] . "'"; } mysqli_query($dbc, $query); // Confirm success with the user echo '<p>Your profile has been successfully updated. Would you like to <a href="viewprofile.php">view your profile</a>?</p>'; mysqli_close($dbc); exit(); } else { echo '<p class="error">You must enter all of the profile data (the picture is optional).</p>'; } } } // End of check for form submission else { // Grab the profile data from the database $query = "SELECT first_name, last_name, gender, birthdate, city, state, picture FROM mismatch_user WHERE user_id = '" . $_SESSION['user_id'] . "'"; $data = mysqli_query($dbc, $query); $row = mysqli_fetch_array($data); if ($row != NULL) { $first_name = $row['first_name']; $last_name = $row['last_name']; $gender = $row['gender']; $birthdate = $row['birthdate']; $city = $row['city']; $state = $row['state']; $old_picture = $row['picture']; } else { echo '<p class="error">There was a problem accessing your profile.</p>'; } } mysqli_close($dbc); ?> <table> <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <tr> <td> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo MM_MAXFILESIZE; ?>" /> </td> </tr> <fieldset> <tr> <td> <legend>Personal Information</legend> </td> </tr> <tr> <td> <label for="firstname">First name:</label> </td> </tr> <tr> <td> <input type="text" id="firstname" name="firstname" value="<?php if (!empty($first_name)) echo $first_name; ?>" /><br /> </td> </tr> <tr> <td> <label for="lastname">Last name:</label> </td> </tr> <tr> <td> <input type="text" id="lastname" name="lastname" value="<?php if (!empty($last_name)) echo $last_name; ?>" /><br /> </td> </tr> <tr> <td> <label for="gender">Gender:</label> <select id="gender" name="gender"> <option value="M" <?php if (!empty($gender) && $gender == 'M') echo 'selected = "selected"'; ?>>Male</option> <option value="F" <?php if (!empty($gender) && $gender == 'F') echo 'selected = "selected"'; ?>>Female</option> </select><br /> </td> </tr> </label> <label for="birthdate">Birthdate:</label> </td> </tr> <tr> <td> <input type="text" id="birthdate" name="birthdate" value="<?php if (!empty($birthdate)) echo $birthdate; else echo 'YYYY-MM-DD'; ?>" /><br /> </td> </tr> <tr> <td> <label for="city">City:</label> </td> </tr> <tr> <td> <input type="text" id="city" name="city" value="<?php if (!empty($city)) echo $city; ?>" /><br /> </td> </tr> <tr> <td> <label for="state">State:</label> </td> </tr> <tr> <td> <input type="text" id="state" name="state" value="<?php if (!empty($state)) echo $state; ?>" /><br /> </td> </tr> <input type="hidden" name="old_picture" value="<?php if (!empty($old_picture)) echo $old_picture; ?>" /> <tr> <td> <label for="new_picture">Picture:</label> </td> </tr> <tr> <td> <input type="file" id="new_picture" name="new_picture" /> </td> </tr> <?php if (!empty($old_picture)) { echo '<img class="profile" src="' . MM_UPLOADPATH . $old_picture . '" alt="Profile Picture" />'; } ?> </fieldset> <tr> <td> <input type="submit" value="Save Profile" name="submit" /> </td> </tr> </form> </table> <?php // Insert the page footer require_once('footer.php'); ?> I implemented your corrction but its still bringing out that error. What do you think might be wrong?
  7. ok here we go: edit.php <?php // Start the session require_once('startsession.php'); // Insert the page header $page_title = 'Edit Profile'; require_once('header.php'); require_once('appvars.php'); require_once('connectvars.php'); // Make sure the user is logged in before going any further. if (!isset($_SESSION['user_id'])) { echo '<p class="login">Please <a href="login.php">log in</a> to access this page.</p>'; exit(); } // Show the navigation menu require_once('navmenu.php'); // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if (isset($_POST['submit'])) { // Grab the profile data from the POST $first_name = mysqli_real_escape_string($dbc, trim($_POST['firstname'])); $last_name = mysqli_real_escape_string($dbc, trim($_POST['lastname'])); $gender = mysqli_real_escape_string($dbc, trim($_POST['gender'])); $birthdate = mysqli_real_escape_string($dbc, trim($_POST['birthdate'])); $city = mysqli_real_escape_string($dbc, trim($_POST['city'])); $state = mysqli_real_escape_string($dbc, trim($_POST['state'])); $old_picture = mysqli_real_escape_string($dbc, trim($_POST['old_picture'])); $new_picture = mysqli_real_escape_string($dbc, trim($_FILES['new_picture']['name'])); $new_picture_type = $_FILES['new_picture']['type']; $new_picture_size = $_FILES['new_picture']['size']; list($new_picture_width, $new_picture_height) = getimagesize($_FILES['new_picture']['tmp_name']); $error = false; // Validate and move the uploaded picture file, if necessary if (!empty($new_picture)) { if ((($new_picture_type == 'image/gif') || ($new_picture_type == 'image/jpeg') || ($new_picture_type == 'image/pjpeg') || ($new_picture_type == 'image/png')) && ($new_picture_size > 0) && ($new_picture_size <= MM_MAXFILESIZE) && ($new_picture_width <= MM_MAXIMGWIDTH) && ($new_picture_height <= MM_MAXIMGHEIGHT)) { if ($_FILES['file']['error'] == 0) { // Move the file to the target upload folder $target = MM_UPLOADPATH . basename($new_picture); if (move_uploaded_file($_FILES['new_picture']['tmp_name'], $target)) { // The new picture file move was successful, now make sure any old picture is deleted if (!empty($old_picture) && ($old_picture != $new_picture)) { @unlink(MM_UPLOADPATH . $old_picture); } } else { // The new picture file move failed, so delete the temporary file and set the error flag @unlink($_FILES['new_picture']['tmp_name']); $error = true; echo '<p class="error">Sorry, there was a problem uploading your picture.</p>'; } } } else { // The new picture file is not valid, so delete the temporary file and set the error flag @unlink($_FILES['new_picture']['tmp_name']); $error = true; echo '<p class="error">Your picture must be a GIF, JPEG, or PNG image file no greater than ' . (MM_MAXFILESIZE / 1024) . ' KB and ' . MM_MAXIMGWIDTH . 'x' . MM_MAXIMGHEIGHT . ' pixels in size.</p>'; } } // Update the profile data in the database if (!$error) { if (!empty($first_name) && !empty($last_name) && !empty($gender) && !empty($birthdate) && !empty($city) && !empty($state)) { // Only set the picture column if there is a new picture if (!empty($new_picture)) { $query = "UPDATE mismatch_user SET first_name = '$first_name', last_name = '$last_name', gender = '$gender', " . " birthdate = '$birthdate', city = '$city', state = '$state', picture = '$new_picture' WHERE user_id = '" . $_SESSION['user_id'] . "'"; } else { $query = "UPDATE mismatch_user SET first_name = '$first_name', last_name = '$last_name', gender = '$gender', " . " birthdate = '$birthdate', city = '$city', state = '$state' WHERE user_id = '" . $_SESSION['user_id'] . "'"; } mysqli_query($dbc, $query); // Confirm success with the user echo '<p>Your profile has been successfully updated. Would you like to <a href="viewprofile.php">view your profile</a>?</p>'; mysqli_close($dbc); exit(); } else { echo '<p class="error">You must enter all of the profile data (the picture is optional).</p>'; } } } // End of check for form submission else { // Grab the profile data from the database $query = "SELECT first_name, last_name, gender, birthdate, city, state, picture FROM mismatch_user WHERE user_id = '" . $_SESSION['user_id'] . "'"; $data = mysqli_query($dbc, $query); $row = mysqli_fetch_array($data); if ($row != NULL) { $first_name = $row['first_name']; $last_name = $row['last_name']; $gender = $row['gender']; $birthdate = $row['birthdate']; $city = $row['city']; $state = $row['state']; $old_picture = $row['picture']; } else { echo '<p class="error">There was a problem accessing your profile.</p>'; } } mysqli_close($dbc); ?> <table> <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <tr> <td> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo MM_MAXFILESIZE; ?>" /> </td> </tr> <fieldset> <tr> <td> <legend>Personal Information</legend> </td> </tr> <tr> <td> <label for="firstname">First name:</label> </td> </tr> <tr> <td> <input type="text" id="firstname" name="firstname" value="<?php if (!empty($first_name)) echo $first_name; ?>" /><br /> </td> </tr> <tr> <td> <label for="lastname">Last name:</label> </td> </tr> <tr> <td> <input type="text" id="lastname" name="lastname" value="<?php if (!empty($last_name)) echo $last_name; ?>" /><br /> </td> </tr> <tr> <td> <label for="gender">Gender:</label> <select id="gender" name="gender"> <option value="M" <?php if (!empty($gender) && $gender == 'M') echo 'selected = "selected"'; ?>>Male</option> <option value="F" <?php if (!empty($gender) && $gender == 'F') echo 'selected = "selected"'; ?>>Female</option> </select><br /> </td> </tr> </label> <label for="birthdate">Birthdate:</label> </td> </tr> <tr> <td> <input type="text" id="birthdate" name="birthdate" value="<?php if (!empty($birthdate)) echo $birthdate; else echo 'YYYY-MM-DD'; ?>" /><br /> </td> </tr> <tr> <td> <label for="city">City:</label> </td> </tr> <tr> <td> <input type="text" id="city" name="city" value="<?php if (!empty($city)) echo $city; ?>" /><br /> </td> </tr> <tr> <td> <label for="state">State:</label> </td> </tr> <tr> <td> <input type="text" id="state" name="state" value="<?php if (!empty($state)) echo $state; ?>" /><br /> </td> </tr> <input type="hidden" name="old_picture" value="<?php if (!empty($old_picture)) echo $old_picture; ?>" /> <tr> <td> <label for="new_picture">Picture:</label> </td> </tr> <tr> <td> <input type="file" id="new_picture" name="new_picture" /> </td> </tr> <?php if (!empty($old_picture)) { echo '<img class="profile" src="' . MM_UPLOADPATH . $old_picture . '" alt="Profile Picture" />'; } ?> </fieldset> <tr> <td> <input type="submit" value="Save Profile" name="submit" /> </td> </tr> </form> </table> <?php // Insert the page footer require_once('footer.php'); ?> Whenever it brings out this error "Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in C:\xampp\htdocs" it refers to line 36 => <?php list($new_picture_width, $new_picture_height) = getimagesize($_FILES['new_picture']['tmp_name']);?>
  8. Code Gurus' Salute, Please I wanna catch this image upload exception without it bringing out this: "Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in C:\xampp\htdocs", Actually, I set the image size to be 32kb abd 120x120 pix. If anything varies from the above description it would not be uploaded, but it brings out "Your picture must be a GIF, JPEG, or PNG image file no greater than 32 KB and 120x120 pixels in size." alongside with that above error. Please gents how do I implement this exception without that warning signal?
  9. thorpe, what exactly are u saying there?
  10. Pls can you indicate how I can enable my localhost to do this?
  11. Here is my hierarchy: data -logs folder-debug.log htdocs -index.php include -Contollers,Smarty,Templater,Zend templates Now when I launch index.php from htdocs, I get this un-seeming error: "Fatal error: Uncaught exception 'Zend_Log_Exception' with message '"/var/htdocs/Books/practical_Web2.0/data/logs/debug.log" cannot be opened with mode "a"' in C:\xampp\php\PEAR\Zend\Log\Writer\Stream.php:69 Stack trace: #0 C:\xampp\htdocs\Books\practical_Web2.0\chapter-02\htdocs\index.php(11): Zend_Log_Writer_Stream->__construct('/var/htdocs/Boo...') #1 {main} thrown in C:\xampp\php\PEAR\Zend\Log\Writer\Stream.php on line 69 " I went to the zend folder in xampp, php, pear, zend, log, writer.php dir and I found this: /** * Class Constructor * * @param streamOrUrl Stream or URL to open as a stream * @param mode Mode, only applicable if a URL is given */ public function __construct($streamOrUrl, $mode = 'a') { if (is_resource($streamOrUrl)) { if (get_resource_type($streamOrUrl) != 'stream') { require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception('Resource is not a stream'); } if ($mode != 'a') { require_once 'Zend/Log/Exception.php'; throw new Zend_Log_Exception('Mode cannot be changed on existing streams'); } $this->_stream = $streamOrUrl; } else { if (! $this->_stream = @fopen($streamOrUrl, $mode, false)) { require_once 'Zend/Log/Exception.php'; $msg = "\"$streamOrUrl\" cannot be opened with mode \"$mode\""; throw new Zend_Log_Exception($msg); } } $this->_formatter = new Zend_Log_Formatter_Simple(); } line 69 is =>throw new Zend_Log_Exception($msg); What could be wrong? Hint: settings.conf [development] database.type = pdo_mysql database.hostname = localhost database.username = root database.password = database.database = phpweb20 paths.base = /var/htdocs/Books/practical_Web2.0 paths.data = /var/htdocs/Books/practical_Web2.0/data paths.templates = /var/htdocs/Books/practical_Web2.0/templates logging.file = /var/htdocs/Books/practical_Web2.0/data/logs/debug.log Any pointer as to why there is a fatal error?
  12. $qry=mysql_query($del) or die mysql_error();
  13. break it up into 2 parts viz a viz: $del="del from3 where 4=5"; $qry=mysql_query($del);
  14. Your delete query is wrong...check and recheck...the construct is wrong..
  15. I'm presently battling with this code in chapter7 of wrox's php 6.0 regarding images. The problem is that both the source code I downloaded from wrox's official website and the one I manually lifed from the chapter 7 page pages is not displaying the image on any browser but an "X" figure. The only difference is that the manually lifted code is inserting the sql query into all the fields of the image table; while the source code from the wrox's website isn't. Below are excerpts: Code from Wrox (I only modifed the image directories as I commented. 1. Table in use: <?php $db = mysql_connect('localhost', 'bp6am', 'bp6ampass') or die ('Unable to connect. Check your connection parameters.'); mysql_select_db('moviesite', $db) or die(mysql_error($db)); //create the images table $query = 'CREATE TABLE images ( image_id INTEGER NOT NULL AUTO_INCREMENT, image_caption VARCHAR(255) NOT NULL, image_username VARCHAR(255) NOT NULL, image_filename VARCHAR(255) NOT NULL DEFAULT "", image_date DATE NOT NULL, PRIMARY KEY (image_id) ) ENGINE=MyISAM'; mysql_query($query, $db) or die (mysql_error($db)); echo 'Images table successfully created.'; ?> 2. upload_image.php <html> <head> <title>Upload your pic to our site!</title> <style type="text/css"> <!-- td {vertical-align: top;} --> </style> </head> <body> <form action="check_image.php" method="post" enctype="multipart/form-data"> <table> <tr> <td>Your Username</td> <td><input type="text" name="username" /></td> </tr> <td>Upload Image*</td> <td><input type="file" name="uploadfile" /></td> </tr><tr> <td colspan="2"> <small><em>* Acceptable image formats include: GIF, JPG/JPEG and PNG. </em></small> </td> </tr><tr> <td>Image Caption<br/> </td> <td><input type="text" name="caption" /></td> </tr><tr> <td colspan="2" style="text-align: center"> <input type="submit" name="submit" value="Upload"/> </td> </tr> </table> </form> </body> </html> 3.check_image.php (this 1 does not insert image_filename into the image table) <?php //connect to MySQL $db = mysql_connect('localhost', 'root', '') or die ('Unable to connect. Check your connection parameters.'); mysql_select_db('moviesite', $db) or die(mysql_error($db)); //change this path to match your images directory from the text //$dir ='C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/images'; $dir='C:/xampp/htdocs/WroxPhp6.0/Ch07';//this is the 1st thing I changed //change this path to match your thumbnail directory $thumbdir = $dir . '/thumbs'; //change this path to match your fonts directory and the desired font putenv('GDFONTPATH=' . 'C:/Windows/Fonts'); $font = 'arial'; // handle the uploaded image if ($_POST['submit'] == 'Upload') { //make sure the uploaded file transfer was successful if ($_FILES['uploadfile']['error'] != UPLOAD_ERR_OK) { switch ($_FILES['uploadfile']['error']) { case UPLOAD_ERR_INI_SIZE: die('The uploaded file exceeds the upload_max_filesize directive ' . 'in php.ini.'); break; case UPLOAD_ERR_FORM_SIZE: die('The uploaded file exceeds the MAX_FILE_SIZE directive that ' . 'was specified in the HTML form.'); break; case UPLOAD_ERR_PARTIAL: die('The uploaded file was only partially uploaded.'); break; case UPLOAD_ERR_NO_FILE: die('No file was uploaded.'); break; case UPLOAD_ERR_NO_TMP_DIR: die('The server is missing a temporary folder.'); break; case UPLOAD_ERR_CANT_WRITE: die('The server failed to write the uploaded file to disk.'); break; case UPLOAD_ERR_EXTENSION: die('File upload stopped by extension.'); break; } } //get info about the image being uploaded $image_caption = $_POST['caption']; $image_username = $_POST['username']; $image_date = @date('Y-m-d'); list($width, $height, $type, $attr) = getimagesize($_FILES['uploadfile']['tmp_name']); // make sure the uploaded file is really a supported image $error = 'The file you uploaded was not a supported filetype.'; switch ($type) { case IMAGETYPE_GIF: $image = imagecreatefromgif($_FILES['uploadfile']['tmp_name']) or die($error); break; case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($_FILES['uploadfile']['tmp_name']) or die($error); break; case IMAGETYPE_PNG: $image = imagecreatefrompng($_FILES['uploadfile']['tmp_name']) or die($error); break; default: die($error); } //insert information into image table $query = "INSERT INTO images (image_caption, image_username, image_date) VALUES ('$image_caption', '$image_username', '$image_date')"; $result = mysql_query($query, $db) or die (mysql_error($db)); //retrieve the image_id that MySQL generated automatically when we inserted //the new record $last_id = mysql_insert_id(); // save the image to its final destination $image_id = $last_id; imagejpeg($image, $dir . '/' . $image_id . '.jpg'); imagedestroy($image); } else { // retrieve image information $query = 'SELECT image_id, image_caption, image_username, image_date FROM images WHERE image_id = ' . $_POST['id']; $result = mysql_query($query, $db) or die (mysql_error($db)); extract(mysql_fetch_assoc($result)); list($width, $height, $type, $attr) = getimagesize($dir . '/' . $image_id . '.jpg'); } if ($_POST['submit'] == 'Save') { // make sure the requested image is valid if (isset($_POST['id']) && ctype_digit($_POST['id']) && file_exists($dir . '/' . $_POST['id'] . '.jpg')) { $image = imagecreatefromjpeg($dir . '/' . $_POST['id'] . '.jpg'); } else { die('invalid image specified'); } // apply the filter $effect = (isset($_POST['effect'])) ? $_POST['effect'] : -1; switch ($effect) { case IMG_FILTER_NEGATE: imagefilter($image, IMG_FILTER_NEGATE); break; case IMG_FILTER_GRAYSCALE: imagefilter($image, IMG_FILTER_GRAYSCALE); break; case IMG_FILTER_EMBOSS: imagefilter($image, IMG_FILTER_EMBOSS); break; case IMG_FILTER_GAUSSIAN_BLUR: imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR); break; } // add the caption if requested if (isset($_POST['emb_caption'])) { imagettftext($image, 12, 0, 20, 20, 0, $font, $image_caption); } //add the logo watermark if requested if (isset($_POST['emb_logo'])) { // determine x and y position to center watermark list($wmk_width, $wmk_height) = getimagesize('images/logo.png'); $x = ($width - $wmk_width) / 2; $y = ($height - $wmk_height) / 2; $wmk = imagecreatefrompng('images/logo.png'); imagecopymerge($image, $wmk, $x, $y, 0, 0, $wmk_width, $wmk_height, 20); imagedestroy($wmk); } // save the image with the filter applied imagejpeg($image, $dir . '/' . $_POST['id'] . '.jpg', 100); //set the dimensions for the thumbnail $thumb_width = $width * 0.10; $thumb_height = $height * 0.10; //create the thumbnail $thumb = imagecreatetruecolor($thumb_width, $thumb_height); imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height); imagejpeg($thumb, $dir . '/' . $_POST['id'] . '.jpg', 100); imagedestroy($thumb); ?> <html> <head> <title>Here is your pic!</title> </head> <body> <h1>Your image has been saved!</h1> <img src="WroxPhp6.0/Ch07/<?php echo $_POST['id']; ?>.jpg" /><?php echo//here I changed the directory to my localhost ?> </body> </html> <?php } else { ?> <html> <head> <title>Here is your pic!</title> </head> <body> <h1>So how does it feel to be famous?</h1> <p>Here is the picture you just uploaded to our servers:</p> <?php if ($_POST['submit'] == 'Upload') { $imagename = 'WroxPhp6.0/Ch07/' . $image_id . '.jpg';//here I also changed the directory to my localhost (WroxPhp6.0/Ch07 dir) } else { $imagename = 'image_effect.php?id=' . $image_id . '&e=' . $_POST['effect']; if (isset($_POST['emb_caption'])) { $imagename .= '&capt=' . urlencode($image_caption); } if (isset($_POST['emb_logo'])) { $imagename .= '&logo=1'; } } ?> <img src="WroxPhp6.0/Ch07<?php echo $imagename; ?>" style="float:left;"> <table> <tr><td>Image Saved as: </td><td><?php echo $image_id . '.jpg'; ?></td></tr> <tr><td>Height: </td><td><?php echo $height; ?></td></tr> <tr><td>Width: </td><td><?php echo $width; ?></td></tr> <tr><td>Upload Date: </td><td><?php echo $image_date; ?></td></tr> </table> <p>You may apply special options to your image below. Note: saving an image with any of the options applied <em>cannot be undone</em>.</p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <div> <input type="hidden" name="id" value="<?php echo $image_id;?>"/> Filter: <select name="effect"> <option value="-1">None</option> <?php echo '<option value="' . IMG_FILTER_GRAYSCALE . '"'; if (isset($_POST['effect']) && $_POST['effect'] == IMG_FILTER_GRAYSCALE) { echo ' selected="selected"'; } echo '>Black and White</option>'; echo '<option value="' . IMG_FILTER_GAUSSIAN_BLUR . '"'; if (isset($_POST['effect']) && $_POST['effect'] == IMG_FILTER_GAUSSIAN_BLUR) { echo ' selected="selected"'; } echo '>Blur</option>'; echo '<option value="' . IMG_FILTER_EMBOSS . '"'; if (isset($_POST['effect']) && $_POST['effect'] == IMG_FILTER_EMBOSS) { echo ' selected="selected"'; } echo '>Emboss</option>'; echo '<option value="' . IMG_FILTER_NEGATE . '"'; if (isset($_POST['effect']) && $_POST['effect'] == IMG_FILTER_NEGATE) { echo ' selected="selected"'; } echo '>Negative</option>'; ?> </select> <br/><br/> <?php echo '<input type="checkbox" name="emb_caption"'; if (isset($_POST['emb_caption'])) { echo ' checked="checked"'; } echo '>Embed caption in image?'; echo '<br/><br/><input type="checkbox" name="emb_logo"'; if (isset($_POST['emb_logo'])) { echo ' checked="checked"'; } echo '>Embed watermarked logo in image?'; ?> <br/><br/> <input type="submit" value="Preview" name="submit" /> <input type="submit" value="Save" name="submit" /> </div> </form> </body> </html> <?php } ?> 4.Manually lifted code check_image.php (this 1 inserts image_filename into the image table) <?php $db = mysql_connect("localhost","root","") or die ("Unable to connect. Check your connection parameters."); mysql_select_db("moviesite", $db) or die(mysql_error($db)); //change this path to match your images directory $dir ="C:/xampp/htdocs/WroxPhp6.0/Ch07/manual"; //make sure the uploaded file transfer was successful if ($_FILES["uploadfile"]["error"] != UPLOAD_ERR_OK) { switch ($_FILES["uploadfile"]["error"]) { case UPLOAD_ERR_INI_SIZE: die("The uploaded file exceeds the upload_max_filesize directive " . "in php.ini."); break; case UPLOAD_ERR_FORM_SIZE: die("The uploaded file exceeds the MAX_FILE_SIZE directive that " . "was specified in the HTML form."); break; case UPLOAD_ERR_PARTIAL: die("The uploaded file was only partially uploaded."); break; case UPLOAD_ERR_NO_FILE: die("No file was uploaded."); break; case UPLOAD_ERR_NO_TMP_DIR: die("The server is missing a temporary folder."); break; case UPLOAD_ERR_CANT_WRITE: die("The server failed to write the uploaded file to disk."); break; case UPLOAD_ERR_EXTENSION: die("File upload stopped by extension."); break; } } //get info about the image being uploaded $uploadfile = $_POST["uploadfile"]; $image_caption = $_POST["caption"]; $image_username = $_POST["username"]; $image_date = date("Y-m-d"); list($width, $height, $type, $attr) = getimagesize($_FILES["uploadfile"]["tmp_name"]); // make sure the uploaded file is really a supported image switch ($type) { case IMAGETYPE_GIF: $image = imagecreatefromgif($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".gif"; break; case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".jpg"; break; case IMAGETYPE_PNG: $image = imagecreatefrompng($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".png"; break; default: die("The file you uploaded was not a supported filetype."); } //insert information into image table $query = "INSERT INTO images (image_caption, image_username, image_date) VALUES ('$image_caption.', '$image_username', '$image_date')"; $result = mysql_query($query, $db) or die (mysql_error($db)); //retrieve the image_id that MySQL generated automatically when we inserted //the new record $last_id = mysql_insert_id(); //because the id is unique, we can use it as the image name as well to make //sure we don’t overwrite another image that already exists $imagename = $last_id.$ext; // update the image table now that the final filename is known. $query = "UPDATE images SET image_filename = '$imagename' WHERE image_id = '$last_id'"; $result = mysql_query($query, $db) or die (mysql_error($db)); $sel=mysql_query("select * from images where image_filename='$imagename'"); $res=mysql_fetch_array($sel); $image_filename=$res['image_filename']; //save the image to its final destination switch ($type) { case IMAGETYPE_GIF: imagegif($image, $dir . '/' . $imagename); break; case IMAGETYPE_JPEG: imagejpeg($image, $dir . '/' . $imagename, 100); break; case IMAGETYPE_PNG: imagepng($image, $dir . '/' . $imagename); break; } imagedestroy($image); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Here's your pic</title> </head> <body> <h1> So how does it feel to be famous? </h1 > <p> Here is the picture you just uploaded to our servers: </p > <img src="WroxPhp6.0/Ch07/manual/<?php echo $imagename; ?>; ?>" style="float:left;"> <table> <tr> <td> Image Saved as: </td> <td><?php echo $imagename; ?></td> </tr> <tr> <td> Image Type: </td> <td> <?php echo $ext; ?> </td> </tr> <tr> <td> Height: </td> <td> <?php echo $height; ?> </td > </tr> <tr> <td> Width: </td> <td> <?php echo $width; ?> </td > </tr> <tr> <td> Upload Date: </td > <td > <?php echo $image_date; ?> </td > </tr> </table> </body> </html>
  16. Can any 1 come up with a real solution to this?
  17. Why is this code still displaying "x"?
  18. Using <p> Here is the picture you just uploaded to our servers: </p > <img src="images/<?php echo $imagename; ?>" style="float:left;">, in dreamweaver it then shows the code below in the view source. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Here's your pic</title> </head> <body> <h1> So how does it feel to be famous? </h1 > <p> Here is the picture you just uploaded to our servers: </p > <img src="images/5.jpg" style="float:left;"> <table> <tr> <td> Image Saved as: </td> <td>5.jpg</td> </tr> <tr> <td> Image Type: </td> <td> .jpg </td> </tr> <tr> <td> Height: </td> <td> 400 </td > </tr> <tr> <td> Width: </td> <td> 620 </td > </tr> <tr> <td> Upload Date: </td > <td > 2010-10-03 </td > </tr> </table> </body> </html>
  19. Here's what it says: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Here's your pic</title> </head> <body> <h1> So how does it feel to be famous? </h1 > <p> Here is the picture you just uploaded to our servers: </p > <img src="images/" style="float:left;"> <table> <tr> <td> Image Saved as: </td> <td>4.jpg</td> </tr> <tr> <td> Image Type: </td> <td> .jpg </td> </tr> <tr> <td> Height: </td> <td> 400 </td > </tr> <tr> <td> Width: </td> <td> 620 </td > </tr> <tr> <td> Upload Date: </td > <td > 2010-10-03 </td > </tr> </table> </body> </html>
  20. Hey, pf glad to have u back men.. here's my check_image.php: <?php $db = mysql_connect("localhost","root","") or die ("Unable to connect. Check your connection parameters."); mysql_select_db("moviesite", $db) or die(mysql_error($db)); //change this path to match your images directory $dir ="C:/xampp/htdocs/WroxPhp6.0/images"; //make sure the uploaded file transfer was successful if ($_FILES["uploadfile"]["error"] != UPLOAD_ERR_OK) { switch ($_FILES["uploadfile"]["error"]) { case UPLOAD_ERR_INI_SIZE: die("The uploaded file exceeds the upload_max_filesize directive " . "in php.ini."); break; case UPLOAD_ERR_FORM_SIZE: die("The uploaded file exceeds the MAX_FILE_SIZE directive that " . "was specified in the HTML form."); break; case UPLOAD_ERR_PARTIAL: die("The uploaded file was only partially uploaded."); break; case UPLOAD_ERR_NO_FILE: die("No file was uploaded."); break; case UPLOAD_ERR_NO_TMP_DIR: die("The server is missing a temporary folder."); break; case UPLOAD_ERR_CANT_WRITE: die("The server failed to write the uploaded file to disk."); break; case UPLOAD_ERR_EXTENSION: die("File upload stopped by extension."); break; } } //get info about the image being uploaded $uploadfile = $_POST["uploadfile"]; $image_caption = $_POST["caption"]; $image_username = $_POST["username"]; $image_date = date("Y-m-d"); list($width, $height, $type, $attr) = getimagesize($_FILES["uploadfile"]["tmp_name"]); // make sure the uploaded file is really a supported image switch ($type) { case IMAGETYPE_GIF: $image = imagecreatefromgif($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".gif"; break; case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".jpg"; break; case IMAGETYPE_PNG: $image = imagecreatefrompng($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".png"; break; default: die("The file you uploaded was not a supported filetype."); } //insert information into image table $query = "INSERT INTO images (image_caption, image_username, image_date) VALUES ('$image_caption.', '$image_username', '$image_date')"; $result = mysql_query($query, $db) or die (mysql_error($db)); //retrieve the image_id that MySQL generated automatically when we inserted //the new record $last_id = mysql_insert_id(); //because the id is unique, we can use it as the image name as well to make //sure we don’t overwrite another image that already exists $imagename = $last_id.$ext; // update the image table now that the final filename is known. $query = "UPDATE images SET image_filename = '$imagename' WHERE image_id = '$last_id'"; $result = mysql_query($query, $db) or die (mysql_error($db)); //save the image to its final destination switch ($type) { case IMAGETYPE_GIF: imagegif($image, $dir . '/' . $imagename); break; case IMAGETYPE_JPEG: imagejpeg($image, $dir . '/' . $imagename, 100); break; case IMAGETYPE_PNG: imagepng($image, $dir . '/' . $imagename); break; } imagedestroy($image); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Here's your pic</title> </head> <body> <h1> So how does it feel to be famous? </h1 > <p> Here is the picture you just uploaded to our servers: </p > <img src="images/<?php echo $imagename; ?>" style="float:left;"> <table> <tr> <td> Image Saved as: </td> <td><?php echo $imagename; ?></td> </tr> <tr> <td> Image Type: </td> <td> <?php echo $ext; ?> </td> </tr> <tr> <td> Height: </td> <td> <?php echo $height; ?> </td > </tr> <tr> <td> Width: </td> <td> <?php echo $width; ?> </td > </tr> <tr> <td> Upload Date: </td > <td > <?php echo $image_date; ?> </td > </tr> </table> </body> </html> As u can see I'm using </td> <td><?php echo $imagename; ?></td> </tr> and its still not dispaying any other thing than "X"..any other suggestions?
  21. Lite, I hope you re-read this post after posting cos u absolutely posted nothing on the screen..Maybe you could re-post what u actually intended.
  22. ok pf here's my final code: upload_image.php <?php $db = mysql_connect("localhost","root","") or die ("Unable to connect. Check your connection parameters."); mysql_select_db("moviesite", $db) or die(mysql_error($db)); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>upload_image</title> </head> <body> <form action="check_image.php" method="post" enctype="multipart/form-data"> <table> <tr> <td> Your Username </td> <td> <input type="text" name="username"/> </td> </tr> <td> Upload Image* </td> <td> <input type="file" name="uploadfile"/> </td> </tr> <tr> <td colspan="2"> <small> <em> * Acceptable image formats include: GIF, JPG/JPEG and PNG. </em> </small> </td> </tr> <tr> <td> Image Caption <br/> </td> <td> <input type="text" name="caption" /> </td> </tr > <tr> <td colspan="2" style="text-align: center"> <input type="submit" name="submit" value="Upload"/> </td> </tr> </table> </form> </body> </html> check_image.php <?php $db = mysql_connect("localhost","root","") or die ("Unable to connect. Check your connection parameters."); mysql_select_db("moviesite", $db) or die(mysql_error($db)); //change this path to match your images directory $dir ="C:/xampp/htdocs/WroxPhp6.0/img"; //make sure the uploaded file transfer was successful if ($_FILES["uploadfile"]["error"] != UPLOAD_ERR_OK) { switch ($_FILES["uploadfile"]["error"]) { case UPLOAD_ERR_INI_SIZE: die("The uploaded file exceeds the upload_max_filesize directive " . "in php.ini."); break; case UPLOAD_ERR_FORM_SIZE: die("The uploaded file exceeds the MAX_FILE_SIZE directive that " . "was specified in the HTML form."); break; case UPLOAD_ERR_PARTIAL: die("The uploaded file was only partially uploaded."); break; case UPLOAD_ERR_NO_FILE: die("No file was uploaded."); break; case UPLOAD_ERR_NO_TMP_DIR: die("The server is missing a temporary folder."); break; case UPLOAD_ERR_CANT_WRITE: die("The server failed to write the uploaded file to disk."); break; case UPLOAD_ERR_EXTENSION: die("File upload stopped by extension."); break; } } //get info about the image being uploaded $uploadfile = $_POST["uploadfile"]; $image_caption = $_POST["caption"]; $image_username = $_POST["username"]; $image_date = date("Y-m-d"); list($width, $height, $type, $attr) = getimagesize($_FILES["uploadfile"]["tmp_name"]); // make sure the uploaded file is really a supported image switch ($type) { case IMAGETYPE_GIF: $image = imagecreatefromgif($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".gif"; break; case IMAGETYPE_JPEG: $image = imagecreatefromjpeg($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".jpg"; break; case IMAGETYPE_PNG: $image = imagecreatefrompng($_FILES["uploadfile"]["tmp_name"]) or die("The file you uploaded was not a supported filetype."); $ext = ".png"; break; default: die("The file you uploaded was not a supported filetype."); } //insert information into image table $query = "INSERT INTO images (image_caption, image_username, image_date) VALUES ('$image_caption.', '$image_username', '$image_date')"; $result = mysql_query($query, $db) or die (mysql_error($db)); //retrieve the image_id that MySQL generated automatically when we inserted //the new record $last_id = mysql_insert_id(); //because the id is unique, we can use it as the image name as well to make //sure we don’t overwrite another image that already exists $imagename = $last_id.$ext; // update the image table now that the final filename is known. $query = "UPDATE images SET image_filename = '$imagename' WHERE image_id = '$last_id'"; $result = mysql_query($query, $db) or die (mysql_error($db)); //save the image to its final destination switch ($type) { case IMAGETYPE_GIF: imagegif($image, $dir . '/' . $imagename); break; case IMAGETYPE_JPEG: imagejpeg($image, $dir . '/' . $imagename, 100); break; case IMAGETYPE_PNG: imagepng($image, $dir . '/' . $imagename); break; } imagedestroy($image); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Here's your pic</title> </head> <body> <h1> So how does it feel to be famous? </h1 > <p> Here is the picture you just uploaded to our servers: </p > <table> <tr> <td> Image Saved as: </td> <td> <img src="img/<?php $imagename; ?>" style="float:left;"> </td> </tr> <tr> <td> Image Type: </td> <td> <?php echo $ext; ?> </td> </tr> <tr> <td> Height: </td> <td> <?php echo $height; ?> </td > </tr> <tr> <td> Width: </td> <td> <?php echo $width; ?> </td > </tr> <tr> <td> Upload Date: </td > <td > <?php echo $image_date; ?> </td > </tr> </table> </body> </html> I really dont get why this image is showing x. I have removed the dots at the update image (like u indicated) but the image is still not displaying. What is wrong with this modified code?
  23. Here's what I tried Pf: <img src="img/<?php echo $imagename; ?>" style="float:left;"> and <img src="img/<?php echo $imagename; ?>" style="float:left;"> and finally, <img src="WroxPhp6.0/img/<?php echo $imagename; ?> Wow, men, if these 3 codes rn't wking then I wonder which would get the image displayed. All of these seem to display 2 "X" while the rest of the information of the image displays intact..do u have any better ideas Pf?
×
×
  • 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.