Kenja Posted June 3, 2005 Share Posted June 3, 2005 I'm relatively new to OSC development so excuse my ignorance. I've written a module based on standard MYSQL and PHP commands and am now going back and trying to OSComerceize it by using the tep functions so I can submit the module to the community. I've added the table definitions to database_tables.php. For some reason, when I call the following code, I come up with an empty recordset using the tep function. When I use the conventional code (commented out), I get a single record which is what I expect. What am I doing wrong? Do I need to do more than just adding the table definitions? require('includes/application_top.php'); . . . . $query = tep_db_query("SELECT * FROM ". TABLE_LAND_PAGES . " WHERE file_name='test.php'"); $result = tep_db_fetch_array($query); //$sql = "SELECT * FROM land_pages WHERE file_name='test.php'"; //$query = mysql_query($sql); //$result=mysql_fetch_assoc($query); Of course with the standard calls I have a mysql_connect and mysql_db_select command above the call... Link to comment Share on other sites More sharing options...
FalseDawn Posted June 4, 2005 Share Posted June 4, 2005 try $query = tep_db_query('SELECT * FROM ' . TABLE_LAND_PAGES . ' WHERE file_name=/'test.php/''); I've never been a fan of using double quotes for SQL, I think it's better to use single quotes all round and escape them in the SQL string. Less chance of errors IMO. Also, you shouldn't be using SELECT * - explicitly give the field names - it's more efficient. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.