Barand Posted July 8, 2018 Share Posted July 8, 2018 I have shown you how to do it an hour ago. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559421 Share on other sites More sharing options...
piano0011 Posted July 8, 2018 Author Share Posted July 8, 2018 I have tried it and hope that I did the right thing: but it is still big... <div> <img class="small_logo" src="includes/pictures/pc101.gif" alt="pianocourse101 logo"/> </div> CSS code: .small_logo { position: absolute; top: 200px; left: 200px; width: 212px; height: 116px; } Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559422 Share on other sites More sharing options...
Barand Posted July 8, 2018 Share Posted July 8, 2018 It resizes OK for me <html> <head> <meta name="generator" content="PhpED 18.0 (Build 18044, 64bit)"> <title>Image sizes</title> <style type="text/css"> .small_logo { position: absolute; top: 200px; left: 200px; width: 212px; height: 116px; } </style> </head> <body> <div> <img class="small_logo" src="pc101.gif" alt="pianocourse101 logo"/> </div> <br>Normal image for comparison<br> <div> <img src="pc101.gif" alt="pianocourse101 logo"/> </div> </body> </html> (The smaller image overlays the normal one because of the positioning in your style definition) Where have you defined your style? Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559424 Share on other sites More sharing options...
piano0011 Posted July 8, 2018 Author Share Posted July 8, 2018 You are right! It does work without the div class... I guess I have been watching this video and it must be for a different purpose? He is using div for the font awesome pictures: Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559425 Share on other sites More sharing options...
piano0011 Posted July 8, 2018 Author Share Posted July 8, 2018 I have another issue with my default picture in my header.php and that is, when browsing and using the development tool, it is showing up as two img pictures but I only have one default img in this code: I will try moving my other contents first and see how that goes! <?php session_start(); if (isset($_SESSION['u_uid'])) { echo '<form action="includes/logout.php" method="POST"> <button type="submit" name="submit">Logout</button> </form>'; include_once 'includes/dbh.php'; $sql = "SELECT * FROM users;"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL error'; } else { mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $resultCheck = mysqli_num_rows($result); if($resultCheck > 0) { while ($row = mysqli_fetch_assoc($result)) { $id = $row['user_id']; $sqlImg = "SELECT * FROM profileimg WHERE userid = ?;"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sqlImg)) { header("Location: index.php?login=error"); exit(); } else { mysqli_stmt_bind_param($stmt, "i", $id); mysqli_stmt_execute($stmt); $resultImg = mysqli_stmt_get_result($stmt); while ($rowImg = mysqli_fetch_assoc($resultImg)) { echo "<div>"; if ($rowImg['status'] == 0) { $filename = "includes/uploads/profile".$id."*"; $fileinfo = glob($filename); $fileext = explode(".", $fileinfo[0]); $fileactualext = $fileext[1]; echo "<img class='profile_picture' src='includes/uploads/profile".$id.".".$fileactualext."?".mt_rand()." >"; } else { echo "<img class='default_picture' src='includes/uploads/profiledefault.jpg'>"; } echo"</div>"; } } } } This is my CSS code: .default_picture { position: relative; left: 150px; bottom: 50px; width: 100px; height: 60px; } Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559426 Share on other sites More sharing options...
piano0011 Posted July 8, 2018 Author Share Posted July 8, 2018 I also forgot to mention that for the above logo problem, it will only work if I include the !important, Does this mean, that something must have overriden the following code? .pc101 { position: absolute; top: 400px; left: 700px; width: 402px !important; height: 116px !important; } Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559429 Share on other sites More sharing options...
Barand Posted July 8, 2018 Share Posted July 8, 2018 Sounds like it. You need to search out where it is happening. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559430 Share on other sites More sharing options...
piano0011 Posted July 8, 2018 Author Share Posted July 8, 2018 thanks and with regard to my default_picture, I am not sure why it is displaying two pictures. I have checked and there are no other background image... I guess, I will just keep checking on it... Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559432 Share on other sites More sharing options...
Barand Posted July 8, 2018 Share Posted July 8, 2018 When you say "no other background image" does that mean there is one? Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559434 Share on other sites More sharing options...
mac_gyver Posted July 8, 2018 Share Posted July 8, 2018 you are getting two images because your query is not doing what you want, probably because you are just copying things together instead of writing the code so that it does what you have defined. you are querying for all the rows from the users table. you should be querying for just the row that matches the current logged in user, and as has already been written in a reply, don't use a loop to retrieve data when a query will match just one row. you should also be using a single JOIN query, between the users and the profileimg tables. in fact, for what you are doing, getting the status from the profileimg table, you only need to query that table. you are not actually using any data from the users table query that you don't already have from your login session variable. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559436 Share on other sites More sharing options...
piano0011 Posted July 8, 2018 Author Share Posted July 8, 2018 (edited) I have checked and just to clear things here, there is no background image and i have not used a loop. There is no for loop, i am just displaying the $row. Edited July 8, 2018 by piano0011 Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559438 Share on other sites More sharing options...
Barand Posted July 8, 2018 Share Posted July 8, 2018 You have 2 nested while() loops Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559439 Share on other sites More sharing options...
Barand Posted July 8, 2018 Share Posted July 8, 2018 A qustion about this line of code, if I may echo "<img class='profile_picture' src='includes/uploads/profile".$id.".".$fileactualext."?".mt_rand()." >"; | unclosed single quote As you can see, the src name of the image has no closing quote so I (and the PHP processor) have difficulty in knowing where the name ends. Is the mt_rand() supposed to be part of the name? If so, how do expect to ever find that file? If not, why is there? Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559440 Share on other sites More sharing options...
piano0011 Posted July 9, 2018 Author Share Posted July 9, 2018 14 hours ago, piano0011 said: I tried it without the div class but still can't get it to shrink..... Thanks for pointing that out.. i will check the closing quote and yes, that function is meant to be there according to a video i watched. It is meant to give the user the ability to upload any files. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559447 Share on other sites More sharing options...
mac_gyver Posted July 9, 2018 Share Posted July 9, 2018 the mt_rand() is there to help insure that the image will be requested from the server, rather than to use a cached image. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559448 Share on other sites More sharing options...
piano0011 Posted July 9, 2018 Author Share Posted July 9, 2018 I have checked the video again and the only thing missing is that he is using an echo div class but as you mentioned earlier that div class does not work too well with images. I should look up more into this but how come it doesn't work too well with images? He actually did that following in the code: I have tried closing the single quote in my 2nd attachment but it is still showing as the following. I will upload the video source as well because I did exactly as he did in the tutorial... Cheers! while ($rowImg = mysqli_fetch_assoc($resultImg)) { echo "<div class ='user-container'>"; if ($rowImg['status'] == 0) { $filename = "includes/uploads/profile".$id."*"; $fileinfo = glob($filename); $fileext = explode(".", $fileinfo[0]); $fileactualext = $fileext[1]; echo "<img src='includes/uploads/profile".$id.".".$fileactualext."?".mt_rand()."'>"; } else { echo "<img src='includes/uploads/profiledefault.jpg'>"; } echo"</div>"; } } } } and I did this in my CSS div.user-container { // etc } if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL error'; } else { mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $resultCheck = mysqli_num_rows($result); if($resultCheck > 0) { while ($row = mysqli_fetch_assoc($result)) { $id = $row['user_id']; $sqlImg = "SELECT * FROM profileimg WHERE userid = ?;"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sqlImg)) { echo 'SQL error'; } else { mysqli_stmt_bind_param($stmt, "i", $id); mysqli_stmt_execute($stmt); $resultImg = mysqli_stmt_get_result($stmt); while ($rowImg = mysqli_fetch_assoc($resultImg)) { // echo "<div class ='user-container'>"; if ($rowImg['status'] == 0) { $filename = "includes/uploads/profile".$id."*"; $fileinfo = glob($filename); $fileext = explode(".", $fileinfo[0]); $fileactualext = $fileext[1]; echo "<img class='profile_picture' src='includes/uploads/profile'".$id.".".$fileactualext."?".mt_rand().">"; } else { echo "<img class='default_picture' src='includes/uploads/profiledefault.jpg'>"; } // echo"</div>"; } } } } Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559451 Share on other sites More sharing options...
piano0011 Posted July 9, 2018 Author Share Posted July 9, 2018 (edited) Apologies Macgyver! You are a right! Mmtuts made a mistake by not including a where statement in selecting a particular user. I guess everyone makes mistakes but that solves the problem... Love the Macgyver show by the way! I also found it hard to get things working with a div class for images as Barand pointed out. I should read more about how to use a div class but should I just avoid it for images? Most tutorials use it for images but with different elements inside it? Edited July 9, 2018 by piano0011 Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559454 Share on other sites More sharing options...
piano0011 Posted July 9, 2018 Author Share Posted July 9, 2018 This is interesting... I have chrome version 69 I think but it said that it is up to date but my CSS is not refreshing quick enough compared with IE. I don't even think it is refreshing at all because it has looked the same for the past few days. I am not sure if it is just my setting .. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559457 Share on other sites More sharing options...
piano0011 Posted July 9, 2018 Author Share Posted July 9, 2018 With regard to picture profile, I tried to upload certain pictures and some of them are displayed correctly but some are not. Is there a way that I can make all the pictures to be shown the right angle? Some of them are rotated to 180 degrees while some to 90 degrees... but some are shown correctly.... Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559460 Share on other sites More sharing options...
Barand Posted July 9, 2018 Share Posted July 9, 2018 Can you attach a few (3 with different rotations) images that exhibit this behavior Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559462 Share on other sites More sharing options...
piano0011 Posted July 9, 2018 Author Share Posted July 9, 2018 At the moment, I have just one picture that is not displaying correctly as shown below but most of them are ok. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559464 Share on other sites More sharing options...
Barand Posted July 9, 2018 Share Posted July 9, 2018 That's as much use as a chocolate teapot and not what was requested. Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559466 Share on other sites More sharing options...
piano0011 Posted July 9, 2018 Author Share Posted July 9, 2018 My apologies but I guess I shouldn't worry too much about this as this is the only picture that is out of place.. The rest are displayed okay... Quote Link to comment https://forums.phpfreaks.com/topic/307461-how-to-space-out-my-review-texts/page/2/#findComment-1559468 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.