Jump to content

[SOLVED] get next id in mysql...


pfkdesign

Recommended Posts

hi everybody,

 

i made get_menu_id function :

<?php
function get_menu_id($menu) {
    $result = mysql_query("SHOW TABLE STATUS LIKE 'menu'");
    $rows = mysql_fetch_assoc($result);
    return $rows['auto_increment'];
}

echo get_menu_id()
?>

 

this is return the next auto_increment id in the mysql table (5.0.5a),

PROBLEM !

when i check it on local server(localhost) i dont have any problem and i 'm getting the next id  , but as soon as i upload in my server i will get the warning.

here are the warning:

 

Warning: Missing argument 1 for get_menu_id(),

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource

 

any idea?

 

tnx

Link to comment
https://forums.phpfreaks.com/topic/116181-solved-get-next-id-in-mysql/
Share on other sites

when you wrote the function you stipulated that you would supply it with $menu

 

function get_menu_id($menu) {

 

and when you call it you dont give it that information

 

echo get_menu_id()

 

it fails because it wants to know what $menu is, you dont use it in the function anyway so I am confused as to why you want it

than you  paul2463  for you reply ,

 

the first warning is solved but still i have this warning :

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource...

 

in local server (localhost) is not show up , but in main server is shewing this warning!

 

any idea?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.