Search the Community
Showing results for tags 'mysql'.
-
Hi All, Im building a Web App with 3 different types of users: Students Parents Teachers Should I store them all in one database table or separate tables? I am looking for the scalable best practice option with 4000+ minimum users. All in one table option, I would have a column with 1, 2 or 3 to specify the users type. Any help would be great, I can do both but looking for best practice really. Thanks in advance!
-
I have this stored procedure that has 2 parameters, the first one is the cartId(which is the IN) and I have the newOrderId(which is the OUT). Now, I know that the inCartId is the cart id which will come from the form or whatever means the cart is been access but I don't understand the OUT newOrderId since that is what MySQL will return. Now, in the PHP calling this Stored procedure, it will look like this. $sql = 'CALL create_order(:cart_id, "What will be here")// The cart_id is what PHP will pass to MySQL, but what will be passed to the 2nd argument since does not before hand what MySQL will return. CREATE PROCEDURE create_order( IN inCartId int, OUT newOrderId int ) BEGIN -- Insert a new record into orders and obtain the new order ID INSERT INTO orders (created_on) VALUES (NOW()); -- Obtain the new Order ID SELECT LAST_INSERT_ID() INTO newOrderId; -- Insert order details in order_detail table INSERT INTO order_detail ( order_id, product_id, attributes, product_name, quantity, unit_cost ) SELECT orderId, p.id, sc.attributes, p.name, sc.quantity, COALESCE( NULLIF( p.discounted_price, 0 ), p.price ) AS unit_cost FROM shopping_cart sc INNER JOIN products p ON sc.product_id = p.id WHERE sc.cart_id = inCartId AND sc.buy_now; -- Save the order's total amount UPDATE orders SET total_amount = ( SELECT SUM( unit_cost * quantity ) FROM order_detail WHERE order_id = orderId ) WHERE id = orderId; -- Clear the shopping cart CALL shopping_cart_empty(inCartId); END
- 1 reply
-
- stored procedure
- pdo
-
(and 2 more)
Tagged with:
-
Please I need your help, I am new to PHP and I need your help in inserting multiple select array into the database in the form of this.This is what I want to achieve. My table has 5 columns (id, examno, subjects, grades, results). I want results column to be inform of subjects grades, subjects grades.........depending on the numbers of subjects and grades users select (e.g English C6, Mathematics C6) all in one column results. This is my html codes <form action="insert.php"> <div class="form-group"> <label>Exam Number</label> <input type="text" class="form-control" name="examno" id="examno"> </div> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table table-borderless" id="example"> <tr> <td width="12%"><label class="control-label">S/NO</label></td> <td width="53%"><label class="control-label">SUBJECTS</label></td> <td width="35%"><label class="control-label">GRADE</label></td> </tr> <tr> <td>1</td> <td> <select name="subjects[]" class="form-control" id="subject"> <option value="" selected="selected">Select subject</option> <option value="English">English</option> <option value="Mathematics">Mathematics</option> </select> </td> <td> <select name="grades[]" class="form-control"> <option value=""> Select</option> <option value="A1">A1</option> <option value="B2">B2</option> </select> </td> </tr> </table> <input type="submit"> </form> I have about 8 subjects and grades to be inserted like that Also this is my insert.php if(isset($_POST['submit'])){ $examno = mysqli_real_escape_string($conn, $_POST['examno']); foreach($_POST['subjects'] as $row=>$subjects){ $subjects = mysqli_real_escape_string($conn, $subjects); $grades = mysqli_real_escape_string($conn, $_POST['grades'][$row]); $results = $subjects." ".$grades; } $sql = "INSERT INTO qualifications(examno, subjects, grades, results) VALUES('".$examno."', '".$subjects."', '".$grades."', '".$results."')"; $result = mysqli_query($conn, $sql); if($result){ header("location:declaration.php"); // user will be taken to the success page } else{ echo "Oops. Something went wrong. Please try again"; } } Nothing was inserted into the subjects, grades, and results. Please help me as I am new to php/mysqli
-
This part of the login code does not seem to be working. I know the information is in the database and the activation field says NULL. I believe that the browser - Firefox on a Mac - is accepting cookies. I have tried this with several users and they all have the same password. I am getting the error message that indicates that the Email and Password does not match those on file. I am set up to use PHP 7. // Query the database: $q = "SELECT user_id, first_name, user_level, pass FROM users WHERE email='$e' AND active IS NULL"; $r = mysqli_query($dbc, $q) or trigger_error("Query: $q\n<br>MySQL Error: " . mysqli_error($dbc)); if (@mysqli_num_rows($r) == 1) { // A match was made. // Fetch the values: list($user_id, $first_name, $user_level, $pass) = mysqli_fetch_array($r, MYSQLI_NUM); mysqli_free_result($r);
-
Chapter 7: Advanced SQL and MySQL - Fifth Edition of PHP and MySQL for Dynamic Web Sites Visual QuickPro Guide Page 229 - Table 7.3 It says I don't understand the difference between lowering importance and lowering ranking. Doesn't decreasing the importance decrease the ranking? Can someone please explain to me the difference between the 2? Thanks, Varun
-
Am trying to put mysqli result set into an array for later use and this is how I did it(but is not working) $split = []; $sql_money = "SELECT j_id, amount_invested FROM j_members WHERE j_activated = 1 LIMIT 5"; $result_money = mysqli_query($conn, $sql_money); while($data = mysqli_fetch_assoc($result_money)){ $split[] = ['id' => $data['id'], 'invest' => $data['amount_invested']]; //echo $data['j_id']; } foreach($split as $s){ echo $s['id'] . '<br>'; } Who can put me through
-
Hi all. I need some assistance with dynamically populating a mega drop-down menu across 6 columns (Bootstrap 4) with the languages retrieved from a database query (Forum project - Chapter 17). I have searched the internet without any success. Any help will be much appreciated. My code is included below. Regards // Select a language: echo '<li class="nav-item nav-item-icon hidden-md-down dropdown megamenu"> <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . $words['lang'] . ' <span><i class="fa fa-globe"></i></span></a> <div class="dropdown-menu"> <div class="mega-dropdown-menu row row-no-padding"> <div class="col-md-4 col-lg-2 ml-lg-auto"> <ul class="megadropdown-links"> <li>'; // RetrRetrieve all the languages and add to the pull-down menu: $q = "SELECT id, lang FROM languages WHERE status='Active' ORDER BY lang ASC"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) > 0) { while ($menu_row = mysqli_fetch_array($r, MYSQLI_NUM)) { echo '<a class="dropdown-item" href="?lid=' . $menu_row[0] . '">' . $menu_row[1] . '</a>'; } } mysqli_free_result($r); echo '</li> </ul> </div> </div> </div> </li>';
- 12 replies
-
I'm trying to run a query of existing employee records in order to update their information, and am receiving the error: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/schill54/public_html/Capstone/htdocs/Home/updateform.php on line 8 Below is my script. I've tweaked the query several times with no luck. Originally I had it set to SELECT * from my users table but then realized there was 1 column that I didn't want it to return and therefore I didn't account for it in my form, so then listed the desired columns individually but still getting the error. From the google searching I've done so far I realize there is probably still something wrong with my query but can't figure out what it is. <?php { include ("../includes/header.php"); require_once ('../../mysqli_connect.php'); $lname=$_GET['last_name']; $query = "SELECT first_name, last_name, phone, username, pass, admin FROM users WHERE last_name='$lname'"; $result = mysqli_query ($dbc, $query); $num = mysqli_num_rows($result); if ($num > 0) { // If it ran OK, display all the records. while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){ ?> <form action="updatemp.php" method="post"> <p>First Name: <input name="text" size=30 value="<? echo $row['first_name']; ?>"></p> <p>Last Name: <input name="text" size=30 value="<? echo $row['last_name']; ?>"></p> <p>Phone Number: <input name="text" size=30 value="<? echo $row['phone']; ?>"></p> <p>User Name: <input name="text" size=30 value="<? echo $row['username']; ?>"></p> <p>Password: <input name="text" size=30 value="<? echo $row['pass']; ?>"></p> <p>Admin Access?: <input name="text" size=30 value="<? echo $row['admin']; ?>"></p> </form> <? } //end while statement } //end if statement mysqli_close($dbc); //include the footer include ("../includes/footer.php"); } ?>
-
Why cannot I enter more than 127 items as quantity in the cart. I have tried and changed quantity in carts table from tinyint to smallint and that does not help. The maximum quantity of one item that can be selected is 127.
-
Hi Larry, I am loving the book, as I work towards converting lots of Classic ASP to PHP 7. I have in the past created hundreds of Stored Procedures in MSSQL. One thing that has bugged me in the past was that I found it hard to search for variables, etc., in the Stored Procedures when I changed something. In addition to liking the fact that they will be in my (easily searchable) code, I like the security and performance perks of using Prepared Statements as I translate these Stored Procedures... but I am wondering: Would Stored Procedures or Stored Functions be faster than Prepared Statements? Again, thank you for making such an excellent book - it's really helping me get up to the next level in my coding abilities. Thanks, Jim
-
Hello Larry and Hello Community, I bought book php and mysql for dynamic web sites in english from USA since i didn't see it in my native language. I gave a look all book for make general feeling and then i will read better and careful example and teching suggestions. Book is very very good in my opinion. My question is about what is best techinque to store html inside mysql database. I'm studying a bit how work CKeditor, but i think many html editor work more or less in same way, and it use a textarea to collect the html, so what you really need to do after a submit or similar processes is simply get the value of texarea and use php to store html in database. I'm asking how handle security, quote and double symbols or other problems. If i have understand i can use directly mysql_real_escape when i get textarea, simply before send html inside mysql or i can use prepared statement and in this case i think i can't use mysql_real_escape so i need pheraps to use htmlentities. I'm a little confuse about conflict you could have use both htmlentities, prepared statement, mysql_real_escape, etc.. I'm not exactly sure how i is best way general speaking in term of 100% secutiry and in term or not ruin html inside mysql and also i'm not sure what is procedure to make the contrary, i mean get html from mysql and serve i in page. Thanks very much. Andrea
-
Dear Larry, I started learning MySQL through your book. To get started, I followed you instruction to set a password to the root using MyPhpAdmin. After I have entered the password, I updated the config.inc.php file to include the password. However, I am no longer able to access the root ever since. The error message is 1045, Access denied for user root@local host (using password:YES). I researched the web for password reset but the techniques (MySQLD) could not resolve my problem. Could you advise what I can do. Thank you so much.
-
Hello, I want to purchase "MySQL: Visual QuickStart Guide" by Larry Ullman but can find only the Second Edition which seems to have been published in 2006. I just wanted to know if a later version is available, or is planned for publication soon. If not, could you please advise if the contents of the Second Edition are still valid for use in 2018. Thanks
-
I've followed the tutorial as closely as possible, yet continue to have problems with this particular script. I am receiving the following error message on an INSERT clause, despite all the columns lining up with my table. An error occurred in script 'C:\xampp\htdocs\register.php' on line 63: Query: INSERT INTO users (email, pass, first_name, last_name, active, registration_date) VALUES ('test@test.com', SHA1('test'), 'test', 'test', '125b7b06df899c3ab98189e3077f5f0c', NOW() ) Would anyone be able to point me to what is going wrong here? Here is the full script: <?php # Script 18.6 - register.php // This is the registration page for the site. require ('includes/config.inc.php'); $page_title = 'Register'; include ('includes/header.html'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Handle the form. // Need the database connection: require (MYSQL); // Trim all the incoming data: $trimmed = array_map('trim', $_POST); // Assume invalid values: $fn = $ln = $e = $p = FALSE; // Check for a first name: if (preg_match ('/^[A-Z \'.-]{2,20}$/i', $trimmed['first_name'])) { $fn = mysqli_real_escape_string ($dbc, $trimmed['first_name']); } else { echo '<p class="error">Please enter your first name!</p>'; } // Check for a last name: if (preg_match ('/^[A-Z \'.-]{2,40}$/i', $trimmed['last_name'])) { $ln = mysqli_real_escape_string ($dbc, $trimmed['last_name']); } else { echo '<p class="error">Please enter your last name!</p>'; } // Check for an email address: if (filter_var($trimmed['email'], FILTER_VALIDATE_EMAIL)) { $e = mysqli_real_escape_string ($dbc, $trimmed['email']); } else { echo '<p class="error">Please enter a valid email address!</p>'; } // Check for a password and match against the confirmed password: if (preg_match ('/^\w{4,20}$/', $trimmed['password1']) ) { if ($trimmed['password1'] == $trimmed['password2']) { $p = mysqli_real_escape_string ($dbc, $trimmed['password1']); } else { echo '<p class="error">Your password did not match the confirmed password!</p>'; } } else { echo '<p class="error">Please enter a valid password!</p>'; } if ($fn && $ln && $e && $p) { // If everything's OK... // Make sure the email address is available: $q = "SELECT user_id FROM users WHERE email='$e'"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); if (mysqli_num_rows($r) == 0) { // Available. // Create the activation code: $a = md5(uniqid(rand(), true)); // Add the user to the database: $q = "INSERT INTO users (email, pass, first_name, last_name, active, registration_date) VALUES ('$e', SHA1('$p'), '$fn', '$ln', '$a', NOW() )"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. // Send the email: $body = "Thank you for registering at <whatever site>. To activate your account, please click on this link:\n\n"; $body .= BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a"; mail($trimmed['email'], 'Registration Confirmation', $body, 'From: admin@sitename.com'); // Finish the page: echo '<h3>Thank you for registering! A confirmation email has been sent to your address. Please click on the link in that email in order to activate your account.</h3>'; include ('includes/footer.html'); // Include the HTML footer. exit(); // Stop the page. } else { // If it did not run OK. echo '<p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p>'; } } else { // The email address is not available. echo '<p class="error">That email address has already been registered. If you have forgotten your password, use the link at right to have your password sent to you.</p>'; } } else { // If one of the data tests failed. echo '<p class="error">Please try again.</p>'; } mysqli_close($dbc); } // End of the main Submit conditional. ?> <h1>Register</h1> <form action="register.php" method="post"> <fieldset> <p><b>First Name:</b> <input type="text" name="first_name" size="20" maxlength="20" value="<?php if (isset($trimmed['first_name'])) echo $trimmed['first_name']; ?>" /></p> <p><b>Last Name:</b> <input type="text" name="last_name" size="20" maxlength="40" value="<?php if (isset($trimmed['last_name'])) echo $trimmed['last_name']; ?>" /></p> <p><b>Email Address:</b> <input type="text" name="email" size="30" maxlength="60" value="<?php if (isset($trimmed['email'])) echo $trimmed['email']; ?>" /> </p> <p><b>Password:</b> <input type="password" name="password1" size="20" maxlength="20" value="<?php if (isset($trimmed['password1'])) echo $trimmed['password1']; ?>" /> <small>Use only letters, numbers, and the underscore. Must be between 4 and 20 characters long.</small></p> <p><b>Confirm Password:</b> <input type="password" name="password2" size="20" maxlength="20" value="<?php if (isset($trimmed['password2'])) echo $trimmed['password2']; ?>" /></p> </fieldset> <div align="center"><input type="submit" name="submit" value="Register" /></div> </form> <?php include ('includes/footer.html'); ?> Thank you very much for any help.
-
I'm having a bit of a problem which I think I might know the solution, but I'm really struggling to know the correct syntax. If somebody could point me in the right direction I'd be very grateful. I've created an application where users can create projects, and within the projects there are 'outputs' and 'inputs'. All of which is stored in separate MySql tables. It works fine. I have now been asked to create an addition layer, a 'programme' layer, which sits above projects (ie there can be multiple projects within one programme). I think I have got my table normalisation correct, I created 2 tables, 'programmes' which stores programme id and name etc, and 'programmes_projects' which stores only the programme id and the project id. That seems to work ok. What I'm having trouble with, is displaying the results correctly. I need to retrieve information from 4 (actually 5) related MySql tables. Phew. I think I need to create an associative array and a foreach loop, but because of the number of tables and the relationships, I'm getting very confused. I'm not sure if I should be focussing on the sql statements, the php, or what. I tried using while loops, because that's what I know, but wasn't surprised that it didn't work. progId = $_GET['prog']; //get the individual projects from the linking db table $get_projects = "SELECT * FROM programmes_projects WHERE prog_id=$progId"; $run_projects = mysqli_query($conn, $get_projects); $i = 0; while($row_projects=mysqli_fetch_array($run_projects)){ $prog_proj_id = $row_projects['prog_proj_id']; $prog_id = $row_projects['prog_id']; $projectId = $row_projects['proj_id']; $i++; //attempting to collect project details from the outputs table $get_proj_details = "SELECT * FROM projects WHERE project_id=$projectId"; $fetch_projects = mysqli_query($conn, $get_proj_details); $i = 0; while($row_details=mysqli_fetch_array($fetch_projects)){ $proj_name = $row_details['project_name']; $proj_whatever = $row_details['date']; $i++; // project outputs $fetch_outputs = "SELECT * FROM projects_outputs WHERE project_id=$projectId"; $get_outputs = mysqli_query($conn, $fetch_outputs); $i = 0; while($row_outputs=mysqli_fetch_array($get_outputs)){ $out_id = $row_outputs['output_id']; $output_desc = $row_outputs['output_desc']; $i++; }}}?> Please could someone help?? Even if it's just a nudge in the right direction. Thank you very much.
-
Hi all, and especially Larry, I have encountered an interesting issue when uploading images using a reference from recently uploaded MySQL data. What I am trying to do is, in one page, send data regarding a property (real estate in US) and an image. I want the image to have the same reference number as the property. This is the schematic:... 1) Input html and upload image -> POST to php. 2) INSERT property data -> MySQL 3) SELECT property reference (Primary key) generated by MySQL. 4) Use the property reference + ".jpg" as filename -> the image to a subdirectory on server. The issue is that it seems that MySQL can take a bit too long to do the SELECT query which then throws up a '$image_no undefined variable and the image is saved as '.jpg' instead of e.g. 234.jpg. I think that I have solved it thus (my comments in red): Section of whole program: Check if user has sent html POST and uploaded an image (other conditionals not shown here for conciseness): if(isset($_FILES['upload'])) { ....then insert the data into MySQL: $q = "INSERT INTO db655736144.Properties (Property_name, Owner_name, Owner_phone_number, Owner_email, Description, Electricity, Water, Price, Commission, TCC_Comments) VALUES ('$pty', '$owner', '$phone', '$owner_email', '$desc', '$elec', '$water', '$price', '$comm', '$TCC')"; $r =@mysqli_query ($dbc, $q); //Run the query - could put this in a while loop as well? $allowed = array ('image/pjpeg', 'image/jpeg', 'image/JPG', 'image/jpg'); if(in_array($_FILES['upload']['type'], $allowed)) //Check for correct file type { $prop_id = "SELECT Property_Ref FROM Properties WHERE Property_name = '$pty'"; //Get property reference number $prop_id_action = @mysqli_query ($dbc, $prop_id); //Do query //$Property_ref is the array containing property ref no generated by MySQL while ($Property_ref = @mysqli_fetch_array($prop_id_action)) { $image_no = $Property_ref['Property_Ref']; // $image_no is the property ref no generated by MySQL. This while loop should only run once as Property_Ref is Primary key. } If MySQL hasn't done its bit yet, then you are left with $image_no equalling NULL and an error, AND an image called .jpg on the server. Also the program has to open a new subdirectory with the name Property Ref (e.g. Main/Properties/Adds/123 for additional images to be uploaded to later. This won't happen. This is the bit --------------------------------------------------------------------------------------------------- I have added a while loop that seems to work here:..... while (!$image_no) // If the image number from the query = NULL (!$image_no) { while ($Property_ref = @mysqli_fetch_array($prop_id_action)) // Repeat the query until we have a value for $image_no { $prop_id_action = @mysqli_query ($dbc, $prop_id); //Do query $image_no = $Property_ref['Property_Ref']; // $image_no is the property ref no generated by MySQL } } -------------------------------------------------------------------------------------------------- $_FILES['upload']['name'] = $image_no . '.jpg'; //Add file extension This is just to check that there isn't a subdirectory with the same name (shouldn't be)... if (move_uploaded_file($_FILES['upload']['tmp_name'], "images/properties/{$_FILES['upload']['name']}")) { if(is_dir('images/properties/more_images/' . $image_no)) { echo "<h2>There was a system problem - please call Max.</h2>"; echo '<p style = "font-weight: bold; font-size: 120%"><a href = "admin.php">Return to menu</a></p>'; die(); } No directory exists so we can contine by creating it: else { mkdir('images/properties/more_images/' . $image_no); Some HTML to return to menu etc:... echo '<p style = "font-weight: bold; font-size: 120%">File uploaded....<a href = "add_images.php?image_no=' . $image_no . '">Add more images</a>...or...<a href = "admin.php">Return to menu</a>....or just continue.....</p>'; } ....cont } else { echo "There was a system problem - please call Max."; die(); } } else { echo'<p class="emph">Please upload a .jpg image</p>'; } } I'd be very interesed in your comments regarding this 'fix'. Regards Max
-
Wishlist.php Error?
jasont8 posted a topic in Effortless E-Commerce with PHP and MySQL (2nd Edition)
so when starting up the wishlist.php using the book scripts of the second site, I'm getting an error that An error occurred in script '/var/www/html/ex2/html/wishlist.php' on line 81: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array. what does this error and mean. How do I go about fix it? Is it a problem with the data in the database? -
I created various websites (based on Larry's code) that worked fine for years, but after my web hosting company upgraded to PHP Version 5.6.27, I repeatedly receive this error message: "An error occurred in script '.../mysql_connect.php' on line 8: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead" I was able to suppress that error message on one website by prepending the "@" symbol to the expression, but strangely it did not work on another site. I'd like to know why (as a quick fix), and whether I can do something to suppress error messages for an entire site instead of using "@" multiple times. I'd also love to know how to change my code to work with PDO (preferably) or MySQLi; my web host supports both. It would be great to see an example of PHP handling data with old MySQL code and PHP working with PDO or MySQLi, to see how to "translate" it, so to speak. However, I don't want to use PDO if that requires me to learn Object-Oriented PHP; all my sites are based on procedural PHP. The above error message is generated in response to this mysql_connect.php code: <?php error_reporting(0); // didn't suppress error message ini_set('display_errors',0); // didn't suppress error message DEFINE ('DB_USER', '***'); DEFINE ('DB_PASSWORD', '***'); DEFINE ('DB_HOST', '***'); DEFINE ('DB_NAME', '***'); if ($dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)) { // this is the line generating the error message if (@!mysql_select_db (DB_NAME)) { trigger_error("Could not select the database!\n<br />MySQL Error: " . mysql_error()); exit(); } } else { trigger_error("Could not connect to MySQL!\n<br />MySQL Error: " . mysql_error()); exit(); } function escape_data ($data) { if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } if (function_exists('mysql_real_escape_string')) { global $dbc; $data = @mysql_real_escape_string (trim($data), $dbc); } else { $data = @mysql_escape_string (trim($data)); } return $data; } ?> Thank you!
- 2 replies
-
- mysql
- deprecated
-
(and 3 more)
Tagged with:
-
I'm having an issue with mysql_real_escape_string. This is used to display a custom post type (food menu items) for the WooThemes Diner theme (for WordPress). Food menu items no longer display on the Diner menu page because they are being called with mysql_real_escape_string. What is the proper way to call these items? Theme: Diner by WooThemes version 1.9.8 (now retired from active support) Affected file: admin-interface.php Lines: 111 & 118 /*-----------------------------------------------------------------------------------*/ /* WooThemes Admin Interface - woothemes_add_admin */ /*-----------------------------------------------------------------------------------*/ if ( ! function_exists( 'woothemes_add_admin' ) ) { function woothemes_add_admin() { global $query_string; global $current_user; $current_user_id = $current_user->user_login; $super_user = get_option( 'framework_woo_super_user' ); $themename = get_option( 'woo_themename' ); $shortname = get_option( 'woo_shortname' ); // Reset the settings, sanitizing the various requests made. // Use a SWITCH to determine which settings to update. /* Make sure we're making a request. ------------------------------------------------------------*/ if ( isset( $_REQUEST['page'] ) ) { // Sanitize page being requested. $_page = ''; $_page = mysql_real_escape_string( strtolower( trim( strip_tags( $_REQUEST['page'] ) ) ) ); // Sanitize action being requested. $_action = ''; if ( isset( $_REQUEST['woo_save'] ) ) { $_action = mysql_real_escape_string( strtolower( trim( strip_tags( $_REQUEST['woo_save'] ) ) ) ); } // End IF Statement // If the action is "reset", run the SWITCH. /* Perform settings reset. ------------------------------------------------------------*/
-
So...I'm just getting really frustrated now. I've been reading through several of these chapters several times. My school always tends to not choose books well. On to the issue though. In several sections I've noted it stating "Connect to MySQL and select the forum database." This is where the issue lies. I have MySQL and PHP installed in both operating systems of my laptop (Linux and Windows) and in neither does the referenced database exist. The book does not even state WHERE or HOW to have this included. How is a person supposed to follow the examples if some crucial components were left out? It's like giving directions by saying "Just follow me" while in a car to a person on a bicycle. Saying follow me would be completely worthless. If someone can at least point me in the right direction to actually have these referenced databases...or to a quality book. Either way.
- 6 replies
-
- not found
- doesnt exist
- (and 4 more)
-
When I tried to run the downloaded SQL commands in phpMyAdmin, various error messages appeared, stating that no author table exists. So I searched for all occurrences of the word "author" and replaced them with "user", except for this line: `type` enum('public','author','admin') NOT NULL, Is this correct? The file I downloaded is: yiibook2_cms.sql.zip Thanks.
-
hello, I have starting reading the PHP and MySQL 4th edition book by LarryUllman. So far I have completed first four chapters and now starting 5th chapter. But, with time as I read further, I also want to develop good skills i.e be good in what I am learning. So can anyone suggest me some startup projects? or scripts etc I can try to code, so I can be more good in programming. Regards,
-
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.