pfkdesign Posted July 23, 2008 Share Posted July 23, 2008 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 More sharing options...
paul2463 Posted July 23, 2008 Share Posted July 23, 2008 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 Link to comment https://forums.phpfreaks.com/topic/116181-solved-get-next-id-in-mysql/#findComment-597445 Share on other sites More sharing options...
pfkdesign Posted July 23, 2008 Author Share Posted July 23, 2008 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? Link to comment https://forums.phpfreaks.com/topic/116181-solved-get-next-id-in-mysql/#findComment-597458 Share on other sites More sharing options...
JasonLewis Posted July 23, 2008 Share Posted July 23, 2008 Make this: $result = mysql_query("SHOW TABLE STATUS LIKE 'menu'"); This: $result = mysql_query("SHOW TABLE STATUS LIKE 'menu'") or die("Error: ".mysql_error()); Also, does the 'menu' in the query need to be the variable $menu? Link to comment https://forums.phpfreaks.com/topic/116181-solved-get-next-id-in-mysql/#findComment-597459 Share on other sites More sharing options...
pfkdesign Posted July 24, 2008 Author Share Posted July 24, 2008 tnx it solved. Link to comment https://forums.phpfreaks.com/topic/116181-solved-get-next-id-in-mysql/#findComment-598260 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.