PDA

View Full Version : Problem with script


Macahan
11-10-2007, 12:17 PM
Can anybody help me with why this code gives me problems when using CMPS ?


<?php
$db = mysql_connect("server","user","pwd");
mysql_select_db("scanianet" ,$db);
$sqlquery = mysql_query("SELECT * FROM rnd_skane",$db);
while ($tablerows = mysql_fetch_row($sqlquery)){($antal = $antal+1);}
$random = (rand(0,$antal-1));
$sqlquery = mysql_query("SELECT * FROM rnd_skane LIMIT $random,1",$db);
$tablerows = mysql_fetch_row($sqlquery);
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_rnd') . '";');
?>

Brian
11-11-2007, 10:25 AM
What kind of problems?

Just off the top of my head, I would say to try using vBulletin's $db class to make your database connections instead of the mysql functions you're using.

Our Sponsors
 

Macahan
11-11-2007, 12:57 PM
What kind of problems?

Just off the top of my head, I would say to try using vBulletin's $db class to make your database connections instead of the mysql functions you're using.

It started with some of the other modules not working, when this code was used in a module, but as you know yesterday the whole frontpage stopped working. I got it working again by removing this module.

My coding skills are very selflearned,but this code has been working on an ordinary php-page for years.

Macahan
11-11-2007, 01:51 PM
I tried to figure out the VB $db class and it worked.Even with a much simpler code. Thanks :)