Hi,

Did you copy and paste your code?IF yes, I have noticed a problem on the
code you posted.. Y
The line:

$run_query  = ($maxid,$db_connect);

will fail as you didn't put the function name in. Rewrite it as:
$run_query  = mysql_query($maxid,$db_connect);

Gurhan


-----Original Message-----
From: Jason McCormack [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 1:31 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need Help with returning new id's


Hello All,

I am trying to return the largest id for a table and then print the value to
a page. My query works fine in MySQL, the problem is getting the value to
show in a web page with php. This is what I am trying to process.

TABLEID | VALUE
1               | Test
2               | Test 2
3               | Test 3

In the sample table above I am trying to pull back a value of 3 and print to
a web page via php.

$maxid = "select max(tableid) from table as largestid";
// db_connect is my database connection. I know this works because I have
other pages that return
// results based on my queries without any problems
$run_query  = ($maxid,$db_connect);

This is were I get a bit lost. I have tried using all sorts of various mysql
functions without success

$row = mysql_fetch_row($run_query);
$mymaxidvalue = $row[0];
echo $mymaxidvalue;

As I stated above I have tried many different ways to get the desired
results but have been unsuccessful. Any help would be greatly appreciated.

Thanks,
Jason



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to