Solved

PHP MySQL Seek

Posted on 2014-02-12
4
570 Views
Last Modified: 2014-02-15
Anyone know why this doesn't work?  I want to use this code to list the data twice.

$result = mysqli_query($objConnection, $query);

while($row = $result->fetch_assoc()){
  List all results
  // This works
}

mysql_data_seek($result, 0);

while($row = $result->fetch_assoc()){
  List all results
  // This DOES NOT work
}
0
Comment
Question by:classnet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39855268
The first problem is that mysql_data_seek is not part of the 'mysqli' driver.  'mysql' and 'mysqli' functions do not work together, it's one or the other, not both.  You might be able to use 'mysqli_data_seek' instead.  http://us1.php.net/manual/en/mysqli-result.data-seek.php
0
 

Author Closing Comment

by:classnet
ID: 39855752
This little answer went a long way... need to watch the l and i.

Thanks
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39856844
You're welcome, glad to help.
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39861962
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question