Jump to content

Html

Members
  • Posts

    640
  • Joined

  • Last visited

About Html

  • Birthday 03/17/1989

Profile Information

  • Gender
    Male
  • Location
    Greater London

Recent Profile Visitors

17,091 profile views

Html's Achievements

Invested Member

Invested Member (3/7)

7

Reputation

  1. All of this is from In Easy step's code, Php & Mysql book, the code isn't available to download via the site without an account. Since I backed it up last year after I closed the free hosting with infinityfree.net, thought I'd try it once more. I was simply wanted to add a default avatar so when any user posts, an image will load next to it. So I need css to include it, and the image needs to be stored in the table forum, to print it once the message has been sent to the forum table, and the code above displays it. My post isn't viewable if I log out.🤨
  2. The CSS is in the header2.html <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title><?php echo $page_title; ?></title> <link rel="stylesheet" href="includes/style2.css"> </head> <style> img { display: block; margin-left: 10; margin-right: 70; width: 15%; } .center { margin: auto; width: 60%; border: 3px solid #73AD21; padding: 10px; } </style> <body> <header><h1></h1></header> header > h1 { border-bottom: 1px dashed black ; font-style: italic ; font-size: x-large; } footer > p { border-top: 1px dashed black ; font-style: italic ; } table { border-spacing:5px; width:530px; position: right; } th { color:#FFF; background:#000; text-align:left; } td { border-bottom:1px solid black; background:#F0F0F0; padding:3px; text-align:left; vertical-align:top;} p#err_msg { color:#F00; font-weight:bold; } Here it is style2.css
  3. Hello, I would like to add an img_item to this table, so when the table is retrieved and displayed on a page, a default image would be posted next to this column. So this is the current layout, I tried editing to see what happens, the CSS just creates another column, but it moves the rest of the data along once loaded, so only two are working, the image appear before Posted By. ; # Open database connection. require ( 'connect_db.php' ) ; # Display body section, retrieving from 'forum' database table. $q = "SELECT * FROM forum" ; $r = mysqli_query( $dbc, $q ) ; if ( mysqli_num_rows( $r ) > 0 ) { echo '<div><table><tr><th>Posted By</th><th id="msg">Message</th></tr></div>'; while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC )) { echo '<tr><td>' . $row['first_name'] .' '. $row['last_name'] . '<br>'. $row['post_date'].'</td> <td>' . $row['message'] . '</td> </tr>'; } echo '</table>' ; } else { echo '<p>There are currently no messages.</p>' ; } # Close database connection. mysqli_close( $dbc ) ; ?> So item_img would go $row '<div><table><tr><th>Img</th> Below is item 7 in the forum table item_img varchar(20) latin1_swedish_ci No None
  4. 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): yii\db\Connection->getMasterPdo() #3 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(406): yii\db\Connection->getSlavePdo() #4 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(430): yii\db\mysql\QueryBuilder->supportsFractionalSeconds() #5 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/mysql/QueryBuilder.php(59): yii\db\mysql\QueryBuilder->defaultTimeTypeMap() #6 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/base/BaseObject.php(109): yii\db\mysql\QueryBuilder->init() #7 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/QueryBuilder.php(116): yii\base\BaseObject->__construct(Array) #8 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/mysql/Schema.php(217): yii\db\QueryBuilder->__construct(Object(yii\db\Connection)) #9 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/Schema.php(248): yii\db\mysql\Schema->createQueryBuilder() #10 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/Connection.php(856): yii\db\Schema->getQueryBuilder() #11 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/ActiveQuery.php(328): yii\db\Connection->getQueryBuilder() #12 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/Query.php(248): yii\db\ActiveQuery->createCommand(Object(yii\db\Connection)) #13 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query->all(NULL) #14 /home/userajrl/public_html/protected/humhub/libs/BaseSettingsManager.php(177): yii\db\ActiveQuery->all() #15 /home/userajrl/public_html/protected/humhub/libs/BaseSettingsManager.php(51): humhub\libs\BaseSettingsManager->loadValues() #16 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/base/BaseObject.php(109): humhub\libs\BaseSettingsManager->init() #17 [internal function]: yii\base\BaseObject->__construct(Array) #18 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array) #19 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('humhub\\componen...', Array, Array) #20 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('humhub\\componen...', Array, Array) #21 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array) #22 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('settings', true) #23 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/ServiceLocator.php(74): yii\base\Module->get('settings') #24 /home/userajrl/public_html/protected/humhub/components/Request.php(28): yii\di\ServiceLocator->__get('settings') #25 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/base/BaseObject.php(109): humhub\components\Request->init() #26 [internal function]: yii\base\BaseObject->__construct(Array) #27 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array) #28 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('humhub\\componen...', Array, Array) #29 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('humhub\\componen...', Array, Array) #30 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array) #31 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('request', true) #32 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/di/ServiceLocator.php(74): yii\base\Module->get('request') #33 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/web/ErrorHandler.php(503): yii\di\ServiceLocator->__get('request') #34 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/web/ErrorHandler.php(116): yii\web\ErrorHandler->shouldRenderSimpleHtml() #35 /home/userajrl/public_html/protected/vendor/yiisoft/yii2/base/ErrorHandler.php(123): yii\web\ErrorHandler->renderException(Object(Error)) #36 [internal function]: yii\base\ErrorHandler->handleException(Object(Error)) #37 {main}
  5. 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.
  6. 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.
  7. 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'] . '<br><a href="added.php?id='.$row['item_id'].'">Add To Cart</a></td>'; } echo '</tr></table>'; echo '<table><tr>'; while ( $row = mysqli_data_seek( $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'] . '<br><a href="added.php?id='.$row['item_id'].'">Add To Cart</a></td>'; }
  8. 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_desc]); /* free result set*/ $result->close(); } /* close connection */ $mysqli->close(); ?> I am not sure, I can use this, but put the values of the table? printf ("City: %s Countrycode: %s\n", $row[item_name], $row[item_desc]);
  9. 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 )) { 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'] . '<br><a href="added.php?id='.$row['item_id'].'">Add To Cart</a></td>'; } echo '</tr></table>'; 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'] . '<br><a href="added.php?id='.$row['item_id'].'">Add To Cart</a></td>'; } echo '</tr></table>'; # Close database connection. mysqli_close( $dbc ) ; Thanks.
  10. 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'].'><br>' .'<br><a href="robotpainted.3ds">Download 3ds robot file</a><br><a href="robotpainted.blend">Download robot blend file</a></td>'; } echo '</tr></table>'; Thanks.
  11. 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[last_name]}','{$_POST[item_id]}','{$_POST[item_img]}',NOW() )"; $r = mysqli_query ( $dbc, $q ) ;
  12. 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> </div> <div id="News" class="tabcontent"> <h3>Gallery</h3> <p>Some news this fine day!</p> </div> <script> function openPage(pageName,elmnt,color) { var i, tabcontent, tablinks; tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("tablink"); for (i = 0; i < tablinks.length; i++) { tablinks[i].style.backgroundColor = ""; } document.getElementById(pageName).style.display = "block"; elmnt.style.backgroundColor = color; } // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click(); </script>
  13. 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 would be messy. I guess. So image will be stored in shop, now two columns, so if forum and users are interconnected, based on that post_action.php, how do I get this image upload page to do exactly the same process, linked with it in the code, but obviously would not display the linked image in the db on the user forum or profile page or control panel area of the user site. Ineasysteps produce the code the way it is.
  14. 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
×
×
  • Create New...