Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



  1. I am working on the Admin area for the coffee shop site, and I am encountering an error when the query to get all products to list them on the page. I cut and paste the query because it was so complicated, thinking I would make a syntax error. I am getting an error anyway! An error occurred in script 'C:\vhosts\clever-coffee.net\html\admin\add_inventory.php' on line 94: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given Array( [0] => Array ( [function] => my_error_handler [args] => Array ( [0] => 2 [1] => mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given [2] => C:\vhosts\clever-coffee.net\html\admin\add_inventory.php [3] => 94 [4] => Array ( [_GET] => Array ( ) [_POST] => Array ( ) [_COOKIE] => Array ( [SESSION] => 115cadb3f0e62db701dc0055e125b213 [PHPSESSID] => 115cadb3f0e62db701dc0055e125b213 ) [_FILES] => Array ( ) [_SERVER] => Array ( [HTTP_HOST] => clever-coffee.net [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; rv:40.0) Gecko/20100101 Firefox/40.0 FirePHP/0.7.4 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_REFERER] => http://clever-coffee.net/html/admin/add_coffee.php [HTTP_COOKIE] => SESSION=115cadb3f0e62db701dc0055e125b213; PHPSESSID=115cadb3f0e62db701dc0055e125b213 [HTTP_X_INSIGHT] => activate [HTTP_CONNECTION] => keep-alive [HTTP_CACHE_CONTROL] => max-age=0 [PATH] => C:\Program Files\ActiveState Komodo Edit 9 nightly\;C:\ProgramData\Oracle\Java\javapath;C:\ImageMagick;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\PROGRA~1\IBM\CLIENT~1;C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~1\Emulator;c:\Program Files\Java\jdk1.7.0_45\bin;C:\Program Files\Java\jdk1.7.0_51\/bin;C:\Apache Subversion 1.8.8\bin;C:\limejs\bin;C:\DevStack\MariaDB10\bin;c:\DevStack\php;c:\DevStack\php\ext;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\GnuWin32\bin;c:\drush;C:\PostgreSQL;C:\PostgreSQL\bin;C:\MinGW\bin;C:\devtools\bin\Ruby200\bin;C:\Windows\system32\WindowsPowerShell\v1.0\;C:\Python27\;C:\Python27\Scripts;C:\ImageMagick;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\PROGRA~1\IBM\CLIENT~1;C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~1\Emulator;c:\Program Files\Java\jdk1.7.0_45\bin;C:\Program Files\Java\jdk1.7.0_51\/bin;C:\Apache Subversion 1.8.8\bin;C:\limejs\bin;C:\DevStack\mysql-5.6.19\bin;C:\DevStack\mysql-5.6.19\;C:\DevStack\mysql-5.6.19\Doctrine extensions for PHP\;c:\DevStack\php;c:\DevStack\php\ext;C:\Program Files\nodejs\;C:\Users\vmielke\AppData\Roaming\npm;C:\ProgramData\chocolatey\bin;C:\devtools\bin;\Git\bin;\Git\cmd;C:\devtools\bin\ruby\bin;C:\Users\vmielke\.gems;C:\Users\vmielke\.gems\bin [SystemRoot] => C:\Windows [COMSPEC] => C:\Windows\system32\cmd.exe [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW [WINDIR] => C:\Windows [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache/2.4.16 (Win32) OpenSSL/1.0.2d PHP/5.5.14 [SERVER_NAME] => clever-coffee.net [SERVER_ADDR] => [SERVER_PORT] => 80 [REMOTE_ADDR] => [DOCUMENT_ROOT] => C:/vhosts/clever-coffee.net [REQUEST_SCHEME] => http [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => C:/vhosts/clever-coffee.net [SERVER_ADMIN] => admin@clever-coffee.net [SCRIPT_FILENAME] => C:/vhosts/clever-coffee.net/html/admin/add_inventory.php [REMOTE_PORT] => 58816 [REMOTE_USER] => vmielke [AUTH_TYPE] => Basic [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /html/admin/add_inventory.php [SCRIPT_NAME] => /html/admin/add_inventory.php [PHP_SELF] => /html/admin/add_inventory.php [PHP_AUTH_USER] => vmielke [PHP_AUTH_PW] => password [REQUEST_TIME_FLOAT] => 1441830236.003 [REQUEST_TIME] => 1441830236 ) [connect] => mysqli Object ( [affected_rows] => -1 [client_info] => mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $ [client_version] => 50011 [connect_errno] => 0 [connect_error] => [errno] => 1054 [error] => Unknown column 'sc.size' in 'order clause' [error_list] => Array ( [0] => Array ( [errno] => 1054 [sqlstate] => 42S22 [error] => Unknown column 'sc.size' in 'order clause' ) ) [field_count] => 0 [host_info] => via TCP/IP [info] => [insert_id] => 0 [server_info] => 5.5.5-10.0.17-MariaDB [server_version] => 50505 [stat] => Uptime: 116256 Threads: 1 Questions: 1928 Slow queries: 0 Opens: 25 Flush tables: 1 Open tables: 88 Queries per second avg: 0.016 [sqlstate] => 00000 [protocol_version] => 10 [thread_id] => 375 [warning_count] => 0 ) [page_title] => Add Inventory [message] => [affected] => 0 [_SESSION] => Array ( ) [query3] => (SELECT CONCAT("G", ncp.id) AS sku, ncc.category, ncp.name, FORMAT(ncp.price/100, 2) AS price, ncp.stock FROM non_coffee_products AS ncp INNER JOIN non_coffee_categories AS ncc ON ncc.id=ncp.non_coffee_category_id ORDER BY category, name) UNION (SELECT CONCAT("C", sc.id),gc.category, CONCAT_WS(" - ", s.size, sc.caf_decaf, sc.ground_whole), FORMAT(sc.price/100, 2), sc.stockFROM specific_coffees AS sc INNER JOIN sizes AS s ON s.id=sc.size_id INNER JOIN general_coffees AS gcON gc.id=sc.general_coffee_id ORDER BY sc.general_coffee_id, sc.size, sc.caf_decaf, sc.ground_whole) [result] => ) ) ) [1] => Array ( [file] => C:\vhosts\clever-coffee.net\html\admin\add_inventory.php [line] => 94 [function] => mysqli_fetch_array [args] => Array ( [0] => [1] => 1 ) ))
  2. I have a website that I am going to turn into a store and I am reading your book. It says that it might be best to use an ssl connection only on pages where it is needed. I don't know how to implement ssl only on specific pages. How do we do that. Right now I only know how to either add it to every page using the .htaccess file or not at all. What code do I use to only make some pages secure? Because if I only use https on some links, if I click on a page of my site that doesn't have https and then click on a page that does, my browser then makes all the other links I click on in my site use https too. Is that normal. That is also after I remove my .htaccess code that makes all pages contain https.
  3. If I wanted to automatically send an email to one of my subscribers to let them know that their subscription had expired or was about to expire, would that be part of the IPN code?
  4. This is an adaptation of the view_cart.php script in ch 19. It had worked previously until I changed servers/web hosting. It may be coincidental, however, when changing cart quantity to zero, it will either throw an error (undefined total variable) or add additional products to cart which were previously deleted in the same session. All other functions work propertly, including "add to cart" and "checkout" when quantities are not changed to zero. Any suggestions would be greatly appreciated. <div class="generalarticle"> <?php // add_cart.php $cart = $_SESSION['cart']; // Check if the form has been submitted (to update the cart): if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Change any quantities: foreach ($_POST['qty'] as $k => $v) { // Must be integers! $pid = (int) $k; $qty = (int) $v; if ( $qty == 0 ) { // Delete. unset ($_SESSION['cart'][$pid]); } elseif ( $qty > 0 ) { // Change quantity. $_SESSION['cart'][$pid]['quantity'] = $qty; } } // End of FOREACH. } // End of SUBMITTED IF. // Display the cart if it's not empty... if (!empty($_SESSION['cart'])) { // Retrieve all of the information for the prints in the cart: require ('../mysqli_connect.php'); // Connect to the database. $q = "SELECT * FROM products WHERE productID IN ("; foreach ($_SESSION['cart'] as $pid => $value) { $q .= $pid . ','; } $q = substr($q, 0, -1) . ') ORDER BY productName ASC'; $r = mysqli_query ($dbc, $q); // Create a form and a table: echo '<form action="https://www.mysite.net/view-cart/" method="post"> <fieldset class="checkout"> <legend class="checkout">My Shopping Cart</legend> <table border="0" width="90%" cellspacing="3" cellpadding="3" align="center"> <tr class="checkout" > <td class="checkout" align="left" width="30%"><b>Item Name</b></td> <td class="checkout" align="right" width="10%"><b>Price</b></td> <td class="checkout" align="right" width="10%"><b>Shipping</b></td> <td class="checkout" align="center" width="10%"><b>Qty</b></td> <td class="checkout" align="right" width="10%"><b>Total Price</b></td> </tr> '; // Print each item... $total = 0; // Total cost of the order. while ($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)) { // Calculate the total and sub-totals. $subtotal = (($_SESSION['cart'][$row['productID']]['quantity'] * $_SESSION['cart'][$row['productID']]['price']) + ($_SESSION['cart'][$row['productID']]['quantity'] * $_SESSION['cart'][$row['productID']]['shipping'])); $total += $subtotal; // Print the row: echo "\t<tr class=\"checkout\"> <td class=\"checkout\" align=\"left\">{$row['productName']}</td> <td class=\"checkout\" align=\"right\">\${$_SESSION['cart'][$row['productID']]['price']}</td> <td class=\"checkout\" align=\"right\">\${$_SESSION['cart'][$row['productID']]['shipping']}</td> <td class=\"checkout\" align=\"center\"><input type=\"text\" size=\"3\" name=\"qty[{$row['productID']}]\" value=\"{$_SESSION['cart'][$row['productID']]['quantity']}\" /></td> <td class=\"checkout\" align=\"right\">$" . number_format ($subtotal, 2) . "</td> </tr>\n"; } // End of the WHILE loop. mysqli_close($dbc); // Close the database connection. // Print the total, close the table, and the form: echo '<tr> <td class="checkout" colspan="4" align="right"><b>Total:</b></td> <td class="checkout" align="right">$' . number_format ($total, 2) . '</td> </tr> </table> <div align="center"><input type="submit" name="submit" value="Update My Cart" /></div> </form> <p align="center">Enter a quantity of 0 to remove an item. <br /><br /><a href="https://www.mysite.net/checkout/">Checkout</a> or <a href="https://www.mysite.net/real-estate-advertisement-packages/">Continue Shopping</a>.</p></fieldset>'; } else { echo '<p>Your cart is currently empty.</p>'; } $_SESSION['total'] = $total; // carry total to checkout $_SESSION['cart'] = $cart; // carry total to checkout ?> </div> <div class="sidebar"></div> <div class="spacer"></div> </div></div>
  5. I am wondering if there is a way to use this book without performing the complex joins that have UNION statements in them. I think it is chapter 9 or 10 of the book, the chapter that shows the most complex mysql statements. How could I go about using this book without using those complex mysql joins.
  6. In the following code, (I know the if statement isn't complete, I am referring to the part before it) I am unclear why (int) is used, after using php for over a year I have never really understood when I should use (int). Is it to make sure the returned number is changed from a decimal to an integer?? Please explain why it is used in this block of code. It is from chapter 6 in the ipn.php script. if (mysqli_num_rows($r) === 0){ $uid = (isset($_POST['custom'])) ? (int) $_POST['custom'] : 0; $status = escape_data($_POST['payment_status'], $dbc); $amount = (int) ($_POST['mc_gross'] * 100); $q = "INSERT INTO orders (user_id, transaction_id, payment_status, payment_amount) VALUES ($uid, '$txn_id', '$status', $amount)"; $r = mysqli_query($dbc, $q); if (mysqli_affected_rows($dbc) === 1){ } }
  7. I must be missing something very basic but I'm stuck after several hrs of trying various solutions to this apparent function re-declaration in my config.inc.php file. Possibly after staring at the code for so long I just can't see it any more. But, I keep getting an error: Cannot redeclare my_error_handler() (previously declared in C:\xampp\htdocs\muztash\config\config.inc.php:64) in C:\xampp\htdocs\muztash\config\config.inc.php on line 91 The error seems to say that the function is being declared twice on the same page. Line 64 is the 1st line of the actual declaration: function my_error_handler($e_number,$e_message,$e_file,$e_line,$e_vars) { Line 91 is the ending } of the declaration. It matches the opening { on line 64 and there are no brace mismatches inside the declaration - which pretty closely follows the example code in the book. I have a couple of other questions but I'll focus on this one first. Thanks to whoever can help me with this.
  8. On page 117 Larry forgot to enter this line of code at the beginning of the script. if ($_SERVER['REQUEST_METHOD'] === 'POST') { Larry should post a full forum post with all the errors in this book to help us out, it is very frustrating having to try and make scripts work with errors in them, especially when we are not as experienced as Larry. I will post every error I find in this book in this forum as well as the solutions. So far I have found 3 errors in the book and I am only at chapter 5.
  9. In the ecommerce book, in chapter 3, you include files like so: include('./includes/header.html'); doesn't include('includes/header.html') do the same thing? Why use the ./ I don't understand. This wasn't covered in the other book I read from you php and mysql 4th edition.
  10. I'm used to using $_POST to handle my form data. In chapter 2, Mr Ullman states to use $_REQUEST. I did look up $_REQUEST on php.net and it says that it contains data for $_GET, $_POST, and $_COOKIE. Does that mean I no longer need to bother with $_GET or $_POST and just use $_REQUEST going forward? Sorry for the amateur question. I've done some PHP programming in the past and I'm trying to get back into it (hopefully in the correct way). Thank, James
  11. Here is my directory structure currently in the public html folder. uploaded_images (folder) allmyotherphpfiles.php allmyotherphpfiles.php allmyotherphpfiles.php allmyotherphpfiles.php Should the uploaded_images (folder) be stored outside the public html folder, so that hackers can't hack that folder, or is it safe to leave my folder like it is now.
  12. Spammers are sometimes visiting my new website and entering false data in my register.php script. The result is that they don't register and several php error log messages are emailed to me. I get an error message email for each form field that has an undefined index. I would like to know how to stop getting these emails. Here is a copy of a section of the error message email. An error occurred in script '/home/strawb15/public_html/examplesite.com/register.php' on line 40: Undefined index: emailArray ( [_GET] => Array ( ) [_POST] => Array ( [username] => hebirchfijose [usermail] => aulbachpuid@sohu.com [userpass] => E970d483- [usersex] => 1 [userliving] => 16 [bdayy] => 1930 [bdaym] => 3 [bdayd] => 12 [imgcode] => [formsubmit] => Y [submit] => 確定 ) [_COOKIE] => Array ( ) [_FILES] => Array [_SERVER] => Array ( [CONTENT_LENGTH] => 173 [CONTENT_TYPE] => application/x-www-form-urlencoded [DOCUMENT_ROOT] => /home/strawb15/public_html/examplesite.com [GATEWAY_INTERFACE] => CGI/1.1 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;image/png,image/jpeg,image/*;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_ENCODING] => gzip [HTTP_ACCEPT_LANGUAGE] => en-us;q=0.7, en;q=0.3 [HTTP_CACHE_CONTROL] => max-age=259200 [HTTP_CONNECTION] => keep-alive [HTTP_HOST] =>www.examplesite.com [HTTP_REFERER] =>http://www.examplesite.com/register.php [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 [HTTP_VIA] => 1.1 117-30-149:55336 (s.r577) [HTTP_X_FORWARDED_FOR] => [PATH] => /bin:/usr/bin [phpRC] => /home/strawb15/public_html [QUERY_STRING] => [REDIRECT_STATUS] => 200 [REMOTE_ADDR] => [REMOTE_PORT] => 13417 [REQUEST_METHOD] => POST [REQUEST_URI] => /register.php [sCRIPT_FILENAME] => /home/strawb15/public_html/examplesite.com/register.php [sCRIPT_NAME] => /register.php [sERVER_ADDR] => [sERVER_ADMIN] => webmaster@examplesite.com [sERVER_NAME] => www.examplesite.com [sERVER_PORT] => 80 [sERVER_PROTOCOL] => HTTP/1.0 [sERVER_SIGNATURE] => [sERVER_SOFTWARE] => Apache [uNIQUE_ID] => VXgCnBfrzmMAAHvJFtIAAAA3 [php_SELF] => /register.php [REQUEST_TIME_FLOAT] => 1433928348.53 [REQUEST_TIME] => 1433928348 [argv] => Array ( ) [argc] => 0
  13. I just built a website with the tactics in this book. I am looking for a small script to resend the activation link in case someone didn't get it. Any ideas on how I should make it.
  14. I am creating a forum for my site from the example in this book. I want to include a feature to my new forum where people can see the number of views a thread has had. Does anyone have any ideas on how I could code that.
  15. I have my own website that I am trying to install clean search engine friendly urls on. I am doing this for the article page section of my site. I have it working except for a glitch. I am comparing my setup with that of this website and others which use htaccess clean urls. So basically I have my url which is like the following. http://stackoverflow.com/questions/9183130/php-htaccess-apply-page-title-in-url it works when I click on it and everything is fine. but if I take a part of the url like so: http://stackoverflow.com/questions/9183130/php-htaccess-apply-pag and refresh it still works which is ok. but the url doesn't return to the former one, it stays like that, missing part of the title in the url. I can't figure out how to make it revert back to the original url. All pages which seem to use clean urls have it working like that. here is my htaccess rule. and then I will show you the link I am using to link to the page. RewriteEngine On RewriteRule ^article/([0-9]+)/([a-zA-Z]+) article.php?id=$1&title=$2 $punctuation = array('$', '-', ',', '/', '\\', '!', '.', ' ', '*', '&', '?', '%', '\'', '<', '>', '[', ']', '(', ')'); $real_title = str_replace($punctuation, '-', $row5['title']); $real_title = str_replace(' ', '-', $real_title); $real_title = strtolower($real_title); $real_title = mysqli_real_escape_string($dbc, $real_title); <a href="http://www.example.com/article/'.$row5['article_id'].'/'.$real_title.'">'.$row5['title'].'</a>
  16. Right now on my website I created when someone is logged in they can go to the url in the address bar and change the id number associated with the url. for example one page I have is add_image.php?id=4 4 is the id associated with the article. If someone changes the 4 to a 7 for example. Then my page will show the other user's data on my page without them even entering that other person's login info. How do I make sure people can't see other user's data when they change the id number. I am using the scripts from this book. Maybe I missed something. I am using sessions properly as far as I can tell. I really would need some help with this. please give an example of secure code to use. thank you
  17. Hello! I'm doing the appendix test PHP and SQL page and i keep getting a 'object not found' page. The requested URL was not found on this server. Can anyone fill in what i maybe doing wrong here. I checked the spelling it's not that.
  18. I want to get the primary key values of movie and actor table. When i selected values in radio button primary key has been created automatically to the movie and actor table. Now I want to get that primary key value and insert to the movie_actor table. my code connect.php <?php $dbc = mysqli_connect('localhost','root','black98765','db_name') OR die("Cannot connect to MySQL:" . mysqli_connect_error()); //insert into actor table $q = "INSERT INTO actor (name) VALUES ('$actor')"; //insert into movie table $q2 = "INSERT INTO movie (movie_name, release_year) VALUES ('$movie','$year')"; //movie_actor table $q3 = "INSERT INTO movie_actor (movie_no,actor_no,rate) VALUES ('$rate')"; //what value i need to put inside values for movie_no and actor_no? //connect and insert $q $r = mysqli_query($dbc,$q); $r2 = mysqli_query($dbc,$q2); $r3 = mysqli_query($dbc,$q3); if($r && $r2 && $r3){ echo "Inserted Successfully!"; }else{ echo "Failed to Insert Data!"; mysqli_error($dbc); } mysqli_close($dbc); ?> form.php <?php if(isset($_POST['submit'])){ if($_SERVER['REQUEST_METHOD'] == 'POST'){ $error = array(); //choose actor if(!isset($_POST['actor'])){ $error[] = "Please choose of the following actors!"; }else{ $actor = $_POST['actor']; } //choose movie if(!isset($_POST['movie'])){ $error[] = "Please choose of the following movies!"; }else { $movie = $_POST['movie']; } //choose release year if(!isset($_POST['year'])){ $error[] = "Please choose of the following release year!!"; }else{ $year = $_POST['year']; } //choose rate if(!isset($_POST['rate'])){ $error[] = "Please choose of the following rate!"; }else{ $rate = $_POST['rate']; } //if no errors if(empty($error)){ require('connect.php'); }else{ echo "<p>System Error!</p>"; foreach($error as $msg){ echo $msg."<br/>\n"; } } } } ?> <form action="form.php" method="POST"> <p>Select on the following Selections</p> <p><label for="actor">Name of Actor:</label> <input type="radio" name="actor1" value="Jet Li"/>Jet Li <input type="radio" name="actor2" value="Sylvester Stallone"/>Sylvester Stallone <input type="radio" name="actor3" value="Jason Statham"/>Jason Statham</p> <p><label for="movie">Name of Movie:</label> <input type="radio" name="movie1" value="Expendables 3"/>Expendables 3 <input type="radio" name="movie2" value="Rocky"/>Rocky <input type="radio" name="movie3" value="Kiss of the Dragon"/>Kiss of the Dragon</p> <p><label for="movie">Release Year:</label> <input type="radio" name="year1" value="2014"/>2014 <input type="radio" name="year2" value="1976"/>1976 <input type="radio" name="year3" value="2001"/>2001</p> <p><input type="submit" name="submit" value="Insert"/></p> </form>
  19. in the book it shows us how to drop an index by using the following sql statement. ALTER TABLE t DROP INDEX i i being the name of the index. I went into phpmyadmin and I don't see an option for removing an index unless there is a name attached to the index. If I would write an sql statement to drop the index how would I write it if the index doesn't have a name.
  20. Hi I am using the footer script provided often in this book. And i am getting the following error from my website's error email log message. ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flushArray Is there something we need to do to prevent from getting this error. I looked online and found one answer, can anyone tell me if this is the correct thing to do for this problem. Or should I take another look at my scripts for errors. if (ob_get_level()>1){ ob_end_flush(); } thank you
  21. I have a client complaining that the php mail form I made is not working. He is not able to retrieve any mail from his web page. As a check, I substituted his email address with two of my own. They each worked as they should though he claims they still aren't reaching him. As I see it, the mail is definitely being sent from the web form page. If they are not getting to him, the only thing I can think of is Outlook is filtering them. Is mail sent from using php "mail" different enough from other mail to cause it to look like spam? Or something nefarious? thanks, for helping Chop
  22. I am using the php mail function on my site for user registration, so that the user receives an email confirmation link to click on when he registers. However during testing not every email address receives the confirmation email and sometimes after sending it, I can't send email to that email address anymore, no email gets through. what could be causing it. I am using the php mail function exactly like it says in this book.
  23. I am using a live site and the error message shouldn't be displayed on my website but it is. I don't know why. The error message it shows online is Could not connect to MySQL: Access denied for user 'moreaw32_grah2'@'localhost' (using password: YES) . When other errors occur on my site it does not show the detailed message. I don't want it to show the details of my database like my user name which it does show. Here is the line of code in my connection script. $dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error()) What can I do to prevent this.
  24. Hello, I have PHP file (file1.php) asking for a date: echo '<form action="charts.php" id="form_chart_date" method="post"> <div id="form_chart_date"> <p>Please select date. </p> <p><input name="date_looking" type="text"> <input type="submit" value="Display data" name="display_chart"></p> </div> </form>'; After submission file1.php handles the process but there is reference to JavaScript file which reads PHP generated JSON file. JavaScript file looks like: (document).ready(function() { var date = "<?php echo json_encode($_POST); ?>"; $.ajax({ data: {date_looking: date}, url: "http://localhost:8888//live_site_local/www/json.php", dataType: "JSON", type: "POST", cache: false, success: function(pieData) { var ctx = $("#chart-area").get(0).getContext("2d"); new Chart(ctx).Pie(pieData); } }); }); If I replace variable date with something like: var date = "2015-01-01"; then everything works ok. It looks like the problem is that I can not pass PHP $_POST array to JavaScript. Here is the line from PHP file (json.php) that generates JSON object. $date_looking = $_POST['date_looking']; Does anyone know what I am doing incorect? Thanks
  25. I am building a site from the info in this book. And the post I am writing as you read this has a toolbar at the top that allows me to add bold to text, and other cool options. Where could I get a toolbar like this for my website, so I can add it to form fields.? The main thing I am looking for is adding paragraphs when people type 2 carriage returns on their keyboard. So that the text area form field behaves like as if you are typing in a word processing document. Adding bold to text, italics, and underline would be great too, but as a beginner I can accept if the paragraphs is all I can handle code-wise. I do know some javascript, so if coding it involves that I might be able to. Any ideas on how to go about this would be wonderful!
  • Create New...