Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Html

  1. So this PDO class is not available on the server I use, and should the package not contain this? An Error occurred while handling another error: Error: Class 'PDO' not found in /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/Connection.php:705 Stack trace: #0 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/Connection.php(626): yii\db\Connection->createPdoInstance() #1 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/Connection.php(1022): yii\db\Connection->open() #2 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/Connection.php(1009): yi
  2. Hi, I got this line 705 from a connection.php file. Error: Class 'PDO' not found in return new $pdoClass($dsn, $this->username, $this->password, $this->attributes); } I tried the official site, nothing on this. The installation was okay. Line 705.
  3. No, you are the first poster to bring that to my attention. I looked at the example, I thought the example there is the solution to this. I think having two tables is probably not needed to begin with.
  4. So replace one of the table codes with a mysqli_data_seek() Or just keep the one. # Retrieve items from 'shop' database table. $q = "SELECT * FROM shop" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { # Display body section. echo '<table><tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<td><strong>' . $row['item_name'] .'</strong><br><span style="font-size:smaller">'. $row['item_desc'] . '</span><br><img src='. $row['item_img'].'><br>$' . $row['item_price'] . '<
  5. So this is one example there. <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } # Retrieve items from 'shop' database table. $q = "SELECT * FROM shop" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) /* seek to row no. 400 */ $result->data_seek(399); /* fetch row */ $row = $result->fetch_row(); printf ("City: %s Countrycode: %s\n", $row[item_name], $row[item_des
  6. Hi, I tried simply duplicating this, but it didn't work, so this code simply retrieves items for a shop, and adds a link, I just want to duplicate the link but for a different item, at the moment, all items will have the same link. Obviously, the items listed, are from one table. So a new set of items would be from another. # Retrieve items from 'shop' database table. $q = "SELECT * FROM shop" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { # Display body section. echo '<table><tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC ))
  7. Html

    link click counted?

    This may be the wrong place, but I want to be able to count a link which has been clicked. So a number would be displayed next to it. Could be javascript, but the link I am using is in php code. I just used that as it worked for what I needed. so I have two links below in this table/code. echo '<table><tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<td><strong>' . $row['item_name'] .'</strong><br><span style="font-size:smaller">'. $row['item_desc'] . '</span><br><img src='. $row['item_img'].'><
  8. This is in the wrong location in the image code. shop table has first_name, last_name, item_id and Item_img. varchar 20 for all. I removed the stored image cow.png, so there is nothing in the table. Session is for the user which has uploaded the image, and item_id is linked with it, just like having post_id for the comments. It can't be the properties, that are wrong, the code structure has got to be. # Execute inserting into 'shop' database table. $q = "INSERT INTO shop(first_name,last_name,item_id,item_img) VALUES ('{$_SESSION[first_name]}','{$_SESSION[
  9. Hello, this code below is from an example on the site. It looks sort of interesting, and I guess this should work out, what I don't quite know how to go about this, is bootstrap, it is a plugin from what I have gathered. Where or what do I do with this plugin? <button class="tablink" onclick="openPage('Home', this, 'red')">Home</button> <button class="tablink" onclick="openPage('gallery', this, 'green')" id="defaultOpen">News</button> <div id="Home" class="tabcontent"> <h3>Home</h3> <p>Home is where the heart is..</p> <
  10. I looked back at the topic from last year, on how to upload an image, and send the data to the db. I then thought I had perhaps got somewhere with that problem, as I only got as far as the example the user on here had posted, and had trouble with it. So the shop table already stores an image, as multiple items to buy in the shop network login site, all this code is connected. I just removed the shop as it wasn't needed. users, and forum are separate tables, yes this is how this system works, I did state users table and forum table. I haven't expressed they were all in one, that
  11. The first_name and last_name are necessary for the shop table? I'd of thought so, as both users and forum have them. Otherwise it is item_id, and the other was Item_name, as well item_img, I will need at least one of these, obviously an uploaded image won't store in these, but then again the code while reports no errors probably isn't structured correctly, when adding the sql code to the image upload code. sing WHERE usertable.userid = 007 AND imagetab.userid = 007
  12. The shop table, and file is actually a part of the user login site from the Php & Mysql book, but by viewing post_action.php, and seeing the stored images in the table for the database, I sort of thought, well this may be a way of getting the upload feature linked with a registered user. I am not sure how I am not going in the correct direction, it just needs a little tinkering, to link it together. Shop table will store Admin's uploaded image, as the code above demonstrates, or would if the code would work with the database insertion code. # Execute inserting into 'forum' da
  13. Well, the shop table can be used to store an image, that is my point, otherwise how am I going to link it just like the user is linked with the comments when posting to the forum. I used the above example, as I thought it is the same as the other tables, you get my point here? There is item_id, in shop to store an image, that is displayed in a shop. My point is to use that to store the user's uploaded images, it already has images/ since that the folder I have where they are stored. What may be obvious to you, isn't quite so to me, I'm returning to this, and just had a thought b
  14. So item_img I added to forum table as another column, obviously it didn't store the uploaded image. So in the shop table, this is what looks like, so if I could use this to store an image that has been uploaded, and connect it with the other two tables or something, I hope you get my point. item_id item_name item_img 1 Cow images/cow.png 2 Dog images/dog.png
  15. Well for the moment, this is what I have tried. For the image upload code, I decided just to insert this. <?php # Access session. session_start() ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; } # Create navigation links. echo '<p><a href="home.php">Home</a> | <a href="upload.php">Upload image</a> | <a href="gallery.php">Gallery</a> | '; # Execute inserting into 'forum' database table. $q = "INSERT INTO shop(first_name,last_name,item_img) VALUES ('{$_SE
  16. Unfortunately, I last tried this whole task with the image upload, and yeah I read what you stated in those posts, I didn't understand the fundamentals, I was just tinkering with it. As for this profile link example. You mean the link and image type must be in the table? The post_action.php which I didn't take much look into, clearly shows something different. CREATE DATABASE IF NOT EXISTS site_db; USE site_db; CREATE TABLE IF NOT EXISTS users ( user_id INT UNSIGNED NOT NULL AUTO_INCREMENT, first_name VARCHAR(20) NOT NULL, last_name VARCHAR(40) NOT NULL, email
  17. <?php # PROCESS MESSAGE POST. # Access session. session_start(); # Make load function available. require ( 'login_tools.php' ) ; # Redirect if not logged in. if ( !isset( $_SESSION[ 'user_id' ] ) ) { load() ; } # Set page title and display header section. $page_title = 'Post Error' ; include ( 'includes/header.html' ) ; # Check form submitted. if ($_SERVER['REQUEST_METHOD'] == 'POST') { # Check Subject and Message Input. if ( empty($_POST['subject'] ) ) { echo '<p>Please enter a subject for this post.</p>'; } if ( empty($_POST['message'] ) ) { echo '<p>Please en
  18. Sure, it will need an id link, the code I have used sort of links the comments with the registered name, but the tables aren't all in one, so forum is separate from users.
  19. Well is it a hyperlink? It could be since a new page would load to display the name of the user. Like some other example sites, a link would be on the name of the posted user like on a forum post. Like here, a good example.
  20. I want to add a link in this php code, what must be read up on to get something like this working? It would be a profile page, so I'm just sort of wanting to gather some info on this. Either I'd add another row for the table to display or using an existing one like first name which would be a hyper link. if ( mysqli_num_rows( $r ) > 0 ) { echo '<table><tr><th>Posted By</th><th>Subject</th><th id="msg">Message</th></tr>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<tr><td>' . $row['f
  21. I don't know, I just watched a clip the other day by Eli the computer guy, and then posted here for some pointers.
  22. I searched on bing. <?php $fileList = glob('test/*'); foreach($fileList as $filename){ //Use the is_file function to make sure that it is not a directory. if(is_file($filename)){ echo $filename, '<br>'; } } https://thisinterestsme.com/php-list-all-files-in-a-directory/
  23. The set directory, being the upload_tmp one. So what about simply display images that have been sent to a folder in the directory, how can the images simply be displayed on a page, they'd simply be listed as a row going down, I am guessing without any CSS.
  24. Right, so the image is stored then in $temp, this value. upload_tmp_dir Directive /tmp So this is local value, /tmp And Master value
  25. Hi, Where does the image uploaded here in this, display once it has been uploaded to a directory <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title>PHP File Upload</title> </head> <body> <form method="POST" action="<?php $_SERVER[ 'PHP_SELF' ] ?>" enctype="multipart/form-data"> Select an image to upload : <input type="file" name="image" > <input type="submit" value="Upload Image" > </form> <?php if( $_SERVER[ 'REQUEST_METHOD' ] == 'POST' ) { $name = $_FILES[ 'image' ][ 'name' ] ;
  • Create New...