First attempt at doing an exercise on paginating result sets
When I run the code, I receive the error "Fatal error: Call to
undefined function: mysql_fetch_obj ects() in
/homepages/17/d23395818/htdocs/en/test.php on line 48"
Line 48 is while($row = mysql_fetch_obj ects($result)) Any ideas?? Have
I missed an obvious mistake. (full code below)
Many thanks
Alec
<?php
//sets number of records and ref number in database to search by
$records_per_pa ge = 2;
$search = "123-456-BSE";
//look for starting marker
(!$_GET['start']) ? $start = 0 : $start = $_GET['start'];
$connection = @mysql_connect( '???', '???', '???');
if (!$connection) {
echo '<p>Unable to make database connection.</p>';
exit();
}
if (!@mysql_select _db('???')) {
exit('<p>Unable to locate database.</p>');
}
//create and execute query to count records
$query = "SELECT COUNT(*) FROM schott_news WHERE userID='$search '";
$result = mysql_query($qu ery);
//get total number of records
$row = mysql_fetch_row ($result);
$total_records = $row[0];
//if records exist
if (($total_record s 0) && ($start < $total_records) )
{
//create and execute query to get batch of records
$query = "SELECT userID, username FROM schott_news WHERE
userID='$search ' LIMIT $start, $records_per_pa ge";
$result = mysql_query($qu ery);
//iterate over record set and print data
echo '<table border=1 cellpadding=10> ';
while($row = mysql_fetch_obj ects($result))
{
echo '<tr>';
echo "<td>$row->userID</td>";
echo "<td>$row->username</td>";
echo '<tr>';
}
echo '</table>';
//set up previous page
if ($start >= $records_per_pa ge)
{
echo "<a href=" . $_SERVER['PHP_SELF'] .
"?start=" . ($start-$records_per_pa ge) . ">Previous
Page</a> & nbsp; &nbs p; ";
}
//setup next page
if ($start+$record s_per_page < $total_records && $start >= 0)
{
echo "<a href=" . $_SERVER['PHP_SELF'] .
"?start=" . ($start+$record s_per_page) . ">Next Page</a>";
}
}
?> 2 2151
Alec wrote:
First attempt at doing an exercise on paginating result sets
When I run the code, I receive the error "Fatal error: Call to
undefined function: mysql_fetch_obj ects() in
/homepages/17/d23395818/htdocs/en/test.php on line 48"
Line 48 is while($row = mysql_fetch_obj ects($result)) Any ideas?? Have
I missed an obvious mistake. (full code below)
There doesn't seem to be any such function. Did you mean
mysql_fetch_obj ect()?
Tim
Tim
Thanks for that. Works a treat now.
Cheers, Alec This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Darko Jovisic |
last post by:
Hi!
Another silly question:
If a stored procedure returns multiple result sets, how do I choose the one
I want to insert into a table?
For example sp_spaceused returns two result sets if object name is ommited.
I only need the first result set. How do I do that?
|
by: Stanley Sinclair |
last post by:
I have a need to return multiple result sets from a stored procedure.
Want that SP to call others to get the data.
Win2003, db2 8.1.5.
Can't figure out how to handle open cursors, and return >1 result
sets.
Thought about global temp tables.
|
by: Arijit Chatterjee |
last post by:
Dear Faculties,
I have a query on this statement..
===============================
CREATE PROCEDURE Check_Manage ( )
DYNAMIC RESULT SETS 1
==============================
I want to know the meaning of
===============================
DYNAMIC RESULT SETS 1
===============================
|
by: Michael C# |
last post by:
Hi all,
I'm sending a command via SqlClient, and it returns two result sets. I can
successfully read the first result set, but how can I access the second
result set? Here's an example of my SqlCommand CommandText:
DECLARE @result AS INT\nEXEC @result = master..xp_cmdshell 'dir "c:\*.*" /b
/a-d'\nSELECT @result
When run on SQL Server, as
|
by: AussieRules |
last post by:
Hi,
I have a need to do two selects against to stored proc's in my SQL db.
At the moment, each SP is called and two different dataset are populate.
Thats two round trips to the SQL server.
I can combine the two SP into one, and have one SP that executes two Select
Statements, and effectivly returns two result sets, and I could call this
with one trip to the SQL server from my VB app.
| |
by: urs |
last post by:
Hi, please look at the ASP.NET 2 site
http://www.prismatest.ch/catalog/EM.ASPX
(user=prismashop, password=minicooper). Use the ">" Button to go to the
next pages.
You will notice that the page goes all white every time after pressing
the ">" Button, and redraws itself only after all parts of the page
have been downloaded. This means the page stays white for several
seconds.
|
by: esmith2112 |
last post by:
Scratching my head on an issue that has been plaguing us ever since we
upgraded from version to version 8. Our db2diag file gets inundated
with messages that take the form:
MESSAGE : sqlriInvokeInvoker ignored because of prior condition, probe
145
DATA #1 : Hexdump, 136 bytes
0x2004FD54 : 5351 4C43 4120 2020 0000 0088 0000 01D0
SQLCA ........
0x2004FD64 : 0005 FF31 FF30 FF20 2020 2020 2020 2020 ...
|
by: happyhondje |
last post by:
Hello everyone,
I've got a little issue, both programming and performance-wise. I have
a set, containing objects that refer to other sets. For example, in a
simple notation: (<a, b, c>, <d, e>) (or in a more object-like
display: set(obj1.choices=set(a, b, c) ). There may be obj1..objN
objects in the outer set, and the amount of items in the choices sets
could also reach a high number. The objects in the choices sets might
overlap.
|
by: Yash |
last post by:
Hi,
We are in the process of tuning the performance of our stored procs in
SQL 2000 and are looking for a tool that would help us in comparing
the result sets of an old SP and a modified SP. The tool should take
as input the names of the 2 SPs, a set of parameter values and invoke
them. Internally it should compare the result sets returned and log/
display the difference in result sets if any.
We do not want to compare response time,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |