Web Hosting Talk







View Full Version : Weird mysql_query and Smarty problem


Canglan
11-15-2005, 10:36 AM
Hi folks,

I am having a critical problem with mysql_query and Smarty template. I've tried to seek for help on the smarty forum but apparently I got virtually no response there.

Okay, here is my problem. My script is written to run on both mysql and mysqli extension. My script uses Smarty as the template engine. The problem is that it runs perfectly on mysqli_query, but on mysql_query it outputs blank pages.

The template simply won't render if I have mysql_query on that page. I've checked my code and can see no errors. The code runs fine on mysqli anyway.

Does anyone have any clue what's going on here? I'm totally lost and don't know where to start solving the problem. FYI, I've checked error logs, turned on E_ALL, nothing is wrong. The sql queries are correct because they work fine on mysqli_query. The templates are correct because they work fine on mysqli_query. The connection/database selection of mysql_* are correct because they work fine without Smarty.

It's just odd. :/

Please someone gimme your hands, I am desperately need help here.

Thank you in advance.

-Canglan

Jatinder
11-15-2005, 12:18 PM
Which version of PHP are you using? Also post your phpinfo if you can.

Use this script to get your phpinfo:
<?php
phpinfo();
?>

Regards,
Jatinder

localhost127
11-15-2005, 12:43 PM
Make sure you're checking mysql_error() to see if theres maybe something going on there.

Smarty should not be doing any queries, that should all be done in php. So try making a blank php file and running a query there (no smarty) to see what happens.

Canglan
11-15-2005, 08:14 PM
Jatinder, I've tested my script on vairous PHP versions (both 4 and 5). For example on XAMPP, I get blank pages immediately after I disabled the mysqli extendsion and restarted apache.

localhost127, yes I do have mysql_error(), and that generates nothing, which is what I expected because it does work without Smarty.

:(

JNadolski
11-15-2005, 09:01 PM
so it has nothing to do with php5, does the script use global as the settings if so double check the connection. Hope all goes well

Canglan
11-15-2005, 10:49 PM
I've finally found what the problem was!! I am just so dumb. :(

Okay, I apply filters on sql queries (which includes mysqli_real_escape_string and such), but somehow I messed the custom function. So now I fixed that and boohoo! It worked great!! :D

Thanks anyway for your help guys! :)