Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'mysql'.

More search options

  • 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



Found 87 results

  1. I have been working on a website where users from all around the world would post their suggestions, upload photos and create events for hangouts and so on. Its just like a social network. I need to how to store the Data and time of all the users in the correct format so that it would be the best choice for the future of the website. For example if a user in US creates an event then a person in india seeing it must be seeing it correctly in his time format. If he chooses to fly to US and login's in US then the time for the user in that specific timezone must match. The thing is any where the user may be, any time or date related activity in the website must store the time which can be common to all. I am aware of the two things, UTC and GMT where both are similary but with the DST. I dono which one to use wether to use GMT or UTC. Should i calculate time by adding or subtracting the offset, or coverting the timezone stored to the timezone of the user. I also need to know how to get the timezone or the offset of the user for a specific region. Thanks.
  2. how can i add login and registration to the forum example in chptr 15? Why doesnt it tell u exactly how to do to implement the login functionality?
  3. In this example why does the procedural way fail with this error: Error: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, object given in /Users/joel/Sites/people_test/public_html/index.php on line 14 PHP: $dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' . mysqli_connect_error() ); $q = "SELECT first_name, last_name FROM person LIMIT 0,30"; $r = mysqli_query($dbc, $q); Procedural: while($data = mysql_fetch_assoc($r)) { $rows[] = $data; } //prints out null echo json_encode($rows); OOP: while($data = $r->fetch_assoc()) { $rows[] = $data; } echo json_encode($rows); I thought I was doing the procedural way right from reading the PHP.net fetch_assoc() procedural and oop examples. Obviously I'm missing something. Could use some help seeing what it is.
  4. Hi guys, i read about PDO in the book, then i read some PDO articles.. Most of the articles say that we should turn off PDO::ATTR_EMULATE_PREPARES if using MYSQL latest driver.. is this true? i searched some explanation why with recent mysql i should turn of PDO::ATTR_EMULATE_PREPARES, but unfortunately my newbie brain doesn't understand their explanation... all i know is PDO will send the query to the MYSQL when we use : $stmt = $pdo->prepare('query'); then PDO will send the data(placeholder's value) : $stmt->bindValue(':val', $value, PDO::PARAM_STR); $stmt->execute(); my mysql version : 5.x php version : 5.4 please guide me here , if possible with example codes
  5. Can anyone help me get the sample data and SQL commands into Workbench? The book says "You can download the complete SQL commands, along with some sample data, from the account page on the book’s Web site." (Page 64) Are these files for use in MySQL Workbench? If so, how can I get the commands and sample data into Workbench? I have already opened the yii_cms.mwb fil in Workbench, and I can see the visual of the table relationships. But I don't know how to import the data and SQL commands. This is not obvious to me, since Workbench is new for me. I have already downloaded and unzipped these files: SQL commands MySQL WorkBench file for the CMS site Edited Code for the CMS Example I am using version 0.5 of Larry Ullman's Yii book. I'm on Win XP, with XAMPP and Workbench running. Any help would be much appreciated. Thanks in advance!
  6. Hi, I hope someone can help me, i am going crazy. I am trying to populate the time zone tables, but everytime i try i get the same error message: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near './mysql_tzinfo_to_sql /usr/share/zoneinfo | /Applications/MAMP/Library/bin/mysql' at line 1 Now, i had read the MySQL manual several times, and tried: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql; somebody suggested using this variation since i am using MAMP: ./mysql_tzinfo_to_sql /usr/share/zoneinfo | /Applications/MAMP/Library/bin/mysql -p -u root mysql; or this one: ./mysql_tzinfo_to_sql /usr/share/zoneinfo | ./mysql -p -u root mysql i get the same ERROR 1064 message. I had check the path to the folders and i am sure is correct, AM I MISSING SOMETHING? Thanks in advance for any help MySQL version 5.5.9 Mac 10.5.8
  7. hi Interesting book especially the stored procedures. I'd be interested to hear from anyone who is interested in extending or generalising the database; thus creating more variables to search upon. After all, not all of us want to sell coffee do we? I'm especially interested in filters or searching by specific categories see: http://acookson.org/wp-content/uploads/2013/01/shop-screenshot.png for an example of what's on my mind. In my fictitional jeans shop example, I was playing around with MySQL workbench to come up with some possibilities for an ER diagram: http://acookson.org/wp-content/uploads/2013/01/ecommerce3.png It's totally at prototype stage and was looking for some inspiration really; maybe an on-going discussion around this topic. best wishes Andrew
  8. So I am looking at developing a jobsboard, which has three tables: Company - Store details of companies looking to advertise jobs, build profile. Jobs - Store details of Jobs being advertised for a certain period of time. Orders - Store details of the transactions for the jobs being posted. The way it works is the company completes registration form, then has the option of posting jobs which they will be charged a fix fee. Now what foreign key would I store in the Orders table? since I am using Paypal and don't know how much information you can carry over. Would I store the CompanyID or the JobsID or both? PHP5 MySQL 5 Chrome
  9. I have a couple of questions regarding stored functions. 1. Where are they stored? (Can I see a stored function using phpMyAdmin or mysql client? If yes, how?) 2. Will the stored functions be available for as long as database exists, or only for the duration of the current database connection? (To rephrase it, should a custom function be stored just once, or it should be recreated every time the script runs?) Thank you for help, as always!
  10. Hello Forum! Asking yet another one of my typical questions. Do I understand it correctly that the underlying notion of the "normal form" databases is to eliminate repetition from every database, so as a result there's a bigger number of smaller databases? I'm asking this question because in Chapter 3 of the 3rd edition of this book Larry is using a database that contains repeated values in the same column: I also often find myself using databases like that, which seems to work perfectly fine. Am I missing something, as always? Do I understand the idea of the "normal form" database incorrectly, or should there be (if we deal with the example above) a separate databases for all UNIQUE, STANDARD and PO BOX zip code types, and a separate databases for HOTSVILLE, AGUADILLA, ARECIBO and so on? Would appreciate your input!
  11. Hiya - I'm having difficulty connecting to the database with the mysql.inc.php. Here's the error message: <-- error message ========== An error occurred in script '/hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut/index.php' on line 9: require(/home/users/web/b1384/moo.laissezfairelondonco/wolfcut/wolfcut/includes/mysql.inc.php) [function.require]: failed to open stream: No such file or directory ========= --> Really basic, I know, but I'm trying to follow an example in another book and the above error keep happening. As far as I can gather, the 'user, password, host, db name' are all correct. Assistance much appreciated
  12. Hi, Having a bit of a problem with regard to someone logging in on my site. It will not display Register page if I include certain files. Here is my header.php file which stores all the navigation links, and the sign-in option or to display their profile options: <body> <section class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand text-info" href="http://www.webzoost.com" name="top">abaloo</a> <div class="nav-collapse collapse"> <ul class="nav pull-right"> <li><a href="http://www.webzoost.com/profiles/register.php">register</a></li> <li class="divider-vertical"></li> <li><a href="#">search</a></li> <li class="divider-vertical"></li> <li class="dropdown"> <?php if (isset($_SESSION['user_id'])) { echo '<a class="dropdown-toggle" href="#" data-toggle="dropdown">Your Profile <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; } else { echo '<a class="dropdown-toggle" href="#" data-toggle="dropdown">sign in <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; require ('includes/login_form.inc.php'); } ?> </div> </li> </ul> </div> </div> </div> </section> Now the problem comes when i add the following files: - login.inc.php since when i put this file in my index.php file I cannot seem to link to any other part of the website such as "register" which then throws up a blank page, but if I take out the file all-together then register displays. So what I am saying is where do I put file (login.inc.php) with-out it interfering with other links on my website, also could it be a directory issue, I know larry has his navigation in the footer, but mine is in the header.php file. here is my directory setup: index profiles - register.php includes - login.inc.php - login_form.inc.php - header.php // This is where all my navigation is, and also the login form as well. - footer.php I am now getting the following error when I only view the source code, this error is not being displayed for some reason on output to the user(I can't find an option to paste a screenshot/image of the code): An error occurred in script '/home/sites/webzoost.com/public_html/includes/header.php' on line 52:<br /> require(includes/login_form.inc.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory<br /> <pre>Array<br /> Any comments, suggestions would be much appreciated. PHP5 MySQL5 Chrome
  13. I just wanted to say a huge thanks to Larry for writing the book "PHP and MySQL for Dynamic Web Sites" (I have the 4th edition). To give a little history - I started using PHP about 10 years ago when I was asked to create a portal for some members of a small department that wanted to share information relating to health care. I initially looked at creating a static HTML site but soon came across PHPNuke. I know this particular CMS has had better days but for me 10 years ago it was revolutionary. I managed to set up a website and installed PHPNuke (including the database on MySQL). I was hooked from that point. However, I have become lazy over the years and although I have always wanted to create my own dynamic site, I have always stuck to using CMS/Portals (such as WordPress, Drupal, Joomla etc.) and never moved on. Now, don't get me wrong - these PHP based scripts are excellent and I will continue to use them but I have always just amended code within an already written script and never actually created a site of my own (from scratch) - although I would consider myself an intermediate PHP programmer (I use C# and .Net at work). Even after reading numerous books on the subject I still felt as though I was missing the glue that held everything together. I understood everything about XHTML, CSS, PHP, MYSQL, SESSIONS, COOKIES etc but could never join all the dots to make something work - so I was stuck in a sort of "head knowledge" state. That is changing now - thanks to the book above. This book is excellent and I am finally joining the dots and have a new found excitement for the language again. Thanks Larry - I don't know what makes your book so different and usable - but it is - and it's working. I have already purchased the Advanced book on the subject for the next stage of my journey. I look forward to updating you all on my progress. Thanks again :-)
  14. Can someone - (Larry?) - please explain in lay terms the esoteric Paragraph 1 from Chapter 7, sub-chapter "Outer Joins": "Whereas an inner join returns records based upon making matches between two tables, an outer join will return records that are matched by both tables, and will return records that don’t match. In other words, an inner join is exclusive but an outer join is inclusive." It's the second time I'm trying to go through this chapter, and the second time I stumble at that paragraph! Would be grateful for help from knowledgeable person!
  15. Hi ,this book are really good , simple and easy to understand , don't have any problem on understanding your words so far. I have apply to two of my project . This is not really a problem , just not sure where to start off . I was trying to improve the login system , because when the user forget to click the logout button , the session doesn't logout automatically.What i trying to do is make a session expire after 15 minutes of inactivity ? Any ideas ? [sOLVED] used this solution apply to include/config.inc.php just after the session_start() Hope this can helps $live = false; // Errors are emailed here: $contact_email = 'abc@gmail.com'; define ('BASE_URI','.'); define ('BASE_URL','www.domain.com/'); define ('MYSQL', BASE_URI . '/include/mysql.inc.php'); // Start the session: session_start(); $timeout = 15; // Set timeout minutes $logout_redirect_url = "index.php"; // Set logout URL $timeout = $timeout * 60; // Converts minutes to seconds if (isset($_SESSION['start_time'])) { $elapsed_time = time() - $_SESSION['start_time']; if ($elapsed_time >= $timeout) { $_SESSION = array(); // Destroy the variables. session_destroy(); setcookie (session_name(), '', time()-86400, '/'); // Destroy the cookie. header("Location: $logout_redirect_url"); } } $_SESSION['start_time'] = time();
  16. 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 ;
  17. Can someone echo out their $q variable from Chapter 17 Script 17.4 and show me the output? My query is failing as the result of $r is FALSE so I'm getting a Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result when I test forum.php When I echo out the $q variable ( I used echo '<p>The query $q is ' . $q . '</p><br /><br />'; on line 21) I get these results in web browser: The query $q is SELECT t.thread_id, t.subject, username, COUNT(post_id) - 1 AS responses, MAX(DATE_FORMAT(CONVERT_TZ(p.posted_on, 'UTC', 'America/New_York'), '%e-%b-%y %l:%i %p')) AS last, MIN(DATE_FORMAT(CONVERT_TZ(p.posted_on, 'UTC', 'America/New_York'),'%e-%b-%y %l:%i %p')) AS first FROM threads AS t INNER JOIN posts AS p USING (thread_id) INNER JOIN users AS u ON t.user_id = u.user_id WHERE t.lang_id = GROUP BY (p.thread_id) ORDER BY last DESC I'm wondering why {$SESSION['lid']} is missing from the output. Here is my line 19 code (matches the book): $q = "SELECT t.thread_id, t.subject, username, COUNT(post_id) - 1 AS responses, MAX(DATE_FORMAT($last, '%e-%b-%y %l:%i %p')) AS last, MIN(DATE_FORMAT($first, '%e-%b-%y %l:%i %p')) AS first FROM threads AS t INNER JOIN posts AS p USING (thread_id) INNER JOIN users AS u ON t.user_id = u.user_id WHERE t.lang_id = {$SESSION['lid']} GROUP BY (p.thread_id) ORDER BY last DESC";
  18. 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.
  19. 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
  20. I'm just trying to use an alias in a select query and I'm having a problem. It's not a big deal, but I don't know why I'm getting an error. Can anyone answer this: Why does SELECT title, text, id FROM memos LEFT JOIN memos_associations USING (id) WHERE CONCAT_WS(' ',title,text) REGEXP '[[:<:]]potassium[[:>:]]' = 1 work ok, but SELECT title, text, id, CONCAT_WS(' ',title,text) AS combo FROM memos LEFT JOIN memos_associations USING (id) WHERE combo REGEXP '[[:<:]]potassium[[:>:]]' = 1 not? The latter generates the error, "ERROR 1054 (42S22): Unknown column 'combo' in 'where clause'." Thanks! ...Jason
  21. On line 33 it reads: $words = FALSE; // Flag variable - Why is this needed? Why false boolean? On line 37 it reads: $r = msyqli_query($dbc, $q); if (mysqli_num_rows($r) == 1) { $words = mysqli_fetch_array($r, MYSQLI_ASSOC); } - Is this common practice, to check to see if there is at least one result returned from the query? In some scripts, this is included and then in some it is. For example go to line 47 of the same script, when the array is fetched the function isn't wrapped in the same way as above. Line 46, 47: $r = msyqli_query($dbc, $q); $r = mysqli_fetch_array($r, MYSQLI_ASSOC);
  22. This is my php code like the admin code in ecommerce chapter of book PHP 6 and mysql. <!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>Add a dress</title> </head> <body> <?php ini_set ('display_errors', 1); require_once('../../mysqli_connect.php'); if (isset($_POST['submitted'])) { $errors=array(); if(!empty($_POST['dress_name'])) { $dn =trim($_POST['dress_name']); } else { $errors[]='please enter the dress name!'; } // Check for an image: if (is_uploaded_file ($_FILES['image']['tmp_name'])) { // Create a temporary file name: $temp = '../../uploads/' . md5($_FILES['image']['name']); // Move the file over: if (move_uploaded_file($_FILES['image']['tmp_name'], $temp)) { echo '<p>The file has been uploaded!</p>'; // Set the $i variable to the image name: $i = $_FILES['image']['name']; } else { // Couldn't move the file over. $errors[] = 'The file could not be moved.'; $temp = $_FILES['image']['tmp_name']; } } else { // No uploaded file. $errors[] = 'No file was uploaded.'; $temp = NULL; } // Check for a color : $c=(!empty($_POST['color'])) ? trim($_POST['color']):NULL ; // Check for origional price: if (is_numeric($_POST['origional_price'])) { $op = (float) $_POST['origional_price']; } else { $errors[] = 'Please enter the dress price!'; } // Check for our price: if (is_numeric($_POST['our_price'])) { $rp = (float) $_POST['our_price']; } else { $errors[] = 'Please enter the dress price!'; } // Check for a description (not required): $d = (!empty($_POST['description'])) ? trim($_POST['description']): NULL; // Validate the designer... if (isset($_POST['designer']) && ($_POST['designer'] == 'new') ) { // If it's a new designer, add the designer to the database... // Validate the first and middle names : if (!empty($_POST['first_name'])) { $fn = trim($_POST['first_name']); $mn = (!empty($_POST['middle_name'])) ? trim($_POST['middle_name']) : NULL; // Check for a last_name... if (!empty($_POST['last_name'])) $ln = trim($_POST['last_name']); // Add the designer to the database: $q = 'INSERT INTO designers (first_name, middle_name, last_name) VALUES (?, ?, ?)'; $stmt = mysqli_prepare($dbc, $q); mysqli_stmt_bind_param($stmt, 'sss', $fn, $mn, $ln); mysqli_stmt_execute($stmt); // Check the results.... if (mysqli_stmt_affected_rows($stmt) == 1) { echo '<p>The designer has been added.</p>'; $designer = mysqli_stmt_insert_id($stmt); // Get the designer ID. } else { $errors[] = 'The new designer could not be added to the database!'; } // Close this prepared statement: mysqli_stmt_close($stmt); } else { // No last name value. $errors[] = 'Please enter the designer name!'; } } elseif ( isset($_POST['designer']) && ($_POST['designer'] == 'existing') && ($_POST['existing'] > 0) ) { // Existing designer. $designer = (int) $_POST['existing']; } else { // No designer selected. $errors[] = 'Please enter or select the dress designer'; } if (empty($errors)) { // If everything's OK. // Add the dress to the database: $q = "INSERT INTO dresses (designer, dress_name, origional_price, our_price, color, description, image_name) VALUES (?, ?, ?, ?, ?, ?,?)"; $stmt = mysqli_prepare($dbc, $q); mysqli_stmt_bind_param( $stmt, 'isdsss', $designer, $dn, $op, $rp, $c, $d,$i); mysqli_stmt_execute($stmt); // Check the results... if (mysqli_stmt_affected_rows($stmt) == 1) { // Print a message: echo '<p>The dress has been added.</p>'; // Rename the image: $id = mysqli_stmt_insert_id($stmt); // Get the dress ID. rename ($temp, "../../uploads/$id"); // Clear $_POST: $_POST = array(); } else { // Error! echo '<p style="font-weight: bold; color: #C00">Your submission could not be processed due to a system error.</p>'; } mysqli_stmt_close($stmt); } // End of $errors IF. // Delete the uploaded file if it still exists: if ( isset($temp) && file_exists ($temp) && is_file($temp) ) { unlink ($temp); } } // End of the submission IF. // Check for any errors and print them: if ( !empty($errors) && is_array($errors) ) { echo '<h1>Error!</h1> <p style="font-weight: bold; color: #C00">The following error(s) occurred:<br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo 'Please reselect the dress image and try again.</p>'; } ?> <h1>Add a dress</h1> <form enctype="multipart/form-data" action="add_dress.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="524288" /> <fieldset><legend>Fill out the form to add a dress to the catalog: </legend> <p><b>Dress Name:</b> <input type="text" name="dress_name" size="30" maxlength="60" value="<?php if (isset($_POST['dress_name'])) echo htmlspecialchars($_POST['dress_name']); ?>" /></p> <p><b>Image:</b> <input type="file" name="image" /></p> <div><b>Designer:</b> <p><input type="radio" name="designer" value="existing" <?php if (isset($_POST['designer']) && ($_POST['designer'] == 'existing') ) echo ' checked="checked"'; ?> /> Existing => <select name="existing"> <option>Select One </option> <?php // Retrieve all the designers and add to the pull-down menu. $q = "SELECT designer_id, CONCAT_WS(' ', first_name, middle_name, last_name) FROM designers ORDER BY first_name, last_name ASC"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) > 0) { while ($row = mysqli_fetch_array ($r, MYSQLI_NUM)) { echo "<option value=\"$row[0]\""; // Check for stickyness: if (isset($_POST['existing']) && ($_POST['existing'] == $row[0]) ) echo ' selected="selected"'; echo ">$row[1] </option> \n"; } } else { echo '<option> Please add a new designer. </option>'; } mysqli_close($dbc); // Close the database connection. ?> </select> </p> <p><input type="radio" name="designer" value="new" <?php if (isset($_POST['designer']) && ($_POST['designer'] == 'new') ) echo ' checked="checked"'; ?> /> New => First Name: <input type="text" name="first_name" size="10" maxlength="20" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /> Middle Name: <input type="text" name="middle_name" size="10" maxlength="20" value="<?php if (isset($_POST['middle_name'])) echo $_POST['middle_name']; ?>" /> Last Name: <input type="text" name="last_name" size="10" maxlength="40" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name'];?>" /></p> </div> <p><b>Origional Price:</b> <input type="text" name="origional_price" size="10" maxlength="10" value="<?php if (isset($_POST['origional_price'])) echo $_POST['origional_price']; ?>" /> <small>Do not include the dollar sign , commas or Rs.</small></p> <p><b>Our Price:</b> <input type="text" name="our_price" size="10" maxlength="10" value="<?php if (isset($_POST['our_price'])) echo $_POST['our_price']; ?>" /> <small>Do not include the dollar sign, commas or Rs.</small></p> <p><b>color:</b> <input type="text" name="color" size="30" maxlength="60" value="<?php if (isset($_POST['color'])) echo htmlspecialchars($_POST['color']); ?>" /> (optional)</p> <p><b> Description: </b> <textarea name="description" cols="40" rows="5"> <?php if (isset($_POST['description'])) echo $_POST['description'] ?> </textarea> (optional) </p> </fieldset> <div align="center"><input type="submit" name="submit" value="Submit" /> </div> <input type="hidden" name="submitted" value="TRUE" /> </form> </body> </html> these are the errors: Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\admin\add_dress.php on line 140 Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\admin\add_dress.php on line 141 Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\admin\add_dress.php on line 145 Your submission could not be processed due to a system error. Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\admin\add_dress.php on line 166 please help me i ve been trying to solve it for three days but no use
  23. Mentioned in the book in especially Chapter 14: Making Universal Sites and Chapter 15: Message board example, are recommendations for processing unicode safe data. We learn that utf-8 supports a wide list of languages. There was so much information to digest, I could not recall if every action is required when building a universal/multilingual site. Are all of these set by default? Particularly the database character set. My mySQL is already set as (actually copied this straight from phpMyAdmin) utf8_unicode_ci Unicode (multilingual), case-insensitive Would I then have to establish a charset and collation for the database? Are these actions needed each time, here is a list I gathered up while reading. Added to inbetween the head tags <meta http-equiv="content-type" content="text/html; charset=utf-8"> -> Page 416-417 Must be the first line before any HTML, must be a php script page header('Content-Type: text/html; charset=UTF-8'); -> Page 452 (and more information in Chapter 14) Mysql Client CREATE DATABASE forum2 CHARACTER SET utf8; -> Page 444 mysql_connection mysqli_set_charset($dbc, 'utf8'); or mysqli_query($dbc, 'SET NAMES utf8'); -> Page 450 Any one with some insight on this great appreciated with any comments. -Mark
  24. A database design example commonly available pressumes that one wants to organize a collection of books, and depicts the usual author, title, isbn, etc., breakdown, and may even normalize to several tables. Generally not seen, however, is an example that includes the books contents, i.e., chapters, headings, footnotes, and body copy Any thoughs on why this is? Would MYSQL even be capable of managing the task? ~ David
  25. I have been seeing more and more 'mysqli' stuff around instead of 'mysql' commands. I finally searched it and came up with that it is 'improved'. I did not feel the need to know much more after reading that 'mysql' would be deprecated by the release of PHP 6, so I looked into converting to 'mysqli'. In a simple search, I found this converter tool on a wiki page by mysql.com: http://forge.mysql.com/wiki/Converting_to_MySQLi. I backed up one of my directories and tested it locally. I was given this list of results of which files it altered, how many mysql_* functions were found, etc. (what I find ironic is that I put the converter in the directory I converted, and I got only warnings for files in that directory). Anyways, when I went to see how my scripts ran on Firefox, they turned out identical. However, as I check the source, I have yet to find an actual adjustment. Did this 'converter tool' work? How should I convert to mysqli? Thank you in advance, Lingolatz
  • Create New...