473,666 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble in last id

1 New Member
hi all..

i am newbie in php-mysql. i have doubt to access the max id using php.
here is the problem.

member table
---------------
id auto_increment
name varchar(50);
-------
accessing data through html form, then dumping to mysql working nicely.but when accesing LAST DATA from mysql through browser using php code shows nothing.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.   mysql_connect("localhost","root","") or die (mysql_error());
  4.   $dblink = mysql_select_db("test") or die (mysql_error());
  5.    $res = mysql_query("select max(id) from members",$dblink);
  6.   $maxid = mysql_result($res,0,"MAX(id)");
  7.   $result=mysql_query("select * from members where id=$maxid");
  8.  
  9.   $row = mysql_fetch_array($result, MYSQL_ASSOC);
  10.     echo "ID  : {$row['id']} , ".   "Name  : {$row['name']}  <br>";
  11.   mysql_close($dblink);
  12.  
  13. ?> 
  14.  
please help me

thanks in advance
Jul 16 '07 #1
1 1247
debasisdas
8,127 Recognized Expert Expert
Hi
smcp
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

It will help Experts in the forum in solving/underestanding your problem in a better way.

Please follow the posting guidelines in every new post/reply.

Regards

Debasis
Jul 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2952
by: Jeremy | last post by:
Hello, I am trying to validate a form wherein someone will enter their first and last name, fill out the form, then electronically "sign" at the bottom. I want to confirm that the first and last names match in the First & Last & Signature form fields. Here is the code I wrote, but it doesn't work because indexof is supposed to be a string. What do I need to do to fix this? if (document.repForm.Signature.value.indexOf(First) == -1 ||
7
2151
by: slashdotcommacolon | last post by:
Hello, I'm working on the exercises from k&r, exercise 5-13 is to implement a simple replacement for the unix tail command. The brief says it should be able to cope no matter how unreasonable the input and should make best use of availbale storage (I suppose it means dont just declare a big char array). I have made a solution that seems to be basically working (tail -1 doesnt work, I'll try to fix that later), but I'm having trouble...
4
4022
by: DaHool | last post by:
Hi there !!! I browsed around the Internet in search for a solution of a little difficult problem i have in VB.NET.... However, i cannot find a suitable anwser anywhere, so i thought i'll give it a try here... Okay, here's the deal: I am trying to read from unmanaged memory with a class type struct, this
0
716
by: alex bean | last post by:
I am having trouble getting a class to serialize the way I want it to. I'm open to changing the class or dumping it altogether; I just need a way to produce the last set of xml. The following code produces the first set of xml. I have tried to set the attributes of the myXmlNode class to produce the last set of xml but I can't figure it out. Can the last set of xml be achieved? TIA!
4
2971
by: Kurt | last post by:
I'm using the fConcatChild function posted at http://www.mvps.org/access/modules/mdl0004.htm to return a field from the Many table of a 1:M relationship into a concatenated string. The function puts everything in a comma separated format. In my case, it returns a list of authors: Borman, W., Oppler, S., White, L., I'd like to change the function so the last record in the string is preceded by an ampersand instead of a comma, as in:
1
2062
by: ferraro.joseph | last post by:
Hi, I'm querying Salesforce.com via their AJAX toolkit and outputting query results into a table. Currently, their toolkit does not possess the ability to do table joins via their structured query language, which forces me to do the join manually via arrays. Right now, I'm having trouble getting these query results (which are in
3
4536
by: sab | last post by:
Hello, I have been working on a python script to parse a continuously growing log file on a UNIX server. The input is the standard in, piped in from the log file. The application works well for the most part, but the problem is when attempting to continuously pipe information into the application via the tail -f command. The command line looks something like this: tail -f <logfile| grep <search string| python parse.py
0
1671
by: mrchatgroup | last post by:
news from http://www.mrchat.net/myblog/myblog/small-accidents-mean-big-trouble-for-supercollider.html Small Accidents Mean Big Trouble for Supercollider Image Scientists expect startup glitches in the massive, complex machines they use to smash atoms.
3
2206
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus that are SELECT elements (javascript-- one named arrivalcity and one named returncity). Basically they ask for a departure and return city and another menu appears with options based on that city. I can't seem to get the input from these fields in the...
5
13348
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
8356
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,...
0
8640
tracyyun
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...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
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...
0
4198
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...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.