ibz786
Members-
Posts
29 -
Joined
-
Last visited
Profile Information
-
Gender
Male
-
Location
London
ibz786's Achievements
Newbie (1/5)
0
Reputation
-
Hi there guys Basically im trying to call images from my SQL DB (which is fine) and im trying to echo them out using a while loop (which is also fine) <?php $getSize = mysql_query("SELECT image_location FROM size_chart WHERE prod_size_id = $GET_ID"); while($chart = mysql_fetch_array($getSize)) { ?> <a href="<?php echo $chart ?>"><img src="<?php echo $chart ?>" width="200px" height="200px" /></a> <?php } ?> So in turn my results display 200 x 200 images of whatever im trying to call from my DB However i wish to display it as that from my array loop, i wish for the first picture to be 200 x 200 then the rest are 100 x 100 If anyone can please help me i would be most grateful Thank You
-
In the words of Doc Brown from, Back to the Future "Great Scott!!" I think that code has fixed it I am very grateful for yours and everyone's help, very much appreciated Thank You very much Just a question, how did you figure it out? I ask since i wish to better my PHP coding skills
-
this is: users.php <?php include ('includes/connect.php'); session_start(); $query = mysql_query("SELECT * FROM users WHERE id = " . $_SESSION['user'] . ""); $user = mysql_fetch_assoc($query) ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <div id="banner" style="background-color:#000000"> <img src="images/logo.png"> <form id="searchbox" action="#" method="post"> <input type="text" id="search" name="search" value=""> <input type="submit" id="submit" name="submit" value="Search"> </form> <a href="home.php"> Home | </a> <a href="profile.php?id=<?php echo $user['id']; ?>"> Profile | </a> <a href="#"> Messages | </a> <a href="settings.php"> Settings | </a> <a href="users.php"> Users | </a> <a href="logout.php"> Sign Out </a> </div> <div> <?php $members = mysql_query("SELECT * FROM users"); while($allusers = mysql_fetch_assoc($members)) { echo "<table> <tr> <td> <a href=\"profile.php?id=" . $allusers['id'] . "\">" . $allusers['fullname'] . "</a> </td> </tr> </table>"; } ?> </div> </body> </html> So basically what im trying to do here is when i hover the usernames which are links they say: localhost/sblog/profile.php?id=1 or 2 or 3 depending on their links etc So when i click on the links i want them to take me to the users profile which i have clicked on and not my own Hope that makes sense
-
Ok to the profile.php file i have added this <?php include('includes/connect.php'); session_start(); if ($_GET['user'] != "") { $query = mysql_query("SELECT * FROM users WHERE id = " . $_GET['user'] . ""); } else { $query = mysql_query("SELECT * FROM users WHERE id = " . $_SESSION['user'] . ""); } $user = mysql_fetch_assoc($query) ?> The $_GET bit doesnt work I understand that the $_SESSION['user'] shall allow for me to get the logged in users profile But i I dont know how to grab other users profile using the $_GET method, if someone could help i would be grateful Thank You
-
hi sorry i passed last night lol was rather tired This is my profile.php code 17261_.php
-
Erm unfortunately that code didnt work In addition i dont understand it, hmm im rather stuck at the moment :/
-
Hey, thanks for that i shall try it. Just to quickly ask, the code you have posted do i put that in profile.php? My apologies for the confusion Ok heres what i mean: in home.php the page is operating under the session of the currently logged in user, e.g. id = 1 is John Doe for example using the code i have for home.php i can access John Doe's profile since his id matches that of the users database I created users.php to display all the users as links, so if i wish to view their profile all i need to do is click on them when i hover over the user names, their id value appears e.g. profile.php?id=3 profile.php?id=4 etc However due to an error in profile.php i can only access the logged in users profile My apologies if i repeating myself or not making sense i haven't had much sleep lol
-
Hi, for my coursework i need to make a microblogging website, similar to that of Twitter I have created a MySQL Database, and also the login and registration forms I am able to log in as a user and also change user submitted information i.e. Name, About Me etc The problem i am having is that when i access the logged in users profile page e.g. John Doe, i can access it fine However, when i wish to access say James Smith or any other user, i am redirected back to John Doe's profile login.php $query = mysql_query("SELECT * FROM users WHERE username = '$user'") or die(mysql_error()); $login = mysql_fetch_array($query); if(md5($pass) == $login['password']) { $_SESSION['user'] = $login['id']; header("Location: home.php"); } home.php <?php include ('includes/connect.php'); session_start(); $query = mysql_query("SELECT * FROM users WHERE id = " . $_SESSION['user'] . ""); $user = mysql_fetch_assoc($query) ?> <a href="profile.php?id=<?php echo $user['id']; ?>"> Profile | </a> users.php <?php include ('includes/connect.php'); session_start(); $query = mysql_query("SELECT * FROM users WHERE id = " . $_SESSION['user'] . ""); $user = mysql_fetch_assoc($query) ?> <?php $members = mysql_query("SELECT * FROM users"); while($allusers = mysql_fetch_assoc($members)) { echo "<table> <tr> <td> <a href=\"profile.php?id=" . $allusers['id'] . "\">" . $allusers['fullname'] . "</a> </td> </tr> </table>"; } ?> In all honesty i do know that the fault lies with the $_SESSION bit of the code since everything i do will only access the profile of the user who is logged in However i dont know how i am able to allow the logged in user to access their own profile as well as view other people's profile. Another problem is how do i follow users? I have a table called 'follow' I have two columns, user_id and follower_id, both being foreign keys However i honestly dont understand how to use PHP code to make users follow each other If anyone could assist me with any part of this i would be very grateful Thank You
-
Hi guys, i have not started this as of yet, however i will be given a project to make a micro-blogging website similar to that of Twitter or Facebook but obviously on a much smaller scale I have been searching on google however i have not found anything. Maybe i haven't been using the right words in my query, not sure :-/ I have been trying to do some research, however i can't seem to find how to incorporate @ tags found in Twitter / Facebook. e.g. If i want to tag a person in a Status Update: Hey @John Smith, Football in the park at 3pm? If anyone is able to help i would be grateful Thank You
-
Hi, flolam Thanks for all your help i really appreciate it The code works enough for me to be satisfied with it, your efforts are much appreciated it, Thank you very much All the best to you
-
Yeah sorry i realised that straight after i posted that my aplogies, been a long day Ok now what happens is that ive got the code to increment the house visits by one, however, it doesnt overwrite e.g. 4 (for house one) to 5, i just creates a whole new line :s
-
Ok ive made the code to work slightly: It has indeed incremented it, by one however i have a few errors, i have uploaded a picture of the error My current code is: <?php if (isset($_POST['mybox'])) { $filename = "houses2.txt"; $fileOpen = fopen($filename, "a"); $visit = $_POST['mybox']; $rowsArr = file ($filename); foreach ($rowsArr as $row) { $lineDetails = $row; $item_array = explode (",", $row); $newVisit = $item_array[3]+=1; $fileText = "Number of Visits - " . $newVisit . "<br>"; echo("Post Code - " . $item_array[0]. "<br>"); echo("Price - " . $item_array[1]. ",000 <br>"); echo("Picture - " . $item_array[2]. "<br>"); echo("Number of Visits - " . $item_array[3]. "<br>"); echo("<br>"); fwrite($fileWrite, $fileText); } fclose($fileOpen); } ?> Not sure where im going wrong :S [attachment deleted by admin]
-
My apologies, I tried changing that however, the problem remains the same, it doesnt seem to replace 4 with 5 (for the first property) I just seems to overwrite the whole txt file and leaves it blank Not sure what to do here really :/
-
Hi i tried that: echo("Picture - " . $item_array[2]. "<br>"); echo("Number of Visits - " . $item_array[3] += 1 . "<br>"); unfortunately it didnt work :S I may have not put it in the right area, but still not sure :/ Edit: Also i have realised that when i write "houses2.txt" Instead of updating the number of visits, the whole file becomes blank :S
-
Indeed, its part of my coursework I know for a fact that all that i am doing would be so much easier via an SQL Database, and i have more of an idea on how to do it on there since arrays as such wouldnt be needed etc ... However our lecturer wants to read it from a text file which is really troublesome