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


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


  1. Hello, I'm preparing for the Zend PHP 5.3 certification and I have bought all 3 of Larrys books on PHP (PHP for web, PHP & MySQL and Advanced PHP). Can anyone here suggest if it would be better to start with the PHP for web book ? Or should I skip and move to PHP & MySQL book directly ? Should I use any other training material besides these books ? Thanks
  2. Hi. I was just wondering how facebook does it's continious updates on the wall if you know what I mean, I take it after a certain amount of time it calls a scripts which then gets the latest round of updates. So what technologies would be used here ? and also how would you stop it from repeating it's-self(i.e. calling the same data from before) ? Also does anyone know of any examples of this ? Regards
  3. I'm hoping someone might be able to help me with a new problem that has arisen on one of the sites I maintain. I'm getting a PHP error that says: "It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead." The funny thing is, the code has been in place for years and we've never gotten these errors. Suddenly they began popping up. I'm guessing maybe the host did an upgrade the the PHP version on the servers, but don't know for sure. I have a php.ini file for the site and it in I have tried everything I can think of, including: date.timezone=UTC date.timezone=America/Chicago date.timezone=US/Central When I look at the phpinfo() file the changes I make in my php.ini file are reflected, but I still get this error. What am I doing wrong? Any advice would be greatly appreciated. Thanks!
  4. My question is mainly regarding Chapter 11, sub-chapter "Understanding HTTP Headers", Pg. 357 - but it also includes more general basic question. There's a line on Pg. 357: "Before getting to the example, note that if a script uses multiple header( ) calls, each should be terminated by a newline (\n) as in the preceding code snippets." Why? (The reason isn't explained in the book.) Also. I see that Larry is using \n quite liberally in his code. I want to understand the reasons. One of them, probably the main one, I guess, is to make the resulting HTML code more readable. What are other possible reasons?
  5. Hello, I am trying to implement this code into a php script. By itself on a separate page it works fine but wihint a php page I keep getting syntax errors. Thanks, Marie <textarea name="description" id="description" rows="5" cols="40" value="sdf" onkeyup="getCharCount(50)" /> </textarea> <div id="charCount"></div> <script type="text/javascript"> function getCharCount(limit) { var tArea = document.getElementById("description"), countDisplay = document.getElementById("charCount"); countRemains = limit - tArea.value.length countDisplay.innerHTML = "Total characters : " + tArea.value.length + " Remaining: " + countRemains; if (countRemains < 1) alert('Thats all folks'); } </script>
  6. I've been using a script to check submissions for proper email formatting. It looks like this: eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) Note, that I didn't write this script, it was provided by someone else. It's worked fine for years, but now I'm getting an error message saying the function has been deprecated. I think my host must have installed a new version of PHP, 5.3.2. That's cool, I just need to figure out what to replace this code with. I've done a little research and it seems there are several ways to approach this, including: 1. just replace "eregi" with "preg_match." 2. use "filter_var" and "FILTER_VALIDATE_EMAIL" instead. Any advice as to what would be the best way to update this script would be greatly appreciated. Thanks!
  7. Hello, I have been wrestling with textareas in one way or another for quite some time. I would like to add a text area within the Edit User form however, when I update the information from the data base does not appear in the text area. The information does appear in the other fields. This is the last piece of code that I tested: <p><strong>Description:</strong></p> <textarea name="description" rows="5" cols="40" value="' . $row[7] . '" /> </textarea></p> Thanks Marie
  8. Hey, everyone. Currently working on a project that requires a lot of Javascript. This includes Ajax requests, some event listeners, Google maps integration, a Wysiwyg-editor and probable some more. I'm currently working with JQuery as I'm not much of a Javascript developer. I will group the code by usage, show an example and tell you if I experience weird behavior. 1. Drop-down search functionality (SOLVED) 2. Multiple file uploads as attachments Intro: The system is based around offers. These offers should allow attachments and possibly a main image. (Think like Wordpress' main article image) Problems/questions/etc: 1) I want the uploading to be done with Ajax. I found a good script that handles this. The problem is that the attachments must be tied to the ID of an offer. This ID, however, does not exists before an offer is published or saved as a draft. How can I tie these two together? 2) As users must be logged in, I create a folder for the user if one does not already exists. This folder is named by the User-ID. This is done because I remember reading about a problem occuring when too many files are lookated in the same folder. Is this neccasary or good, or would you recommend something else? Table structures and data flow: (Only the key structure) Offers ( offer_id, status, user_id* ..... ) Offers_attachments ( offer_id, path, extention.... ) Users ( user_id, ...info... ) Upload script used: (Not that it really matters) valums file-uploader Help me pick a solution: 1.) A two-step process. The users fill out vital information first, click next, (and the article is saved) then add attachments and save with a status. 2.) An empty offer is inserted to the DB when a user clicks "Add new offer". We now have an offer ID to tie attachments to. A daily cron job deletes offers/attachments that were never "Saved" by clicking "Save the offer" by the user. 3.) Attachments are tied to the user instead. The users can then add uploaded attachments found in the database related to their user.
  9. hello, I made the second draft of the book, but I was a little mistake to be solved. I have a problem with the postal code, after completing the contact form on the site, the database I get a bad zip code, when I type in a ZIP code sample form 21-150 (in Poland we have a code of 5 digits) in the database shows me 00000. I'm Polish and I had to change the code included with the book. What can be wrong? please help. checkout.php: if (preg_match ('/^(^\d{2}-\d{3})$/', $_POST['zip'])) { $z = $_POST['zip']; } else { $shipping_errors['zip'] = 'Podaj kod pocztowy!'; } billing.php if (preg_match ('/^(^\d{2}-\d{3})$/', $_POST['cc_zip'])) { $cc_zip = $_POST['cc_zip']; } else { $billing_errors['cc_zip'] = 'Wpisz kod pocztowy!'; } TABLE `customers` in Mysql `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `email` varchar(80) NOT NULL, `first_name` varchar(20) NOT NULL, `last_name` varchar(40) NOT NULL, `address1` varchar(80) NOT NULL, `address2` varchar(80) DEFAULT NULL, `city` varchar(60) NOT NULL, `state` char(2) NOT NULL, `zip` mediumint(5) unsigned zerofill NOT NULL, `phone` int(10) NOT NULL, `date_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `email` (`email`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
  10. Here's what I'm trying do. Let's say my database has 30 entries in it. I want to display the first 15 in one section of my page and the remaining 15 in a different section. So, I figured I would use mysql_affected_rows() to see how many entries were being returned. This works fine, but now I'm stuck on how exactly to write an if/while loop that loops through and prints out only the first half or the second half. Or should I be going about it completely differently and simply writing a query that only returns the first or second half? Any advice or direction would be greatly appreciated! Thanks.
  11. I have recently created a menu using php that gives several options for searching a database using mysql:- 1. display all records 2. display a particular record 3. display records beginning with a letter this works correctly but if I select another option the first results still appear on my display and i cannot remember how to clear the display between searches. Any advice please kind regards Tony
  12. hey guys just need a little help. All i want is to pass a multidimensional array values to a hidden form. And access the hidden form in my next page. How can i do that?
  13. Hello, Admittedly, I am new to php but not writing html code or css. I am a high school Mathematics teacher but was a techie/codemonkey in a previous job-life. I have a class website that I provide for my students and it has become too difficult to maintain in static html. So, I bought your book to make the switch to dynamic websites using Php and MySql. I followed along, stripped the headers and footers first, put everything else in a .php file and called the header and footer with includes. Worked beautifully after I beat the CSS into submission. Here is my problem: Every page in my website renders correctly using php with the included files, css3 and html5 in IE9, Firefox 4 and above, Safari and Chrome. The orginal html page renders correctly in IE7, IE8, and IE9 and the others. Original html page in IE9 on left, IE7 on right A real PHP page from my website in IE9 on left, the same PHP page in IE7 on right Any help you can give me will be most appreciated. I have several of your books and I have been reading here for a little while but I can't find a solution to my issue. Please feel free to visit the site and recreate what I have posted. http://www.zachsmath.com (BTW, the home page script works perfectly in all of the browsers using the same css files.) I am beyond frustrated. Thanks in advance for any tips or clues you can provide on how I can fix this. ZachsMath
  14. Hello, Is it possible to have two form submissions on one page? I would lke my user to be able to delete or edit their record on the same page. So far my code almost works however, I am now wondering if I am trying to do something that can't be done. The user accesses their record from a list on another page. Then the information is passed through an id in a URL to a page where the record is displayed in full. Thanks, Marie
  15. Greetings everybody. I have written a code for my friend web for getting the weight; sp.gravity and wall thickness for the given Pipe diameter. All is working fine, but is there any better way to shorten the code? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Pipe weight finder</title> <script language="JavaScript">function Cal(Atext, Btext, Ctext,form){ var A = parseFloat(Atext); var B = parseFloat(Btext); var C = parseFloat(Ctext); // here, the values for A= pipe dia; B= Pressure class; c=stiffness; //the chart vlaues for K = weight/rmt; L= Specfic Gravity; M= wall thickness in mm; N= hydro test pressure in Mpa. // the switch case statement goes in matrix manner // for ine valve of A = three valves of B; and nine valves of C switch (true){ case (A == 100 && B == 3 && C == 128): K =21.4; L =100; M =1.89; N=3; break ; case (A == 100 && B == 3 && C == 256): K =21.9; L=100; M=1.92; N=3.5; break ; case (A == 100 && B == 3 && C == 512): K =22.5; L=100; M=1.95; N=3.9; break ; case (A == 100 && B == 6 && C == 128): K =31.5; L=100; M=2.02; N=4.1; break ; case (A == 100 && B == 6 && C == 256): K =32.3; L=100; M=2.16; N=4.2; break ; case (A == 100 && B == 6 && C == 512): K =32.9; L=100; M=2.69; N=4.35;break ; case (A == 100 && B == 9 && C == 128): K =42.8; L=100; M=3.15; N=4.8; break ; case (A == 100 && B == 9 && C == 256): K =43.6; L=100; M=3.45; N=4.9; break ; case (A == 100 && B == 9 && C == 512): K =44.5; L=100; M=3.78; N=5.1; break ; case (A == 150 && B == 3 && C == 128): K =65.5; L=100; M=4.86; N=6.2; break ; case (A == 150 && B == 3 && C == 256): K =68.4; L=100; M=4.95; N=6.3; break ; case (A == 150 && B == 3 && C == 512): K =69.2; L=100; M=5.01; N=6.4; break ; // ... the code goes accordingly. // the code goes up to 1000 mm (i.e A=1000; B=9; C=512) } form.Ans1.value = K + " Kg/Rmt"; form.Ans2.value = Math.round((K*100/3.28)/100) + " Kg/Ft" ; form.Ans3.value = L; form.Ans4.value = M + " mm"; form.Ans5.value = N + " Mpa"; } </script> </head> <body> <div style="text-align=center; background-color: #C0C0C0; width:225px; height:450px; border:2px double blue;"> <P><FONT SIZE="+2">Pipe weight finder</FONT><hr color="#0099FF"> </P> <form name="ratefinder" method="post"> <P>Enter Pipe dia: <select name="input_A" > <option value="100">100 mm <option value="150">150 mm <option value="200">200 mm <option value="250">250 mm <!--the option value goes up to 1000 mm --> </select></p> <P>Enter Pressure: <select name="input_B" > <option value="3"> 3 Kg <option value="6"> 6 Kg <option value="9"> 9 Kg </select></p> <P>Enter Stiffness: <select name="input_C" > <option value="128"> 128 <option value="256"> 256 <option value="512"> 512 </select></p> <P><input type="button" VALUE="SUBMIT" onClick="Cal(this.form.input_A.value, this.form.input_B.value, this.form.input_C.value, this.form)"> <input type="Reset" name="reset" value ="RESET" onClick ="(this.form);" /></P> <hr color="#0099FF"> <P>Weight: <input type=text name="Ans1" SIZE=10></P> <P>Weight /Feet: <input type=text name="Ans2" SIZE=10></P> <P>Sp.Gravity: <input type=text name="Ans3" SIZE=10></P> <P>Wall Thickness: <input type=text name="Ans4" SIZE=10></P> <P>Hydro testing: <input type=text name="Ans5" SIZE=10></P> </form> </div> </body> </html> Even though the code works fine but: Due to long JavaScript line, the page getting slower. As the JS code is Matrix manner & the value are more than 15 x 3 x3 = 135 switch cases; Kindly suggest is there any better way though PHP? Thanking you.
  16. I have file "phone.csv" for Phone number details and want to get the required phone though forms. Please help me. "phone.csv" contains four columns without header name: like - "James", "Cat", "26", " 99556745" . The list contains around 60 rows. <html><head></head><body> <?php $file = fopen("phone.csv","r"); while(! feof($file)) { print_r(fgetcsv($file)); } fclose($file); ?> <form action="check.php" method="post"> <p>Enter Name: <br> <input type="text" name="username" size="10" /> <input type="submit" name="submit" value="Enter" /></p> NAME: $col1 <br> NICK NMAE: $col2 <br> AGE: $col3 <br> PHONE: $col4 </form></body></html> I am unable to write the php code for the "check.php" and link to the form. Kindly help me out.
  17. Hello I have been working my way through your book and for some reason have come across a problem I can not fix in Chapter 11. This is a problem I encounter even if I use the code that you included, as a download, for both pages. My login.php comes up as expected, but when one types in the user name and password and then hits submit, nothing happens other than refreshing the page. Even if you do not type anything in, there are no errors. I tried making a second login page "login1.php" and a second loggedin page "loggedin1.php" and tried to run those as well and it keeps redirecting it back to the original login.php page. My php.ini file had the outbuffering turned off, and I just turned it on while trying to figure out what the problem is. The code seems fine. Please help me figure this out, I feel I can't continue forward until I get this. I am also sure the answer is something simple that I am overlooking, hehe. Thank you!
  18. hi.. everyone.. This is a sql query problem that I have uncounted and have been in the same script for hours. But Still I couldn't get it to work. I need to get a image from database and its type should be one of a value from my $designation array. The query should check $designation array's value with database and if its match with one of a value in database then query can retrieve one row. This is my designation array. its value I use for image type in my db. $designation = array ( 'Managing Director', 'Manager', 'Director', 'The Principal', 'Deputy Principal', 'Proprietor', 'Assistant Manager', 'Head Master'); My problem is how can I check these value exit in my table and how can I make a query for this. In query where condition is confusing to me... any comments are greatly appreciated. Thank you..
  19. So I am pretty comfy with PHP and MySQL, but am still learning so I seem to be stuck. I am working on the "Coffee" site and my hosting service doesn't allow EXECUTE for procedures, so I need to convert the procedures into PHP code but just can't seem to get it right. If there is someone who can help I would be ever so greatful. Just for example if I need to convert this code: DELIMITER $$ CREATE PROCEDURE get_order_contents (oid INT) BEGIN SELECT oc.quantity, oc.price_per, (oc.quantity*oc.price_per) AS subtotal, ncc.category, ncp.name, o.total, o.shipping FROM order_contents AS oc INNER JOIN non_coffee_products AS ncp ON oc.product_id=ncp.id INNER JOIN non_coffee_categories AS ncc ON ncc.id=ncp.non_coffee_category_id INNER JOIN orders AS o ON oc.order_id=o.id WHERE oc.product_type="other" AND oc.order_id=oid UNION SELECT oc.quantity, oc.price_per, (oc.quantity*oc.price_per), gc.category, CONCAT_WS(" - ", s.size, sc.caf_decaf, sc.ground_whole), o.total, o.shipping FROM order_contents AS oc INNER JOIN specific_coffees AS sc ON oc.product_id=sc.id INNER JOIN sizes AS s ON s.id=sc.size_id INNER JOIN general_coffees AS gc ON gc.id=sc.general_coffee_id INNER JOIN orders AS o ON oc.order_id=o.id WHERE oc.product_type="coffee" AND oc.order_id=oid; END$$ DELIMITER ; into PHP script, what would be the easiest way of doing so? I would appreciate any feedback I could get. Thank you in advance! Johnny
  20. hello... everyone.. I have some small problem. It is when Im fetch data from my database and print those in different location. I have a database to store images and it contain many type of images. Eg. gallery image, comments image, ad image and so on. So now I need to get only images which type is 'ad'. Note: A single user can store only 2 images as ad images. That mean there are two ad images to a particular user. It ok for me. I did it like this. $q = "SELECT image_name FROM images WHERE image_type = 'ad' AND user = $id"; $r = mysqli_query( $dbc, $q ); while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC)) { $imageName = $row['image_name']; $imageName; // two images contain in this variable. } My problem is, can anybody say, is there a way to print those 2 images in different location (in different two DIV ) and out of while loop. Eg: <div class="add1"> image1 </div> <div class="add2"> image2 </div> any comments are highly appreciated. thank you.
  21. I had to rewrite the stored procedures since my hosting doesn't allow EXECUTE capabilities. I do all of my coding in Dreamweaver because I find the color coding is easier to find errors. I am not an expert in PHP by any means, but I can usually get my way around. So in copying the scripts Larry provided in his Rewriting Stored Procedures blog I get a couple errors (highlighted in red): if ($type == 'coffee') { $r = mysqli_query($dbc, 'SELECT gc.description, gc.image, CONCAT("C", sc.id) AS sku, CONCAT_WS(" - ", s.size, sc.caf_decaf, sc.ground_whole, sc.price) AS name, sc.stock, sc.price, sales.price AS sale_price FROM specific_coffees AS sc INNER JOIN sizes AS s ON s.id=sc.size_id INNER JOIN general_coffees AS gc ON gc.id=sc.general_coffee_id LEFT OUTER JOIN sales ON (sales.product_id=sc.id AND sales.product_type='coffee' AND ((NOW() BETWEEN sales.start_date AND sales.end_date) OR (NOW() > sales.start_date AND sales.end_date IS NULL)) ) WHERE general_coffee_id=' . $sp_cat . ' AND stock>0 ORDER by name'); } elseif ($type == 'goodies') { $r = mysqli_query($dbc, 'SELECT ncc.description AS g_description, ncc.image AS g_image, CONCAT("O", ncp.id) AS sku, ncp.name, ncp.description, ncp.image, ncp.price, ncp.stock, sales.price AS sale_price FROM non_coffee_products AS ncp INNER JOIN non_coffee_categories AS ncc ON ncc.id=ncp.non_coffee_category_id LEFT OUTER JOIN sales ON (sales.product_id=ncp.id AND sales.product_type='other' AND ((NOW() BETWEEN sales.start_date AND sales.end_date) OR (NOW() > sales.start_date AND sales.end_date IS NULL)) ) WHERE non_coffee_category_id=' . $sp_cat . ' ORDER by date_created DESC'); } Am I correct in saying that coffee and goodies should be double quotation marks: "coffee" "goodies"?
  22. Hello... I am some confuse with this matter. I want to print a order list with a title in php. those come from my database. Title is my category name and order list should be my subjects. I used 'institute_category_subject' table and i contain all institutes, categories and their subjects. something like this... I now need to create my list with these values. It is something like this.. +--------+--------------+-------------+------------+ | ics_id | institute_id | category_id | subject_id | +--------+--------------+-------------+------------+ | 1 | 1 | 1 | 2 | | 2 | 1 | 1 | 4 | | 3 | 1 | 2 | 2 | | 4 | 1 | 2 | 3 | | 5 | 1 | 3 | 1 | | 6 | 1 | 3 | 4 | +--------+--------------+-------------+------------+ category_name1 sub1 sub2 sub3 category_name2 sub1 sub2 sub3 and so on.... My problem is category id with same value going on many rows in the table and when i retrieve that id and when try to print, same category name printing repeatedly. I need to print my category name at only one time as my title and then need to print their subjects as a order list. any comments are highly appreciated. thank you..
  23. Hello...everyone... In my registration form I need to add some check boxes to select more than 1 option about teachers' class option. Larry's Effortless E-Commerce with PHP and MySQL book teach us how to use form input function for text, password and taxtarea inputs. So I modified the function for my check boxes. there I need to display a error message in my registration form when a user not select at least one option from the teacher option check boxes in my register page. further I need to display my error message above the check boxes as Larry did to textarea. I tried like this in my form function... but I can't get my error message... can anybody tell me where I have gone wrong???? this code is my form function. } elseif ($type == 'checkbox') { if ( $name == 'option[]' ) { // Display the error first: if (array_key_exists($name, $errors)) echo ' <span class="error">' . $errors[$name] . '</span>'; // Start creating the textarea: echo '<input type="' . $type . '" name="' . $name . '" value="1" class="checkbox" /> Individual<br />'; echo '<input type="' . $type . '" name="' . $name . '" value="2" class="checkbox" /> Small Groups <small>( Below 10 )</small><br />'; echo '<input type="' . $type . '" name="' . $name . '" value="3" class="checkbox" /> Medium Groups <small>( Between 10 to 20 )</small><br />'; echo '<input type="' . $type . '" name="' . $name . '" value="4" class="checkbox" /> Big Groups <small>( Over 20 )</small><br />'; echo '<input type="' . $type . '" name="' . $name . '" value="5" class="checkbox" /> Online Tuition<br />'; } if ( $name == 'medium[]' ) { // Display the error first: if (array_key_exists($name, $errors)) echo ' <span class="error">' . $errors[$name] . '</span>'; // Start creating the textarea: echo '<input type="' . $type . '" name="' . $name . '" value="1" class="checkbox" /> Hindi<br />'; echo '<input type="' . $type . '" name="' . $name . '" value="2" class="checkbox" /> English<br />'; echo '<input type="' . $type . '" name="' . $name . '" value="3" class="checkbox" /> Tamil<br />'; } }// End of primary IF-ELSE. These are my register.php page // Check for Institute Options: if(empty( $_POST['option'])) { $reg_errors['option'] = 'Please select at least one tuition option'; } else { $option = $_POST['option']; } // Check for Institute medium: if(empty( $_POST['medium'])) { $reg_errors['medium'] = 'Please select at least one tuition medium'; } else { $medium = $_POST['medium']; } This is My HTML part in register page <div> <label for="option">Tutoring Option <img src="../images/required_star.png" alt="required" /> : </label> <div class="checkbox1"> <?php create_form_input('option[]', 'checkbox', $reg_errors);?> </div> </div> <div> <label for="option">Tutoring Medium <img src="../images/required_star.png" alt="required" /> : </label> <div class="checkbox1"> <?php create_form_input('medium[]', 'checkbox', $reg_errors);?> </div> </div> any helps are greatly appreciated... thank you..
  24. Hello -I'm trying to build a datepicker which only allows certain dates in my database to be selected.. Below are the codes...and the datepicker widget shows up but the "AvailableDate" (which is listed in the database as "2012-05-09") are not showing up in different color. Please can someone help to see where the error is? Thank you! [left]<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Untitled Document</title> <link href="css/jquery-ui-1.8.14.custom.css" rel="stylesheet" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script> <script type = "text/javascript"> $(function(){ $.ajax({ url: "dates2.php", data: "action=showdates&id=1", dataType: "json", success: function(calendarEvents){ $(".calendarwidget").datepicker({ // [rows, columns] if you want to display multiple calendars. numberOfMonths: [1, 1], showCurrentAtPos: 0, beforeShowDay: function (date){ for (i = 0; i < calendarEvents.length; i++) { if (date.getMonth() == calendarEvents[i][0] - 1 && date.getDate() == calendarEvents[i][1] && date.getFullYear() == calendarEvents[i][2]) { //[disable/enable, class for styling appearance, tool tip] return [false,"ui-state-active","Event Name"]; } } return [true, ""];//enable all other days } }); } }); }); </script> </head> <body> <div class="calendarwidget"><!--calender widget is loaded here--> </div> </body> </html>[/left] [left] [/left] <?php [left]//DB CONFIG $hostname_logon = '***'; //Database server LOCATION $database_logon = '****'; //Database NAME $username_logon = '***'; //Database USERNAME $password_logon = '***'; //Database PASSWORD //Table config $tablename = "venue_room_availability"; //Name of the DB table $event_id = "AvailableID"; //Primary Key field of the table //Connect to the DB $connections = mysql_connect($hostname_logon, $username_logon, $password_logon) or die ('Unabale to connect to the database'); mysql_select_db($database_logon) or die ("Error in query: $qry. " . mysql_error()); /****** Bread & Butter *************/ $action = $_REQUEST['action']; switch ($action){ case 'showdates': $qry = "SELECT * FROM ".$tablename.""; $result = mysql_query($qry) or die ("Error in query: $qry. " . mysql_error()); echo '['; while($row = mysql_fetch_assoc($result)); //$row['AvailableDate'] =rtrim($row['AvailableDate'], ","); echo $row['AvailableDate']; echo ']'; break; } ?>[/left] [left] [/left]
  25. I know I'm probably missing the obvious but where are the chapter work files? Specifically the SQL queries to insert data.
×
×
  • Create New...