Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'table'.



More search options

  • 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


Found 5 results

  1. I have an images table that has 5 foreign keys that reference 5 other tables, each of those tables uses the images table to store images, when an image gets uploaded, the foreign key in question gets a value associated with it in the images table but the other 4 foreign keys will get NULL values in that row. Is that acceptable, or should I rethink my database design? What would be the best way to go?
  2. In Chapter 19, the $_SESSION['customer_id'] variable is often used for things like isset($_SESSION['customer_id']) why though can't we use other table columns that are like customer_id in the $_SESSION[] for example $_SESSION['order_id'] In chapter 19 also, the $_GET['id'] is the same id as the customer's. Why is it the same? Where does it get declared as the same, I have searched through the scripts and I don't see it. I am trying to create a script where users can view their past orders. The trouble I am having is calculating the total amount of the order in the checkout.php script, because there is no customer_id field in the order_contents table. Here is where I am at with that in the checkout.php script: $u = "SELECT price * quantity AS amount FROM order_contents WHERE order_id=?not sure what to put here"; $total = mysqli_query($dbc, $u);
  3. Hi Larry, I'd like to ask help with a problem that I am experiencing with an HTML table which is generated by PHP echos. When it renders in a browser, four spurious sem-colons appear at the top of the table - in Firefox they are aligned horizontally; in IE9 they are aligned vertically, both on the left hand side of the area immediately above the table itself. Maybe relatedly the table has four columns. It does not need or have a header but I have tried adding blank <th></th> pairs but it makes no difference. The table itself renders perfectly. echo '<table>'; .... other MySQL code here ... echo "<tr> <td rowspan='2'> <div align='center' class='index_table_icon'> <a href='./link to the page that this icon refers to'> <img src='$icon1' alt=''> </a> </div> </td> <td valign='bottom'> <a class='text_link' href='./link to the page that this icon refers to'> $cats[2] </a> </td> <td rowspan='2'> <div align='center' class='index_table_icon'> <a href='./link to the page that this icon refers to'> <img src='$icon2' alt=''> </a> </div> </td> <td valign='bottom'> <a class='text_link' href='./link to the page that this icon refers to'> $cats[4] </a> </td> </tr>; <tr> <td> <p class='index_maintext'> $cats[5] </p> </td> <td> <p class='index_maintext'> $cats[6] </p> </td> </tr> <tr> <td> </td> </tr>"; echo "</table>"; My environment is a Win 7 64 bit PC, Firefox, IE9, Apache, PHP, MySQL. All executions are via localhost. Many thanks in anticipation for any assistance that can be provided. Best regards, Necuima
  4. Version 0.5 Loading a Single Model The following two examples work together. The second calls the first. I believe the purpose is to retrieve a record from a table. And I believe each occurrence of $id represents the primary key value of the particular record we want. My question is, how do these functions know which table to search in? page 136: public function loadModel($id) { $model = Page::model()->findByPk($id); if ($model===null) { throw new CHttpException(404, 'The requested page does not exist.'); } Page 139: public function actionView($id){ $this->render('view',array( 'model'=>$this->loadModel($id), )); }
  5. I have a MySQL database model where I have different types of users, each having common field names, like 'username', 'password', 'first_name', 'last_name', etc. etc. I've designed it so that these common fields are stored in a 'base' table called 'users' and specific fields that apply to each type of user are stored in derived 'sub-tables' for each type of user. Here is what it looks like: I know that this is a better design than having the 'common' fields stored in every 'user' table. The problem I'm having is I'm trying to figure out how I'm going insert a new user. What would be the best way to handle this? Initially, I'm thinking I could do an insert like this (let's say I wanted to insert a student): <?php // Begin Transaction // Insert the common data into the 'users' table // Get the last inserted ID // Insert the student-specific data into the 'students' table along with the last inserted ID // Commit // If problem occured // Rollback ?> But that just seems like a very crappy way to do it. I would like to have it done in one swift statement. So I haven't had much luck finding clear solutions online, but I recall one person mentioning the use of updatable views for each subtype, where the view would perform an inner join on the subtype table and the base table, and you could insert and update using the single view. I have tried to create a view but keep getting the error: #1356 - View '[view name]' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them. Where [view name] is the name of my view. I get this error even when just selecting one column from one table and I know the names are right. Would the 'view' approach be the best way to go, assuming I can figure out how to get it to work? Is there a better way than what I've mentioned so far? Much thanks, Zane EDIT: Oh, and the PK 'user_id' is an auto-incremented INT in the users table. EDIT 2: Got my view to work. Turns out I had to specify the SQL SECURITY line as INVOKER instead of the default DEFINER. Going to try to see if I can perform inserts and updates on this view...
×
×
  • Create New...