...

View Full Version : Facebook App help



Snitz
07-22-2007, 11:42 AM
Hello there,

I'm trying to develop a facebook application that fetches rows from a mysql database by rand(). It worked, however on the the profile box it doesn't change on refresh as facebook caches everything so you'll have to visit the app page in order to get a new row. So, I'm trying to create a button on the profile page that sends you to refresh.php and that files redirects you to the user's profile. But also, it's not working. The button is showing up but not the row.

Here is the code, please try to help me!


<?php

// the facebook client library
include_once 'client/facebook.php';

// some basic library functions
include_once 'lib.php';

// this defines some of your basic setup
include_once 'config.php';

$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$user = $facebook->require_login();

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_conbb, $conbb);
$query_Recordset1 = "SELECT data FROM data ORDER BY rand()";
$Recordset1 = mysql_query($query_Recordset1, $conbb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>

<div style="padding: 10px;">
<p class="style1"><?php // echo $row_Recordset1['data'];
echo $row_Recordset1['data']; ?></p>
<div style="clear: both;"/>
<form id="form1" name="form1" method="post" action="">
<label>
<input type="submit" name="data" id="data" value="Refresh" onclick="http://symbioagency.com/rokoz/insults/index.php" />
</label>
</form><?
$fbml = "<fb:editor action=\"refresh.php\"><fb:editor-buttonset><fb:editor-button name=\"refresh\" value=\"Refresh\"/></fb:editor-buttonset></fb:editor>";
$facebook->api_client->profile_setFBML($fbml, $row_Recordset1); ?>
</div>
<?php
mysql_free_result($Recordset1);
?>

As you see

$fbml = "<fb:editor action=\"refresh.php\"><fb:editor-buttonset><fb:editor-button name=\"refresh\" value=\"Refresh\"/></fb:editor-buttonset></fb:editor>";
$facebook->api_client->profile_setFBML($fbml, $row_Recordset1); ?>
These are the the things that show up on the profile box, however the $row_Recordset1 is not appearing and if I remove $fbml it will show.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum