Jump to content

[SOLVED] data from database lag


bluebyyou

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

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);

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?

 

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

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");

?>

 

 

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");

?>

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");

?>

Here are my columns and data types

 

picindex                  int

picid                        int

posterid                    int

commentdatetime    datetime

postername            varchar

comment                text

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.