mmarif4u Posted July 2, 2007 Share Posted July 2, 2007 Ok try to edit ur code to this: f ($_GET['show'] == 1){$query = "SELECT * FROM piccomment WHERE picid = '$pictureid' ORDER BY picindex asc ";} And let me know. Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 Unfortuneately that still is not doing it. Thank you for your patience so far. Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 2, 2007 Share Posted July 2, 2007 Ok try it with out order by clause: if ($_GET['show'] == 1){$query = "SELECT * FROM piccomment WHERE picid = '$pictureid'";} Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 try this please. if ($_GET['show'] == 1){$query = "SELECT * FROM `piccomment` WHERE `picid` = '$pictureid' ORDER BY `commentdatetime` DESC ";} if ($_GET['show'] != 1) {$query = "SELECT * FROM `piccomment` WHERE `picid` = '$pictureid' ORDER BY `commentdatetime` DESC LIMIT 7 ";} query_db($query); Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 Still not doing it. This is pretty frustrating isn't it? I have been working on this all day! Do you think it has something to do with my db, and not the code at all? Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 That didn't solve the issue either redarrow. It is still working after your changes though, so that is good. Would you like me to PM you a username and password to see what it happening? Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 2, 2007 Share Posted July 2, 2007 i did not think u change ur code to this: if ($_GET['show'] == 1){$query = "SELECT * FROM piccomment WHERE picid = '$pictureid'";} Bcoz i did not the comment i posted now. Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 I did and tested it, when it didnt work I put it back, If you would like I will put it back to what you have posted above for you to try...so i am doing it now, let me know what you get. Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 2, 2007 Share Posted July 2, 2007 Read this link: http://bugs.mysql.com/bug.php?id=28542 Thats why i remove order by clause from your query. Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 So that did actually work, I was still looking at the top of the comments list for the latest post, I forgot that it would add it at the bottom. So does that mean I cant order the posts now? Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 I take that back it works for every post after the first. The first post on a pic still doesnt show. edit: I continued to try on other photos, and it is back to not showing the latest post at all. I know this can work, Im sure theres a more elegant solution especially using ajax or something, but I think what I have is close to working, or should I be going about this a different way? Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted July 2, 2007 Share Posted July 2, 2007 U can use but depend on your mysql version. Order by is the way to put the latest one on top but here u r using version 4.1.22 so may be still the mysql team did not fix it for version 4.1.22, But later versions works fine for order by. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 are you posting the pic to another file.php or the same file.php Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 are you posting the pic to another file.php or the same file.php Im not sure what you are asking redarrow? U can use but depend on your mysql version. Order by is the way to put the latest one on top but here u r using version 4.1.22 so may be still the mysql team did not fix it for version 4.1.22, But later versions works fine for order by. Unfortuneately I have no control over my verson Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 post you insert code please ok. Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 for inserting comments or photos? Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 Here is the comment insert form <?php include("db_connect.php"); $striptext = stripslashes(strip_tags($_POST['text'])); $finaltext = mysql_real_escape_string($striptext); $now = date("Y-m-d H:i:s"); $query = "INSERT INTO piccomment (picid,posterid,commentdatetime,postername,comment) VALUES ('$_POST[picid]','$_SESSION[user]','$now','$_POST[postername]','$finaltext')"; query_db($query); $getid = $_POST['picid']; header("location:pic.php?id=$getid"); ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 try this ok. <?php $picid=addslashes($_POST['picid']); $users=addslashes($_SESSION['user']); $users=addslashes($_POST['user']); $postername=addslashes($_POST['postername']); $striptext = stripslashes(strip_tags($_POST['text'])); $finaltext = mysql_real_escape_string($striptext); $now = date("Y-m-d H:i:s"); $query = "INSERT INTO piccomment (picid,posterid,commentdatetime,postername,comment) VALUES ('$picid','$user','$now','$postername','$finaltext')"; query_db($query); $getid = $_POST['picid']; header("location:pic.php?id=$getid"); ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 updated version <?php $picid=$_POST['picid']; $users=$_SESSION['user']; $users=$_POST['user']; $postername=$_POST['postername']; $striptext = stripslashes(strip_tags($_POST['text'])); $finaltext = mysql_real_escape_string($striptext); $now = date("Y-m-d H:i:s"); if(isset($_POST['submitcomment'])){ $query = "INSERT INTO piccomment (picid,posterid,commentdatetime,postername,comment) VALUES ('$picid','$user','$now','$postername','$finaltext')"; query_db($query); } $getid = $_POST['picid']; header("location:pic.php?id=$getid"); ?> Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 I still am getting the same lag, the latest post still doesn't show until another post has been made. I will try that latest version now. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 from the database what is the table field set to varchar char lontext what? Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 you have $users being set to two different things, and in the query $user isnt coming from anywhere Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 Here are my columns and data types picindex int picid int posterid int commentdatetime datetime postername varchar comment text Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 sorry about the typo i am stuffed then that me sorry. Quote Link to comment Share on other sites More sharing options...
bluebyyou Posted July 2, 2007 Author Share Posted July 2, 2007 No problem, I apreciate the patience and help. would you mind posting what it should have been? Quote Link to comment 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.