Search the Community
Showing results for tags 'mac'.
-
Hi I just finished this tutorial('http://www.startutorial.com/articles/view/php-crud-tutorial-part-3/) and everything was working fine until I decided to add last names to the application. I got everything working on all the other pages except the Update page. This is my php code. d = $_REQUEST['id']; } if ( null==$id ) { header("Location: index.php"); } if ( !empty($_POST)) { // keep track validation errors $nameError = null; $lastError = null; $emailError = null; $mobileError = null; // keep track post values $name = $_POST['name']; $last = $_POST['last']; $email = $_POST['email']; $mobile = $_POST['mobile']; // validate input $valid = true; if (empty($name)) { $nameError = 'Please enter Name'; $valid = false; } $valid = true; if (empty($last)) { $lastError = 'Please enter last name'; $valid = false; } if (empty($email)) { $emailError = 'Please enter Email Address'; $valid = false; } else if ( !filter_var($email,FILTER_VALIDATE_EMAIL) ) { $emailError = 'Please enter a valid Email Address'; $valid = false; } if (empty($mobile)) { $mobileError = 'Please enter Mobile Number'; $valid = false; } // update data if ($valid) { $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "UPDATE customers set name = ?, last = ?, email = ?, mobile =? WHERE id = ?"; $q = $pdo->prepare($sql); $q->execute(array($name, $last,$email,$mobile,$id)); Database::disconnect(); header("Location: index.php"); } } else { $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM customers where id = ?"; $q = $pdo->prepare($sql); $q->execute(array($id)); $data = $q->fetch(PDO::FETCH_ASSOC); $name = $data['name']; $last = $data['last']; $email = $data['email']; $mobile = $data['mobile']; Database::disconnect(); } ?> When I hit Update it is directing me to a white screen instead of the index.php page.
-
Hi I wanted to open, read and close a file using following code: <?php $filename="test.txt"; $handle= fopen ($filename, "r"); $contents=fread($handle,filesize($filename)); fclose ($handle); ?> This file is located in the map: /users/sites/test.txt But opening the .php file on my local browser doesn't do a thing. I only get a blanc screen. I thought that file permission could be the problem, but I don't know what to change. Does anyone have any experience with this on Mac and how to solve it? Thanks already.
-
Hi I have a problem with image width and height. Apparently the images are the correct size on a windows computer, with the internet explorer, firefox, chrome or safari browser. But the height is wrong on a mac computer using the safari browser. The uploaded images on the server can be of any size. The visitors screen resolution varies, so that's why I set the width in percentages, because I don't want the picture being wider than 50% of the page. I see that picture is distorted in safari using a mac computer. The width is correct, but the height is wrong. The safari browser doesn't want to get the height in percentages for some reason. How do I solve this? CSS CODE: IMG.zooma {width: 50%; height: 50%;} DIV.edger {padding: 10px; border-style: solid; border-width: 1px; border-color: #000000;} PHP CODE: <DIV class='edger'> <P> <A HREF='fotoview.php?photo=".$photoid."&zoom=full'>".$photonom."</A> </P> <A HREF='fotoview.php?photo=".$photoid."&zoom=full'> <IMG src='pictures/".$photofile."' border='0' class='zooma'> </A> </DIV>
-
Hi guys, Ok I have been using php 5.4.0 since it's release I have recently updated to php 5.4.7 (I'm using Mountain Lion) I do have everything installed using the default apache web server that came with my mac nice little AMP stack. The default file in my Sites directory is index.php with phpinfo() (http://localhost) will show this file weirdly I see this PHP Version 5.3.15 Last time i checked i was developing on 5.4.7 so the applications i'm now coding doesnt work (due to outdated php) When i check the php version in my terminal i see php version 5.4.7. I'm an idiot when it comes to figuring this out has anyone had the same problem? If so please help Do i have to recompile php as it takes SO long. Thanks guys!
- 2 replies
-
- php
- installation
-
(and 1 more)
Tagged with: