Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About sorin

  • Rank
  1. This is the page from chapter 12 with view users. If in the database I have a lot of users and I want to put them for example each 10 users on a column and to make 2-3-4 columns how can I do that? Like this: foo foo foo foo foo foo foo foo foo foo foo foo ect <?php $page_title = 'View the Current Users'; include ('includes/header.php'); echo '<h1>Registered Users</h1>'; require ('mysqli_connect.php'); // Define the query: $q = "SELECT last_name, first_name, DATE_FORMAT(registration_date, '%M %d, %Y') AS dr, user_id FROM users ORDER BY registration_date ASC"; $
  2. It's from ch17, from forum.php I put it online so you can see it http://www.viatasisanatatea.ro/ch17/forum.php How come that you answer to this question but the one with the flags you didn't ? I asked for an idea not code. <?php # Script 17.4 - forum.php // This page shows the threads in a forum. include ('includes/header.php'); // Retrieve all the messages in this forum... // If the user is logged in and has chosen a time zone, // use that to convert the dates and times: if (isset($_SESSION['user_tz'])) { $first = "CONVERT_TZ(p.posted_on, 'UTC', '{$_SESSION['user_tz']}')"; $
  3. Larry I tried to think how do do your example from ch17 with language flags, without users login, but is beyond my knowledge. This is my first example that I learn how to select language using the database and I want to learn it very well. So I put 2 links with flags images but I'm not sure how and where to start . Please give an idea. This is the link where is the ch17 folder online: http://www.viatasisanatatea.ro/ch17/forum.php
  4. This is what I get from print_r using $row from while loop: Array ( [thread_id] => 7 [subject] => Sample Thread [username] => troutster [responses] => 2 [last] => [first] => ) Can you tell me why?
  5. In the header you put a default timezone, $_SESSION['user_tz'] = 'America/New_York'; but can please tell me how to GET the real timezone? My guess you have to get that on the login page, right? I'm talking about a php function, if there is one, to get the timezone and not have it on database already.
  6. Larry this is the link that I have from email whern I clicked to activate the account: http://www.aproapetot.com/ch18/activate.php?x=sorin21us%40yahoo.com&y=e123adeb2f8837ae6968483526e491b9 Why I get server not foud?
  7. A friend that knows js and php helped me. He told me this is Ajax. After your answer and after his help, my question to you is: Can you, please, recommend me a js with php book? $(document).ready(function() { //var q = $('#categ_id').val(); $('.categ_id').on("change", function () { q = $(this).val(); $.ajax({ url: 'http://aproapetot.ro/ajax/get_subcateg.php', data: 'categ_id='+q, success: function (data) { $('#subcateg_id').html(data); } }).error(function() { alert ('An error occured'); }); }); }); <?php require_once ('../includes/mysql
  8. Larry, on the add_page I have to have the categories, subcategories, title and description of the page. When I do the sql SELECT categories and bring in the select tag, then SELECT subcategories and bring in the select tag, I do that because I have to know from that a specific page belongs to an category and what subcategory. So the database is in that way because when I do the insert INSERT INTO pages (category_id, subcategory_id, title, content_page, user_id) VALUES ($cat, '$subcat', '$t', '$c', 1 I can't insert in pages only the category without the subcategory. So this is the add_page
  9. Having this database: CREATE TABLE `categories` ( `category_id` SMALLINT NOT NULL AUTO_INCREMENT, `category` VARCHAR(30) NOT NULL, PRIMARY KEY (`category_id`), UNIQUE KEY `category` (`category`) ) ; CREATE TABLE `subcategories` ( `subcategory_id` SMALLINT NOT NULL AUTO_INCREMENT, `category_id` SMALLINT NOT NULL, `subcategory` VARCHAR(30) NOT NULL, PRIMARY KEY (`subcategory_id`), UNIQUE KEY `subcategory` (`subcategory`) ) ; CREATE TABLE `pages` ( `id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, `category_id` SMALLINT UNSIGNED NOT NULL, `subc
  10. There is still an error. If you open a record to edit and you don't edit anything if you click submit you get this error: The user could not be edited due to a system error. We apologize for any inconvenience. Query: UPDATE users SET first_name='Melissa', last_name='Bank', email='melissa@authors.com' WHERE user_id=13 LIMIT 1
  11. Same problem Lary like in the past. Friday I got the error, today when I check it again was working. Now I know that when I get an error I will clean the history complete for all day.
  12. I get this error: The user could not be edited due to a system error. We apologize for any inconvenience. Query: UPDATE users SET first_name='John', last_name='Lennonn', email='john@beatles.com' WHERE user_id=3 LIMIT 1 And this is the page: $page_title = 'Edit a User'; include ('includes/header.html'); echo '<h1>Edit a User</h1>'; // Check for a valid user ID, through GET or POST: if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { // From view_users.php $id = $_GET['id']; $id = $_GET['id']; } elseif ( (isset($_POST['id'])) &&(is_numeric($_PO
  13. i understand what you are saying but that means to make a lot of tables if jokes, short films, and stories will have each one a table. If I will have 10 categories that means 10 tables. If I follow this idea will mean that each subcategory from jockes will have a diff table. What will happening if I will have subsubcategories. A lot of tables. If I don't understand exactly what you said please take a simple ex, or mine, and explain. Thank you.
  14. I will show you a better example. Let's say that this is a site for jokes. I will have categories, that will be the menu as well: jokes, short films, stories. So these are the categories. Now the subcategories will be for jokes: sailors, plolice men, blondes, etc shorts films: funny films, crazy films, wow films stories: funny stories, wise stories Subsubcategories stories: funny stories: usa, canada, europe Of course the list for categories and subcategories could be longer then what I put here. So in this direction I made the tables: CREATE TABLE `categories` ( `category_
  • Create New...