
dean7
Members-
Posts
309 -
Joined
-
Last visited
Everything posted by dean7
-
Not completely sure what your saying, but basicly I've got something like this at the mintue: Subject Content DateLike But when the User has liked the News post, I'd like the "Like" to changed to "Dislike" so they can dislike the news post if wished later on, but I can only get it to show Like untill they click it then it says Dislike.
-
Thanks for your replys, and that has helped me code it , although I seem to have one problem which I can't find a way of getting around.. I have a new Table in my Database which holds what Uses have pressed the Like button , like stated above, although I'm trying todo it so if they have already pressed like it will show them the dislike button rather than the like button. I've got: if ($Username == $Likeobj->username){ $LikeMe = "<td class='UnderTable' align='center' width='10%'><a href='?unlike=".$update[id]."' title='Unlike This News Post?'>Unlike</a></td>"; }elseif ($Username != $LikeObj->username){ $LikeMe = "<td class='UnderTable' align='center' width='10%'><a href='?like=".$update[id]."' title='Like This News Post?'>Like</a></td>"; } Although that's only showing them the Unlike button once they have already pressed the Like button. Any other ways on doing this? Thanks
-
Hey all, I've coded a news system in which on that I want to have something where Users can "Like" or "Dislike" the News Post - Abit like Facebook with the Liking. But theres a few questions which I'm not sure of : - How would I store the Users that have pressed the "like" or "dislike" button in the Database? - also what would be the best idea on selecting the user from the Database to show who has Like or Disliked it. Thanks for any help given.
-
Not being funny or nothing , but If I give you the Tables to the code and you find the Error it isn't really helping me learn what Error I have and how you found it.
-
Hey all, I'm working on a Market script for my game site but I've came across an Error.. Market.php: <?php session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); // Grab the Users information. $userinfo = "SELECT * FROM users WHERE username = '$username' LIMIT 1"; $userinfos = mysql_query($userinfo) or die ("Error in Query: Line 11" . mysql_error()); $fetchuser = mysql_fetch_object($userinfos); // Grab the users Garage so they can add Cars onto the Market.. $usergarage = "SELECT * FROM garage WHERE owner = '$username' LIMIT 1"; $usergarages = mysql_query($usergarage) or die ("Error in Query: Line 17" . mysql_error()); $garageuser = mysql_fetch_object($usergarages); // If they want to view the Cars stats: if (strip_tags($_GET['vcstats'])){ $vcstats = strip_tags($_GET['vcstats']); $marketqu = "SELECT * FROM market WHERE type = 'car'"; $doqut = mysql_query($marketqu) or die ("Error in Query: Line 186: " . mysql_error()); $objmarket = mysql_fetch_object($doqut); $caridfrommarket = $objmarket->carid; $getthecar = "SELECT * FROM garage WHERE id='$caridfrommarket' LIMIT 1"; $carinfo = mysql_query($getthecar) or die ("Error in Query: Line 192 " . mysql_error()); $carstats = mysql_fetch_object($carinfo); $cid = $carstats->id; $mph = $carstats->mph; $fuel = $carstats->fuel; $value = $carstats->value; $currentowner = $carstats->owner; $nameofcar = $carstats->car; $miles = $carstats->miles; $pic = $carstats->pic; // Lets show the Stats $nos = $carstats->nos; $engine = $carstats->engine; $transmission = $carstats->transmission; $exhaust = $carstats->exhaust; $breaks = $carstats->brakes; $suspension = $carstats->suspension; // Accessiours side $body = $carstats->body; $interior = $carstats->interior; $amp = $carstats->amp; $alloys = $carstats->alloys; $neons = $carstats->neons; $taillights = $carstats->taillights; // Showing the Table in which it will display the Car Information on. echo ("<table width='50%' cellpadding='0' cellspacing='0' border='1' align='center' class='table'> <tr> <td class='header' align='center' colspan='4'>".$nameofcar." (".$cid.")</td> </tr> <tr> <td colspan='4' align='center'><img src='".$pic."'></img> </td> </tr> <tr> <td class='omg' colspan='4'>Performance</td> </tr> <tr> <td>Nos:</td><td>".$nos."</td><td>Engine:</td><td>".$engine."</td> </tr> <tr> <td>Transmission:</td><td>".$transmission."</td><td>Exhaust:</td><td>".$exhaust."</td> </tr> <td>Breaks:</td><td>".$breaks."</td><td>Suspension:</td><td>".$suspension."</td> </tr> <tr> <td colspan='4' class='omg'>Accessorys:</td> </tr> <tr> <td>Body:</td><td>".$body."</td><td>Interior:</td><td>".$interior."</td> </tr> <tr> <td>Amp:</td><td>".$amp."</td><td>Alloys:</td><td>".$alloys."</td> </tr> <tr> <td>Neons:</td><td>".$neons."</td><td>Taillights:</td><td>".$taillights."</td> </tr> <tr> <td>Miles:</td><td>".number_format($miles)."</td><td>Value:</td><td>".$value."</td> </tr> <tr> <td>Fuel:</td><td>".$fuel."</td><td>MPH:</td><td>".$mph."</td> </tr> <tr> <td class='omg'>Owner:</td><td class='omg'><a href='profile.php?viewuser=".$currentowner."'>".$currentowner."</a></td><td class='omg'>Worth:</td><td class='omg'>£".number_format($value)."</td> </tr> </table> <br />"); // Continue soon, lets get the things showing like the Table first! } ?> <form action="" method="GET" name="TheForm"> <table width="50%" cellpadding="0" cellspacing="0" border="1" align="center" class="table"> <tr> <td class="header" align="center" colspan="5">Cars For Sale</td> </tr> <tr> <td>Car Name:</td><td>View Stats:</td><td>Price:</td><td>Buy It Now:</td><td>Cancle</td> <tr> <?php $carsforsale = mysql_query ("SELECT * FROM market WHERE type = 'car'") or trigger_error ("Error in Query: 329 Line " . mysql_error()); while ($cfs = mysql_fetch_object($carsforsale)){ $number = mysql_num_rows($carsforsale); $priceofauc = $cfs->startingprice; // An seller of the car: if ($username == $cfs->owner){ $calowner = "<a href='?cauction=$cfs->id'>Cancle Auction</a>"; } $newid = $cfs->carid; // Lets attempt to get the Cars name rather than the ID. $carnameis = "SELECT * FROM garage WHERE id = '$newid'"; $namecar = mysql_query($carnameis) or die ("Error in Query: Line 255 " . mysql_error()); $aye = mysql_fetch_object($namecar); $Testingthis = $cfs->carid; echo ('<td>'.$aye->car.'</td><td><a href="?vcstats='.$aye->id.'">View Stats</a></td><td>£'.number_format($priceofauc).'</td><td><a href="?buyitnow='.$cfs->id.'">Buy It Now</a></td><td>'.$calowner.'</td></tr><tr>'); } ?> </td> </tr> </table> </form> <br /> In that part of the code, I've tried coding it so when the click the link displaying the Car for sale it will show them the car stats , although... When they do click on the "View Stats" link it only displays the car stats which is on top of the list. For Example: Car Name: || View Stats: || Buy it now: || ID: || Cancle ---------------------------------------------------------------- Evo : || ViewStats || Buy it now || 1 || Cancle Mini : || ViewStats || Buy it now || 2 || Cancle So on that example with my code working how it is now it would only show the Stats for the Evo which has the ID of 1 even if the Mini (ID 2) is clicked. Is there something I've done wrong in my code which is making it only show the top cars stats? Thanks for any help given
-
I didn't get anything outputted. Didn't do anything when I added it into the code
-
Hey all, I'm currently coding a Few Blacklists for my Website, in which I want to code it so I'll have all blacklists on one page so the URL would be like: localhost/blacklist.php?user localhost/blacklist.php?staff I've got a Blacklist coded which all works well, just I've attempted using the $_GET function to change the code to the blacklist that they clicked on... <?php session_start(); include ("includes/config.php"); include ("includes/functions.php"); logincheck(); $Username = $_SESSION['username']; ?> <table width='50%' cellpadding='0' cellspacing='0' border='1' class='table' align='center'> <tr> <td class='header' align='center' colspan='4'>Other Blacklists:</td> </tr> <tr> <td align='center'><a href='?user' target='mainFrame'>User Blacklist</a></td><td align='center'><a href='?money' target='mainFrame'>Most Money</a></td><td align='center'><a href='?racewins.php' target='mainFrame'>Race Wins</a></td><td align='center'><a href='?racelose' target='mainFrame'>Race Loses</a></td> </tr> <tr> <td align='center'><a href='?miles' target='mainFrame'>Most Miles</a></td><td align='center'><a href='?fosbl' target='mainFrame'>Faster Or Slower</a></td><td align='center'><a href='?police' target='mainFrame'>Police Chase</a></td> </tr> </table> <br /> <table width='20%' cellpadding='0' cellspacing='0' border='1' class='table' align='center'> <tr> <td colspan='2' align='center' class='header'>User Blacklist:</td> </tr> <tr> <td align='center' class='omg' width='5%'>Num:</td><td align='center' class='omg' width='10%'>Username:</td> </tr> <?php if ($_GET['user']){ $Query = mysql_query("SELECT * FROM users WHERE userlevel = '1' OR userlevel = '5' ORDER BY rep DESC LIMIT 25"); for ($Place < 25; $This = mysql_fetch_object($Query){ $Place = $Place+1; if ($This->username != $Username){ $Colour = "bgcolor=#424242"; }else{ $Colour = "bgcolor=#111111"; } print ("<tr><td width='5%' align='center' $Colour>$Place</td><td width='20%' align='center' $Colour><a href='profile.php?viewuser=".$This->username."'>$This->username</a></td></tr>"); } } ?> </table> <br /> Soon as I added the $_GET['user]{ it stopped showing the Blacklist completely. Sorry if it wasn't explained well, but hopefully you can catch what I'm trying to-do Thanks.
-
Yeah when I echoed them I didn't get any errors, so must all be right? :-\
-
Yes I have Error Reporting on and its not displaying any errors, and yeah I've also tried echoing out the SQL Queries and its still not displaying no errors - Unless I'm doing something wrong along the line somewhere.
-
Hey all, I'm coding a script for my website which simply updates there profile though the Owners CP. I have manged to get it to show the information on the profile, but when I click the Update button it doesn't update there profile... <?php session_start(); header("Cache-control: private"); include "../../includes/config.php"; include "../../includes/functions.php"; logincheck(); $userlevel = mysql_query("SELECT userlevel FROM users WHERE username='$username'"); $userlevel1 = mysql_fetch_object($userlevel); if ($userlevel1->userlevel == 1){ header("Location: 404.php"); }elseif ($userlevel1->userlevel >= 2){ if ((strip_tags(addslashes($_POST['view']))) || strip_tags(addslashes($_POST['subby']))){ $user = strip_tags(addslashes($_POST['view'])); // Lets make sure the User is Real... $check = mysql_query("SELECT * FROM users WHERE username = '$user'"); $checknum = mysql_num_rows($check); $checkobj = mysql_fetch_object($check); if ($checknum == "0"){ echo ("<table width='30%' cellpadding='0' cellspacing='0' border='1' align='center' class='table'> <tr> <td class='e_header' align='center'>Error</td> </tr> <tr> <td align='center'>No Such User!</td> </td> </table> <br /> "); }elseif ($checknum != "0"){ if ((strip_tags(addslashes($_POST['newcon'])) && strip_tags(addslashes($_POST['conn'])))){ $conn = strip_tags($_POST['conn']); mysql_query ("UPDATE users SET quote='$conn' WHERE username='$user'") or die ("Error Updating Profile" . mysql_error()); mysql_query("INSERT INTO stafflogs (`id`,`username`,`time`,`whathappend`)VALUES('','$username','$date','$username updated $user content!')") or die ("Error Updating Staff Logs" . mysql_error()); echo ("<table border='1' align='center' cellpadding='0' cellspacing='0' class='table'> <tr> <td class='header' align='center'>Success</td> </tr> <tr> <td>You successfully changed $user profile content!</td> </tr> </table> <br />"); } } } } ?> <html> <head> <title>SD | Change Content</title> </head> <form action='' method='POST' name='doit'> <link rel="stylesheet" href="../../style.css" type="text/css"> <table width="30%" class="table" cellpadding="0" cellspacing="0" border="1" align="center"> <tr> <td class="header" align="center" colspan='2'>View Profile</td> </tr> <tr> <td>Username:</td><td align='center'><input type='text' name='view' id='user' class='input'></td> </tr> <tr> <td align='center' colspan='2'><input type='submit' name='subby' value='View Profile' class='button'></td> </tr> </table> <br /> <table width="50%" class="table" cellpadding="0" cellspacing="0" border="1" align="center"> <tr> <td class="header" align="center">Edit <?php echo $user; ?> Profile Content</td> </tr> <tr> <td class="omg" align="center">Everything you change will be logged!</td> </tr> <tr> <td align="center"><a href="javascript:addon(' ')"><img src="../../images/faces/smile.gif" border="0"></a> <a href="javascript:addon(' ')"><img src="../../images/faces/sad.gif" border="0"></a> <a href="javascript:addon(' ')"><img src="../../images/faces/v.happy.gif" border="0"></a> <a href="javascript:addon(':S ')"><img src="../../images/faces/wacko.gif" border="0"></a> <a href="javascript:addon(' ')"><img src="../../images/faces/wink2.gif" border="0"></a> <a href="javascript:addon('::laugh ')"><img src="../../images/faces/laugh.gif" border="0"></a> <a href="javascript:addon('::blush ')"><img src="../../images/faces/blush.gif" border="0"></a> <a href="javascript:addon(' ')"><img src="../../images/faces/tongue.gif" border="0"></a> <a href="javascript:addon('::dry ')"><img src="../../images/faces/dry.gif" border="0"></a></td> </tr> <tr> <td align="center"><textarea name="conn" cols="85" rows="10" id="conn" class="input"><?php echo "$checkobj->quote"; ?></textarea></td> </tr> <tr> <td><input type="submit" name="newcon" value="Update Profile" class="button"></td> </tr> </table> </br /> </form> Anyone see why its not updating the posted users profile? Thanks.