Re: SQL Prefix on installer - how to add sql prefix top installer or manually

Started by ZajferX, June 28, 2011, 12:35:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mindless

The only thing you have to worry about syntax wise is one simple thing == quotes being double or single

mysql_query('SELECT * FROM users WHERE');

Above query uses ' ' so you need '.$TBDEV['db_prefix'].' in that instance

mysql_query('SELECT * FROM '.$TBDEV[db_prefix'].'users WHERE');

The other way syntax will be is as follows using double quote not single

$user_query = mysql_query("SELECT id, uploaded, downloaded, class, enabled FROM users WHERE passkey=".sqlesc($passkey)) or err("Tracker error 2");

so in that case ".$TBDEV['db_prefix']." is used - using an editor with color syntax highlighting shows you the second you go wrong.

$user_query = mysql_query("SELECT id, uploaded, downloaded, class, enabled FROM ".$TBDEV['db_prefix']."users WHERE passkey=".sqlesc($passkey)) or err("Tracker error 2");

I notice thats announce user query so you also define prefix on announce.php same as you did on config.php.

ZajferX

i figured it would be the best to edit line by line so my question is in a line looking like this:

$user_query = mysql_query("SELECT id, uploaded, downloaded, class, enabled FROM users WHERE passkey=".sqlesc($passkey)) or err("Tracker error 2");

how should the prefix edit look like coz this example line u gave me

mysql_query('SELECT * FROM '.$TBDEV[db_prefix'].'table_name ');

isn't structured the same way as the line i have in my source for instance 'table_name ' has ' ' but my code has no ' ' i hope you all understand what i am getting at here,

so really i wonder should i add

'.$TBDEV[db_prefix'].'

or

$TBDEV[db_prefix']