Paul Swanson
Members-
Posts
163 -
Joined
-
Last visited
-
Days Won
19
Paul Swanson last won the day on May 19 2012
Paul Swanson had the most liked content!
Paul Swanson's Achievements
Newbie (1/14)
104
Reputation
-
Chapter 9
Paul Swanson replied to Christopher Bergin's topic in PHP for the Web: Visual QuickStart Guide (4th Edition)
Do you have Safari configured to deny sites from setting cookies? I have FF set up to prompt me, and when I first visited your test site I had to accept the cookie. If cookies are not accepted, it's never going to work. -
Chapter 9
Paul Swanson replied to Christopher Bergin's topic in PHP for the Web: Visual QuickStart Guide (4th Edition)
It partially works for me. I selected font-size small and color blue and it printed "the font size is...land the font color is..." and when I click the link it appears small and blue. View source and font-size is set to small and color to #00f. If I select the Customize Your Settings link and select large and gray, it prints "the font size is...smalland the font color is...00f" and the text appears large and gray when I click the link. View source shows font-size: large; color: #999. Select Customize Your Settings again, and select medium and red and it says "the font size is...largeand the font color is...999" and the link displays medium text in red. View source shows font-size: medium, color: #c00. It appears that the cookie is not displaying the updated values, but the value that was set previously. Also, you must select both the size and color. If you only select one, the cookie value for the omitted option is set to an empty string. This is tested using Firefox 14.0.1 on Windows 7. -
Are you typing the address to the page in the address bar, or are you browsing to it? You should be typing //localhost/path_to/images.php (replace path_to with the names of any sub-folders that images.php might be in). The message you are getting regarding a shell script makes it sound like the script is not being run through the web server, which is required for php scripts.
-
Websockets Question
Paul Swanson replied to HartleySan's topic in Modern Javascript: Develop and Design
You might have to ask your hosting service to execute that script for you. You could ask for telnet access, but I wouldn't expect them to allow it since it would make it easier for you to access other customer's folders on the same server. -
I think that for your stated purposes, using document.write() will be fine. You could also use alert().
-
Session Handling
Paul Swanson replied to sonal's topic in PHP for the Web: Visual QuickStart Guide (4th Edition)
Found this in the user contributed notes on the PHP Manual page for session_start(): <?php if (!isset ($_COOKIE[ini_get('session.name')])) { session_start(); } ?> -
Is your password field 41 characters long? The PASSWORD function in earlier versions of MySQL created a 16 character string, but later versions (I forget which version the change was made) create a 41 character string. Your version is definitely creating the longer string, so if your field is defined for less than that the string is getting truncated when it is inserted, and what is in the database won't match your query.
-
In the form input field, your code should be echoing $_POST['last_name'], not the escaped variable. It's the escaping that is adding the slash. Try this: <tr> <td><b>Last Name:</b></td> <td><input type="text" name="last_name" size="20" maxlength="40" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /></td> </tr> Your form should re-fill the line with exactly what was typed into it. The escaped value is intended only for use in a database query. Once you retrieve it from the database, if you need to display it in a web page, you will need to use stripslashes() on it.
-
Maybe Dreamweaver isn't configured for PHP? Just guessing, as I don't use Dreamweaver. You might try a different IDE, such as Netbeans with the PHP plugin. Don't be put off by all the Java references. It's primary supported language is Java, but it supports many other languages. It's free. Many people use Dreamweaver for PHP, though, so if you're comfortable with it you can continue to use it.
-
Network Monitor
Paul Swanson replied to JamesButler's topic in Modern Javascript: Develop and Design
I'm not Larry, but I think Fiddler is good. I believe it's Windows-only, and works with IE by default, but you can configure it to work with Firefox. http://www.fiddler2.com/fiddler2/ http://fiddler2.com/Fiddler2/addons/fiddlerhook/ It's free. -
Milo, I believe in the example you provided, the % character is being used to represent the prompt in Terminal. In Edwards example, his prompt is Edward$. In Windows, the > character is normally used as the prompt (e.g., C:\>). You need to type what comes after the % character.
-
You might try something like this: $query = " SELECT event_id, event_year, vehicles.*, users.user_id, first_name, last_name FROM event_entries, vehicles, users WHERE event.event_year = '2012' AND event.user_id = users.user_id AND vehicles.vehicle_id IN (event_entries.selected_vehicles) AND vehicles.user_id = users.user_id ORDER BY event.event_year DESC, last_name ASC"; $r = mysqli_query ($dbc, $query); if ($r) { // no errors in query, begin table echo <<<EOT <table> <tr> <th>Event Year</th><th>Exhibitor</th><th>Vehicle</th> </tr> EOT; while ($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)) { echo <<<EOT <tr> <td>{$row['event_year']}</td> <td>{$row['last_name']}, {$row['first_name']}</td> <td>{$row['year']} {$row['brand']} {$row['type']}</td> </tr> EOT; } // end while loop echo '</table>' . "\n"; } // end $r conditional You might need to fiddle a bit with the IN (event_entries.selected_vehicles) part.
-
thara is right, you have to create the uploads folder. I have a different edition of the book, but there is a step in the 4th edition that instructs you to create the directory. The move_uploaded_file() does the actual moving, and will return true if successful, or false if it fails.The reasons for failure could be that it was not provided a valid filename, or if the file could not be moved due to permissions or a path error. If the destination folder already has a file by that name, it will be overwritten. Check out the User Contributed Notes on the manual page.
- 5 replies
-
- move_uploaded_file
- 10.3
-
(and 1 more)
Tagged with: