Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by AyKay47

  1. You need quotes around the query.

     

    Good catch, OP look at the error, as it will give you clues as to what is wrong.

    Notice that it states a parse error not a mysql error, this hints that there is an issue with the php syntax.

    Also, endif; if for an if(): statement, I don't see that syntax in your code.

  2. is the database structure the same as localhost?

    As I stated before, if you are trying to use a select statement on a db name, it won't work, it has to be a table name.

  3. no its holding a database name

     

    oh, that's a different ballgame.

    1. don't name the variable $table if it's not a table.

    2. You can't query a db like that, so this depends on what you want to do?

  4. output the SQL to see what it looks like:

     

    $query = mysql_query("SELECT * FROM sub_nav WHERE subNav_ID=" . mysql_real_escape_string((int)$id));
    $row = mysql_fetch_assoc($query);
    $table =  $row['subNavName'];
    if($row['show_hide'] == 1)
    {
    $sql = "SELECT * FROM $table";
    $query = mysql_query($sql) or die(mysql_error() . '<br />' . $sql);
    while($row = mysql_fetch_assoc($query))
    { ?>

  5. $query = mysql_query("SELECT * FROM ('$table')");

     

    this is not what you had in your OP, and makes a big difference, as it's invalid syntax.

    The way you wrote it in your OP is how it should be written, as long as $table is just a table name.

  6. You'll want to create a function that will query the desired results, then setup some ajax to get to that script and put it in a setInterval() call to call the function every x seconds.

    As to the server, if it's a simple query like that it shouldn't be an issue, just don't call the function every 5 milliseconds.

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