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
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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.