Jump to content

andrew_biggart

Members
  • Posts

    363
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by andrew_biggart

  1. Any ideas anyone? im gonna jump out the window in aminute lol
  2. This is the new code i am using now. <?php session_start(); if (!isset($_SESSION['myusername'])) { header("location: under_construction.htm"); } ?> <?php include("config.php"); $Username = ($_SESSION["myusername"]); $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $sql = "UPDATE User_infoT SET Location='$Location', Fav='$Fav', Quote='$Quote', Interests='$Interests', Happy='$Happy', Sad='$Sad', Habits='$Habits', Music='$Music', Movie='$Movie', Website='$Website', Aboutme='$Aboutme', Whywe='$Whywe' WHERE Username='Username' LIMIT 1"; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { header("profile_edit.php"); } // close connection mysql_close(); ?> and this is the error i get on my screen now with this code. Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, root@server.microlite20.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. which is no help what so ever but the rest of my site is php and it works fine, the only bit i cant get to work is the edit profile bit
  3. ok i have added that lol that would help but it still isnt working grrrrrr <?php session_start(); if(!session_is_registered(myusername)){ header("location:under_construction.htm"); } ?> <?php include("config.php"); $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $sql = "UPDATE User_infoT SET Location='$Location', Fav='$Fav', Quote='$Quote', Interests='$Interests', Happy='$Happy', Sad='$Sad', Habits='$Habits', Music='$Music', Movie='$Movie', Website='$Website', Aboutme='$Aboutme', Whywe='$Whywe' WHERE Username='".$_SESSION["myusername"]."' LIMIT 1"; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { header("profile_edit.php"); } // close connection mysql_close(); ?>
  4. Ok ive been trying for days to ge this sorted and it is driving me up the walls please please please someone put me out of my missery lol. Im trying to do the edit profile section of my site, sounds simple enough when you have some php knowledge, so the page loads, all the current info is echoed in the correct input boxes no problem. This is the form page <table class="myprofile_change"> <tr><td class="myprofile_changesh">Edit Profile</td></tr> <tr><td class="myprofile_subtext2">Scroll down, complete the fields, then click Save Changes to update your profile. All of the following questions are optional, but you must answer a minimum of 5 to appear in our search results.</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">General Info ...</td></tr> </table> <form method="post" action="my_profile_edit_submit.php"> <?php include("config.php"); // Retrieve data from database $sql="SELECT * FROM User_infoT WHERE Username='".$_SESSION["myusername"]. "'"; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ ?> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Location :</td><td><input name="Location" id="Location" type="text" value="<? echo $rows['Location']; ?>" /></td></tr> <tr><td class="myprofile_subtext">Favourite smoking method :</td> <td><select name="Fav" id="Fav"style="width: 126px"> <option>Choose</option> <option>Joint</option> <option>Blunt</option> <option>Tulip</option> <option>Bong</option> <option>Lung</option> <option>Bucket</option></select></td></tr> <tr><td class="myprofile_subtext">Favourite quote :</td><td><input name="Quote" id="Quote"type="text" style="width: 246px" maxlength="50 "value="<? echo $rows['Quote']; ?>" /></td><td class="myprofile_max">Max 50 characters</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">About me ...</td></tr> </table> <br /> <table> <tr><td class="myprofile_subtext">About Yourself :</td><td rowspan="2"><textarea name="Aboutme" id="Aboutme" style="width: 415px; height: 135px"><? echo $rows['Aboutme']; ?></textarea></td></tr> <tr><td class="myprofile_max2">Use <br /> to separate paragraphs instead of using the return button</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Why do you love weed? :</td> <td rowspan="2"><textarea name="Whywe" id="Whywe" style="width: 415px; height: 135px" ><? echo $rows['Whywe']; ?></textarea></td></tr> <tr><td class="myprofile_max2">Use <br /> to separate paragraphs instead of using the return button</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">Personal info ...</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Interests :</td><td><input name="Interests" id="Interests" type="text" style="width: 246px" value="<? echo $rows['Interests']; ?>" /></td><td class="myprofile_max">Max 50 characters</td></tr> <tr><td class="myprofile_subtext">Makes me happy :</td><td><input name="Happy" id="Happy"type="text" style="width: 246px" value="<? echo $rows['Happy']; ?>"/></td><td class="myprofile_max">Max 70 characters</td></tr> <tr><td class="myprofile_subtext">Makes me sad :</td><td><input name="Sad" id="Sad"type="text" style="width: 246px" value="<? echo $rows['Sad']; ?>" /></td><td class="myprofile_max">Max 70 characters</td></tr> <tr><td class="myprofile_subtext">Bad habits :</td><td><input name="Habits" id="Habits"type="text" style="width: 246px" value="<? echo $rows['Habits']; ?>" /></td><td class="myprofile_max">Max 60 characters</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">Favourite things ...</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Music :</td><td><select id="Music"name="Music" style="width: 126px"> <option>Choose</option> <option>Dance</option> <option>RnB</option> <option>Funky House</option> <option>Indie</option> <option>Rock</option> <option>Electro</option> <option>Chillout</option> </select></td></tr> <tr><td class="myprofile_subtext">Movies :</td><td><input name="Movie" id="Movie"type="text" style="width: 246px" value="<? echo $rows['Movie']; ?>" /></td><td class="myprofile_max">Max 100 characters</td></tr> <tr><td class="myprofile_subtext">Website :</td><td><input name="Website" id="Website"type="text" style="width: 246px" value="<? echo $rows['Website']; ?>"/></td><td class="myprofile_max">No spamming</td></tr> <tr><td></td></tr> </table> <? // close while loop } // close connection mysql_close(); ?> <br /> <table> <tr><td class="myprofile_changesh">Save the changes to your profile ...</td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> <br /> <table class="myprofile_change"> <tr><td><input name="Submit1" type="submit" value="Change that shit !" /></td></tr> </table> <br /> <br /> <br /> <br /> <br /> <br /> </form> But when i the form is submitted, after changing loads of things trying everything i either get one of three results. 1. The form changes the information for every user to the updated information. 2. the classic blanc screen. 3. An internal server error. the php i am using to try to update the new information is as follows. <?php include("config.php"); $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $sql = "UPDATE User_infoT SET Location='$Location', Fav='$Fav', Quote='$Quote', Interests='$Interests', Happy='$Happy', Sad='$Sad', Habits='$Habits', Music='$Music', Movie='$Movie', Website='$Website', Aboutme='$Aboutme', Whywe='$Whywe' WHERE Username='".$_SESSION["myusername"]."' LIMIT 1"; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { header("profile_edit.php"); } // close connection mysql_close(); ?> I cannot seem to figure this out on my own and i hope i have explained it well enough to spot an error. Thanks for your help
  5. ok ive changed the form so it has 2 hidden inputs with username and password in it, because i dont want the user to able to change them on this page and i have changed the php to this but now im getting a server error.... which is "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, root@server.microlite20.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log." the changed php code is............ <?php include("config_members.php"); $Username = ($_POST['Username']); $Password = ($_POST['Password']); $Email = ($_POST['Email']); $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $sql = "UPDATE User_infoT SET Username='$Username', Password='$Password', Email='$Email', Location='$Location', Fav='$Fav', Quote='$Quote', Interests='$Interests', Happy='$Happy', Sad='$Sad', Habits='$Habits', Music='$Music', Movie='$Movie', Website='$Website', Aboutme='$Aboutme', Whywe='$Whywe' WHERE Username='".$_SESSION["myusername"]. "' "; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { echo"Error, Please try again insuring you have filled in all the required fields"; header("profile_edit.php"); } // close connection mysql_close(); ?>
  6. it just clears all records from the database is this better do u think? i have added a WHERE statment in there but im scared to try it incase it deletes all users again <?php include("config_members.php"); $Username = ($_POST['Username']); $Password = ($_POST['Password']); $Email = ($_POST['Email']); $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $sql = "UPDATE User_infoT WHERE Username='".$_SESSION["myusername"]. "' SET Username='$Username', Password='$Password', Email='$Email', Location='$Location', Fav='$Fav', Quote='$Quote', Interests='$Interests', Happy='$Happy', Sad='$Sad', Habits='$Habits', Music='$Music', Movie='$Movie', Website='$Website', Aboutme='$Aboutme', Whywe='$Whywe'"; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { echo"Error, Please try again insuring you have filled in all the required fields"; header("profile_edit.php"); } // close connection mysql_close(); ?>
  7. Ok im trying to make a simple update your profile information page and the problem i have is that when i try and update any of the information it completly wipes all of the users from my database. this is my form code. <table class="myprofile_change"> <tr><td class="myprofile_changesh">Edit Profile</td></tr> <tr><td class="myprofile_subtext2">Scroll down, complete the fields, then click Save Changes to update your profile. All of the following questions are optional, but you must answer a minimum of 5 to appear in our search results.</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">General Info ...</td></tr> </table> <form method="post" action="profile_edit_submit.php"> <?php include("config_members.php"); // Retrieve data from database $sql="SELECT * FROM User_infoT WHERE Username='".$_SESSION["myusername"]. "'"; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ ?> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Location :</td><td><input name="Location" id="Location" type="text" value="<? echo $rows['Location']; ?>" /></td></tr> <tr><td class="myprofile_subtext">Favourite smoking method :</td> <td><select name="Fav" id="Fav"style="width: 126px"> <option>Choose</option> <option>Joint</option> <option>Blunt</option> <option>Tulip</option> <option>Bong</option> <option>Lung</option> <option>Bucket</option></select></td></tr> <tr><td class="myprofile_subtext">Favourite quote :</td><td><input name="Quote" id="Quote"type="text" style="width: 246px" maxlength="50 "value="<? echo $rows['Quote']; ?>" /></td><td class="myprofile_max">Max 50 characters</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">About me ...</td></tr> </table> <br /> <table> <tr><td class="myprofile_subtext">About Yourself :</td><td rowspan="2"><textarea name="Aboutme" id="Aboutme" style="width: 415px; height: 135px"><? echo $rows['Aboutme']; ?></textarea></td></tr> <tr><td class="myprofile_max2">Use <br /> to separate paragraphs instead of using the return button</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Why do you love weed? :</td> <td rowspan="2"><textarea name="Whywe" id="Whywe" style="width: 415px; height: 135px" ><? echo $rows['Whywe']; ?></textarea></td></tr> <tr><td class="myprofile_max2">Use <br /> to separate paragraphs instead of using the return button</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">Personal info ...</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Interests :</td><td><input name="Interests" id="Interests" type="text" style="width: 246px" value="<? echo $rows['Interests']; ?>" /></td><td class="myprofile_max">Max 50 characters</td></tr> <tr><td class="myprofile_subtext">Makes me happy :</td><td><input name="Happy" id="Happy"type="text" style="width: 246px" value="<? echo $rows['Happy']; ?>"/></td><td class="myprofile_max">Max 70 characters</td></tr> <tr><td class="myprofile_subtext">Makes me sad :</td><td><input name="Sad" id="Sad"type="text" style="width: 246px" value="<? echo $rows['Sad']; ?>" /></td><td class="myprofile_max">Max 70 characters</td></tr> <tr><td class="myprofile_subtext">Bad habits :</td><td><input name="Habits" id="Habits"type="text" style="width: 246px" value="<? echo $rows['Habits']; ?>" /></td><td class="myprofile_max">Max 60 characters</td></tr> <tr><td></td></tr> </table> <br /> <table> <tr><td class="myprofile_changesh">Favourite things ...</td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Music :</td><td><select id="Music"name="Music" style="width: 126px"> <option>Choose</option> <option>Dance</option> <option>RnB</option> <option>Funky House</option> <option>Indie</option> <option>Rock</option> <option>Electro</option> <option>Chillout</option> </select></td></tr> <tr><td class="myprofile_subtext">Movies :</td><td><input name="Movie" id="Movie"type="text" style="width: 246px" value="<? echo $rows['Movie']; ?>" /></td><td class="myprofile_max">Max 100 characters</td></tr> <tr><td class="myprofile_subtext">Website :</td><td><input name="Website" id="Website"type="text" style="width: 246px" value="<? echo $rows['Website']; ?>"/></td><td class="myprofile_max">No spamming</td></tr> <tr><td></td></tr> </table> <? // close while loop } // close connection mysql_close(); ?> <br /> <table> <tr><td class="myprofile_changesh">Save the changes to your profile ...</td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> <br /> <table class="myprofile_change"> <tr><td><input name="Submit1" type="submit" value="Change that shit !" /></td></tr> </table> <br /> <br /> <br /> <br /> <br /> <br /> </form> and then this is the php i have used to change the information <?php include("config_members.php"); $Username = ($_POST['Username']); $Password = ($_POST['Password']); $Email = ($_POST['Email']); $Location = ($_POST['Location']); $Fav = ($_POST['Fav']); $Quote = ($_POST['Quote']); $Interests = ($_POST['Interests']); $Happy = ($_POST['Happy']); $Sad = ($_POST['Sad']); $Habits = ($_POST['Habits']); $Music = ($_POST['Music']); $Movie = ($_POST['Movie']); $Website = ($_POST['Website']); $Aboutme = ($_POST['Aboutme']); $Whywe = ($_POST['Whywe']); $sql = "UPDATE User_infoT SET Username='$Username', Password='$Password', Email='$Email', Location='$Location', Fav='$Fav', Quote='$Quote', Interests='$Interests', Happy='$Happy', Sad='$Sad', Habits='$Habits', Music='$Music', Movie='$Movie', Website='$Website', Aboutme='$Aboutme', Whywe='$Whywe'"; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ header("my_profile.php"); } else { echo"Error, Please try again insuring you have filled in all the required fields"; header("profile_edit.php"); } // close connection mysql_close(); ?> would i be best rewriting the code or can anyone spot any obvious errors? Thanks
  8. dont worry guys i have got it working now! it ended up being this <img src='../Profile_pics/". instead of this <img src='Profile_pics/". Thanks for all your help tho
  9. i dont understand whats going on to be honest ive used this on my old site and it worked fine so why wont it work on this one grrrrrrr
  10. Im trying to display profile pictures of each user from a database but the picture does not load up, when the page loads the td that holds the image goes to 100px x 100px but then back down to 0 again so its like its trying to display it and cant find it. Is this the correct way to display an image from a database? <? echo "<img src='Profile_pics/". $rows['Profile_picture'] . "' style='width:100px; height:100px;' />";?> the row the image names are held in the database is definitly called, Profile_picture and the folder where the images are held is called Profile_pics so i really dont know!! any ideas?
  11. someone else solved it for anyone else who cares hear is the solution. <div id="pagination"> <br /> <?php /* Place code to connect to your DB here. */ include('config_members.php'); // include your code to connect to DB. $tbl_name="User_infoT"; //your table name // How many adjacent pages should be shown on each side? $adjacents = 3; /* First get total number of rows in data table. If you have a WHERE clause in your query, make sure you mirror it here. */ $query = "SELECT COUNT(*) as num FROM $tbl_name"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; /* Setup vars for query. */ $targetpage = "page_test2.php"; //your file name (the name of this file) $limit = 4; //how many items to show per page $page = $_GET['page']; if($page) $start = ($page - 1) * $limit; //first item to display on this page else $start = 0; //if no page var is given, set start to 0 /* Get data. */ $sql = "SELECT Username, Location, Fav FROM $tbl_name ORDER BY User_id ASC LIMIT $start, $limit"; $result = mysql_query($sql); /* Setup page vars for display. */ if ($page == 0) $page = 1; //if no page var is given, default to 1. $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page > 1) $pagination.= "<a href=\"$targetpage?page=$prev\">« previous</a>"; else $pagination.= "<span class=\"disabled\">« previous</span>"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } } elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //close to end; only hide early pages else { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } } } //next button if ($page < $counter - 1) $pagination.= "<a href=\"$targetpage?page=$next\">next »</a>"; else $pagination.= "<span class=\"disabled\">next »</span>"; $pagination.= "</div>\n"; } ?> <?=$pagination?> <br /> <table style="width: 100%" cellspacing="0" cellpadding="0"> <tr> <?php $counter = 0; while($rows = mysql_fetch_array($result)) { ?> <td> <table> <tr><td class="profilepicture"><img class="profile_pic"alt="" src="../Profile_pics/admin_pp.jpg" width="100" height="100" /></td></tr> <tr><td class="proinfo"><? echo $rows['Username']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Location']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Fav']; ?></td></tr> </table> </td> <?php $counter++; if($counter == 4) { echo '</tr><tr>'; $counter = 0; } } for(; $counter != 4; $counter++) echo '<td></td>'; ?> </tr> </table> <br /> <?=$pagination?> </div>
  12. I use check boxs beside each entry but im sure it will be the same idea so hears the code i use.. The form <form method="post" action="profile_blog_delete.php?username=<? echo"".$_SESSION["myusername"]."" ?>"> <?php include("config_members.php"); // Retrieve data from database $sql="SELECT * FROM User_blogT WHERE Blog_username='".$_SESSION["myusername"]. "' ORDER BY Blog_id DESC" ; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ ?> <table class="myprofile_blog"> <tr><td class="myprofile_subtext">Subject :</td><td class="myprofile_blogsub"><? echo $rows['Blog_subject']; ?></td></tr> <tr><td class="myprofile_subtext" style="width: 120px" valign="top">Message :</td><td class="myprofile_blogtext"><? echo $rows['Blog_message']; ?></td></tr> <tr><td class="myprofile_subtext">Written on :</td><td class="myprofile_blogsub"><? echo $rows['Blog_date']; ?></td></tr> <tr><td class="myprofile_subtext">Delete entry :</td><td><input type="checkbox" name="checkbox[]" id="<?=$rows['Blog_id']?>" value="<?=$rows['Blog_id']?>" /></td></tr> </table> <br /> <br /> <? // close while loop } // close connection mysql_close(); ?> <br /> <table> <tr><td class="myprofile_changesh">Delete an entry from your Blog ...</td><td class="myprofile_changesh"> </td></tr> <tr><td class="myprofile_subsub">Make sure you tick the box of the entry&#39;s you want to delete before pressing the delete button otherwise it will not work.</td></tr> <tr><td colspan="2"></td></tr> </table> <br /> <table class="myprofile_change"> <tr><td><input name="perform" id="perform" type="submit" value="Delete that shit !" /></td></tr> </table> </form> the php <?php include("config_blog.php"); $username=$_GET['username']; if(!isset($_POST['perform'])){ } else { foreach($_POST['checkbox'] as $Blog_id) { // This will loop through the checked checkboxes $sql = "DELETE FROM User_blogT WHERE Blog_id='$Blog_id' LIMIT 1"; mysql_query($sql) or die(mysql_error()); header("location:profile_blog.php?username=$username"); } } mysql_close(); ?> hopefully this will help you get your head around what to do as im not to good with drop down menus
  13. surely someone can point me in the right direction seriously ???
  14. ok ive tried this solution but it just has four of the same user in a row instead of four different users in each row. Is there any easy way to solve this? <br /> <table style="width: 100%" cellspacing="0" cellpadding="0"> <tr> <td> <table> <tr><td class="profilepicture"><img class="profile_pic"alt="" src="../Profile_pics/admin_pp.jpg" width="100" height="100" /></td></tr> <tr><td class="proinfo"><? echo $rows['Username']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Location']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Fav']; ?></td></tr> </table> </td> <td> <table> <tr><td class="profilepicture"><img class="profile_pic"alt="" src="../Profile_pics/admin_pp.jpg" width="100" height="100" /></td></tr> <tr><td class="proinfo"><? echo $rows['Username']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Location']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Fav']; ?></td></tr> </table> </td> <td> <table> <tr><td class="profilepicture"><img class="profile_pic"alt="" src="../Profile_pics/admin_pp.jpg" width="100" height="100" /></td></tr> <tr><td class="proinfo"><? echo $rows['Username']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Location']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Fav']; ?></td></tr> </table> </td> <td> <table> <tr><td class="profilepicture"><img class="profile_pic"alt="" src="../Profile_pics/admin_pp.jpg" width="100" height="100" /></td></tr> <tr><td class="proinfo"><? echo $rows['Username']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Location']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Fav']; ?></td></tr> </table> </td> </tr> </table> <br />
  15. Does anyone know how i would go about recreating this effect? http://www.faceparty.com/browse/browse.aspx im using code something along the lines of this for single entrys but i want like four in a row. <?php include("config_members.php"); $sql="SELECT * FROM User_infoT "; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <table style="width: 100%" cellspacing="0" cellpadding="0"> <tr><td class="proinfo"><? echo $rows['Profile_pic']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Username']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Location']; ?></td></tr> <tr><td class="proinfo"><? echo $rows['Fav']; ?></td></tr> </table> <? // close while loop } // close connection mysql_close(); ?> But how would i go about coding it so that each row has four of these tables in the while loop? Thanks in advance
  16. When i click on the link to say homepage.php an i have used the above code in the like, it will display hopepage.php?username=(blank) but i know my seasons are working because the pages are protected like this. <?php session_start(); if(!session_is_registered(myusername)){ header("index.php"); } ?> my check login page is usuing this code and i know it is definitly creating the right season. <?php include("config_members.php"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $row = mysql_fetch_assoc($result); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file session_register("myusername"); session_register("mypassword"); $_SESSION['myusername'] = $myusername; header("location:my_profile.php?username=$myusername"); exit(); } else { echo "<h1 class=login_status>Wrong Username or Password</h1>"; } ?> and when a user logs in there are automatically redirected to the myprofile.php page where which uses this code to display the profile. <?php include("config_members.php"); $username=$_GET['username']; // Retrieve data from database $sql="SELECT * FROM User_infoT WHERE Username='$username'"; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ ?> <table class="login_table" cellspacing="0" cellpadding="0"> <tr><td class="profilepicture"><img class="profile_pic"alt="" src="../Profile_pics/admin_pp.jpg" width="100" height="100" /></td></tr> <tr><td class="myprofile_welcome">Hi, <?php if(isset($_SESSION['myusername']) == True) { echo " ".$_SESSION["myusername"]. " ";} else {} ?></td> </tr> <tr><td></td></tr> <tr><td class="myprofile_welcomeback">Welcome to the weloveweed mansion.</td></tr> <tr><td class="myprofile_welcomeback">Make sure & stick to the rules & most of all have fun.</td></tr> </table> </div> <div id="new_recipes_header" style="left: 0px; top: 0px"> <h1 class="procats" style="font-weight: normal">Personal Info</h1> </div> <div id="new_recipes"> <table style="width: 100%" cellspacing="0" cellpadding="0"> <tr><td class="proinfo_h">Interests</td></tr> <tr><td class="proinfo"><? echo $rows['Interests']; ?></td></tr> <tr><td class="proinfo_h">Makes me happy</td></tr> <tr><td class="proinfo"><? echo $rows['Happy']; ?></td></tr> <tr><td class="proinfo_h">Makes me sad</td></tr> <tr><td class="proinfo"><? echo $rows['Sad']; ?></td></tr> <tr><td class="proinfo_h">Bad Habits</td></tr> <tr><td class="proinfo"><? echo $rows['Habits']; ?></td></tr> </table> </div> <div id="new_members"> <h1 class="procats" style="font-weight: normal">Favourite Things</h1> <table style="width: 100%" cellspacing="0" cellpadding="0"> <tr><td class="proinfo_h">Music</td></tr> <tr><td class="proinfo"><? echo $rows['Music']; ?></td></tr> <tr><td class="proinfo_h">Movie</td></tr> <tr><td class="proinfo"><? echo $rows['Movie']; ?></td></tr> <tr><td class="proinfo_h">Website</td></tr> <tr><td class="proinfo"><a class="profile_site" href="<? echo $rows['Website']; ?>">click hear to view</a></td></tr> </table> <br /> </div> but i want to be able to put the username like this myprofile.php?username=(season myusername) so that i can put it there at anytime and by usuing the season one for like posting comments replies etc etc hopefully this explains it alot better, i am a beginer so sorry for my lack of experience lol
  17. Ok i know this is a simple problem but its really doing my head in aghhhh... for all my page links i want the url to be test.php?username=seasonusername its really pissing me off ive tried it ways like this test.php?username=<?php echo " ".$_SESSION["myusername"]. " "; ?> but i just cant get it to work please help
  18. Thanks for trying to help but to my surprise i actually got it working whop i can sleep well now hahha To anyone thats having the same problem or is intrested this is how i did it.... <?php /* Place code to connect to your DB here. */ include('config_members.php'); // include your code to connect to DB. $tbl_name="User_recipesT"; //your table name // How many adjacent pages should be shown on each side? $adjacents = 3; /* First get total number of rows in data table. If you have a WHERE clause in your query, make sure you mirror it here. */ $query = "SELECT COUNT(*) as num FROM $tbl_name"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; /* Setup vars for query. */ $targetpage = "page_test.php"; //your file name (the name of this file) $limit = 1; //how many items to show per page $page = $_GET['page']; if($page) $start = ($page - 1) * $limit; //first item to display on this page else $start = 0; //if no page var is given, set start to 0 /* Get data. */ $sql = "SELECT Recipe_id, Recipe_username, Recipe_date, Recipe_subject, Recipe_content, Recipe_ingre FROM $tbl_name LIMIT $start, $limit"; $result = mysql_query($sql); /* Setup page vars for display. */ if ($page == 0) $page = 1; //if no page var is given, default to 1. $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page > 1) $pagination.= "<a href=\"$targetpage?page=$prev\">« previous</a>"; else $pagination.= "<span class=\"disabled\">« previous</span>"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } } elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //close to end; only hide early pages else { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } } } //next button if ($page < $counter - 1) $pagination.= "<a href=\"$targetpage?page=$next\">next »</a>"; else $pagination.= "<span class=\"disabled\">next »</span>"; $pagination.= "</div>\n"; } ?> <?=$pagination?> <table> <tr><td class="newmain"> <br /> <?php while($rows = mysql_fetch_array($result)) { ?> <table> <tr><td><h1 class="new_up">Uploaded by :</h1></td><td><h1 class="new_up"><a href="profile.php?username=<? echo $rows['Recipe_username']; ?>"><? echo $rows['Recipe_username']; ?></a> on <? echo $rows['Recipe_date']; ?> </h1></td></tr> </table> <br /> <br /> <table style="width: 100%"> <tr><td><img alt="Cooking cannabis : Cannabis recipes title" src="../Header_images/recipe_title.jpg" width="130" height="35" /></td></tr> <tr><td></td></tr> <tr><td class="recipe_title"><a href="recipes_view.php?id=<? echo $rows['Recipe_id']; ?>"><? echo $rows['Recipe_subject']; ?></a></td></tr> </table> <br /> <br /> <table> <tr><td><img alt="cooking cannabis : weed recipe ingredients" src="../Header_images/recipe_ingre.jpg" width="278" height="38" /></td></tr> <tr><td></td></tr> <tr><td class="recipe_ingre"><? echo $rows['Recipe_ingre']; ?></td></tr> </table> <br /> <br /> <table> <tr><td><img alt="cooking weed : cannabis recipes method" src="../Header_images/recipe_method.jpg" width="188" height="43" /></td></tr> <tr><td></td></tr> <tr><td class="recipe_method"><? echo $rows['Recipe_content']; ?></td></tr> </table> <?php } ?> <br /> </td></tr> </table> <br /> <?=$pagination?>
  19. i know its a silly idea trying to do this at this time of the night but im nearly there, ive found a good tutorial and ive got it working abit. It knows how many records it needs to display as it showing the correct number of pages, but im having trouble getting it to display the specific info i want. Pagination code <?php /* Place code to connect to your DB here. */ include('config_members.php'); // include your code to connect to DB. $tbl_name="User_recipesT"; //your table name // How many adjacent pages should be shown on each side? $adjacents = 3; /* First get total number of rows in data table. If you have a WHERE clause in your query, make sure you mirror it here. */ $query = "SELECT COUNT(*) as num FROM $tbl_name"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; /* Setup vars for query. */ $targetpage = "page_test.php"; //your file name (the name of this file) $limit = 4; //how many items to show per page $page = $_GET['page']; if($page) $start = ($page - 1) * $limit; //first item to display on this page else $start = 0; //if no page var is given, set start to 0 /* Get data. */ $sql = "SELECT Recipe_id Recipe_username Recipe_subject Recipe_content Recipe_ingre FROM $tbl_name LIMIT $start, $limit"; $result = mysql_query($sql); /* Setup page vars for display. */ if ($page == 0) $page = 1; //if no page var is given, default to 1. $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page > 1) $pagination.= "<a href=\"$targetpage?page=$prev\">« previous</a>"; else $pagination.= "<span class=\"disabled\">« previous</span>"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } } elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //close to end; only hide early pages else { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } } } //next button if ($page < $counter - 1) $pagination.= "<a href=\"$targetpage?page=$next\">next »</a>"; else $pagination.= "<span class=\"disabled\">next »</span>"; $pagination.= "</div>\n"; } ?> <?php while($row = mysql_fetch_array($result)) { } ?> <?=$pagination?> and i would like each piece of info to be displayed in a table like this. <table> <tr><td class="newmain"> <table> <tr><td><h1 class="new_up">Uploaded by :</h1></td><td><h1 class="new_up"><a href="profile.php?username=<? echo $rows['Recipe_username']; ?>"><? echo $rows['Recipe_username']; ?></a> on <? echo $rows['Recipe_date']; ?> </h1></td></tr> </table> <br /> <br /> <table style="width: 100%"> <tr><td><img alt="Cooking cannabis : Cannabis recipes title" src="../Header_images/recipe_title.jpg" width="130" height="35" /></td></tr> <tr><td></td></tr> <tr><td class="recipe_title"><a href="recipes_view.php?id=<? echo $rows['Recipe_id']; ?>"><? echo $rows['Recipe_subject']; ?></a></td></tr> </table> <br /> <br /> <table> <tr><td><img alt="cooking cannabis : weed recipe ingredients" src="../Header_images/recipe_ingre.jpg" width="278" height="38" /></td></tr> <tr><td></td></tr> <tr><td class="recipe_ingre"><? echo $rows['Recipe_ingre']; ?></td></tr> </table> <br /> <br /> <table> <tr><td><img alt="cooking weed : cannabis recipes method" src="../Header_images/recipe_method.jpg" width="188" height="43" /></td></tr> <tr><td></td></tr> <tr><td class="recipe_method"><? echo $rows['Recipe_content']; ?></td></tr> </table> <br /> <br /> </td></tr> </table> <br /> where do i put this table? im confused lol any help would be appreciated thanks
  20. Ok i know supid fucking idea attempting pageina
  21. Thanks for your help firstly... ive tried this but i still have the same problem <?php include("config_members_temp.php"); $recipe_username=$_GET['username']; $recipe_title = ($_POST['recipe_title']); $recipe_ingre = ($_POST['recipe_ingre']); $recipe_method = ($_POST['recipe_method']); $recipe_cat = ($_POST['recipe_cat']); if(isset($_POST['Sumbit1'])){ $sql = "INSERT INTO User_recipesT ( Recipe_username, Recipe_subject, Recipe_content, Recipe_ingre, Recipe_cat ) VALUES( '$recipe_username', '$recipe_title', '$recipe_method', '$recipe_ingre', '$recipe_cat' )"; $result=mysql_query($sql) or die(mysql_error().": $sql");} if($result){ echo "Your recipe has been successfully to our database"; } // if not found else { echo "Ops there has been a problem please go back and try again!"; } ?>
  22. I know ive already posted this tonite so sorry but ive been at work and i cant find the post anywere lol But anyway what i want to do is on my form_page.php i dont want the code to run until the submit button has been pressed so that it does not submit empty data into the database as soon as the page loads, im sure theres a simple if statement but my pickled head can think atm lol. Im usuing this code. <div id="page_content_topic"> <table class="myprofile_change"> <tr><td class="myprofile_changesh"> <tr><td class="reg_status"> <?php include("config_members_temp.php"); $recipe_username=$_GET['username']; $recipe_title = ($_POST['recipe_title']); $recipe_ingre = ($_POST['recipe_ingre']); $recipe_method = ($_POST['recipe_method']); $recipe_cat = ($_POST['recipe_cat']); $sql = "INSERT INTO User_recipesT ( Recipe_username, Recipe_subject, Recipe_content, Recipe_ingre, Recipe_cat ) VALUES( '$recipe_username', '$recipe_title', '$recipe_method', '$recipe_ingre', '$recipe_cat' )"; $result=mysql_query($sql) or die(mysql_error().": $sql"); if($result){ echo "Your recipe has been successfully to our database"; } // if not found else { echo "Ops there has been a problem please go back and try again!"; } ?> </td></tr> </td></tr> </table> <form method="post" action="upload_recipe_submit.php?username=<? echo"".$_SESSION["myusername"]."" ?>"> <table class="myprofile_change"> <tr><td class="myprofile_changesh"> <img alt="Cooking cannabis : add a recipe" src="../Header_images/addrecipe.jpg" width="156" height="46" /></td></tr> <tr><td class="myprofile_subtext2">You are about to add a recipe to the weloveweed mansions achieve. Make sure that your recipe is as sensible as possible without being to dull. Even if its a recipe you have just made up and think that tastes good, add it anyway because other members might like it as well. Once your recipe has been submitted it may take 24hrs to show up as it has to be approved by one of our team.</td></tr> <tr><td></td></tr> </table> <br /> <table class="myprofile_change"> <tr><td class="myprofile_subtext">Recipe Title :</td><td class="style3"> <input name="recipe_title" type="text" /></td><td class="myprofile_max">Max 200 characters</td></tr> <tr><td class="myprofile_subtext">Recipe cat :</td><td class="style3"> <select name="recipe_cat" id="Fav"style="width: 126px"> <option>Choose</option> <option>Snack recipes</option> <option>Starter recipes</option> <option>Main course recipes</option> <option>Desert recipes</option> <option>Miscellaneous recipes</option> </select></td><td class="myprofile_max">Please select one</td></tr> <tr><td class="myprofile_subtext">Recipe ingredients :</td> <td class="style3"> <textarea name="recipe_ingre" style="width: 355px; height: 76px"></textarea></td><td class="myprofile_max">Max 400 characters<br /> Use <br /> to separate each ingredient.</td></tr> <tr><td class="myprofile_subtext">Recipe method :</td><td class="style3"> <textarea name="recipe_method" style="width: 355px; height: 190px" cols="20"></textarea></td><td class="myprofile_max"> Max 800 characters</td></tr> <tr><td></td></tr> <tr><td></td><td></td><td><input name="Reset1" type="reset" value="reset" /><input name="Submit1" type="submit" value="add that shit !" /></td></tr> <tr><td></td></tr> </table> <br /> </form> </div> Thanks in advance
  23. try going on joomla.com and downloading one of the components they have on there for the contact forms, ive used them before without having to do very much
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.