Jump to content

Recommended Posts

I'm still not completely sure what you mean. But maybe your looking for 'LIMIT'

 

<?php
$newq = mysql_query("SELECT * FROM threadread WHERE userid = '$logged[id]' AND threadid =    '$threadid' ORDER BY readtime DESC LIMIT 10");

I'm still not completely sure what you mean. But maybe your looking for 'LIMIT'

 

<?php
$newq = mysql_query("SELECT * FROM threadread WHERE userid = '$logged[id]' AND threadid =    '$threadid' ORDER BY readtime DESC LIMIT 10");

 

I would use that, and that is what I mean, but I also need to do a num_rows, to check if there are no results, and using a num_rows with a LIMIT returns a T_Variable error, so is there any other way please?

post the code where you're trying to do num_rows because the query string is valid (except for the fact that you said you want just 1, not 10, so it would be "...desc limit 1")

 

		$newq = mysql_query("SELECT * FROM threadread WHERE userid = '$logged[id]' AND threadid = 	'$threadid' ORDER BY readtime DESC LIMIT 0,1");

	$numrows = mysql_num_rows($newq);

	$newarray = $mysql_fetch_array($newq);

 

The error now is: Fatal error: Call to undefined function: () in /home/xxx/public_html/newposts.php on line 44

 

 

Line 44 is "$newarray = $mysql_fetch_array...."

 

EDIT: I realise what's wrong. I put a $ in front of mysql_fetch_array

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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