0

Hey there, why does this code not work?

$qry = mysql_query("SELECT performerid,pic0 FROM ".$table." ORDER BY RAND() LIMIT 6"); 

        $start =  new WP_Query('showposts=6&orderby=rand');

        if ($start->have_posts()) : while( $start->have_posts() ) : $start->the_post();

        $rows = mysql_fetch_assoc($qry);

        if (!$rows) 
           {
           mysql_data_seek($rows,0);
           $rows = mysql_fetch_assoc($qry);
           }

        $perfs = $rows['performerid'];

        $pics  = $rows['pic0']; 

I ahve the following error:

Warning: mysql_data_seek(): supplied argument is not a valid MySQL result resource in /home/content/d/d/a/ddxxxx

2 Answers 2

1

Your call to mysql_data_seek only happens if $rows is null. If that's true, then the call to mysql_data_seek will certainly fail, because one of it's required args is null. That's why you're getting the error message.

Sign up to request clarification or add additional context in comments.

1 Comment

mysql_data_sweeek, I'm trying to query the first row again, this is inside a wordpress loop -- in case i have more pots than rows, to query the rows again
0

The problem is you're passing the wrong thing to mysql_data_seek(). It's expecting you to pass it $qry (your results object) and not the empty $rows variable you just tested.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.