View Single Post
Old 07-21-2008, 01:23 AM   #1 (permalink)
mike.fro
Super ModTastic
 
mike.fro's Avatar
 
Join Date: Apr 2005
Location: Apple Valley, MN
Posts: 89
Thanks: 1
mike.fro is on a distinguished road
Default Problem With Function

Hello All,
I'm wanting to see if anyone here can help me out. I'm building a small cms for a client that basically takes the google pagerank, technorati and alexa ranking and places them in a database. I then pull them from the db and display them. I'm having troubles updating the database. I keep getting the error "Unknown column 'www.michaelfroseth.com' in 'where clause'" (MichaelFrosethdotCom is one of 3 url's currently in the database, but it is the first one so i'm assuming that's why it's displaying that specific url).

Here is my PHP code for the function I am using:

PHP Code:
function addPageRank() {
    
    include(
'config.php');
    
$sql "SELECT * FROM `url`";
    
$result mysql_query($sql) or die(mysql_error());
    
    while(
$row mysql_fetch_array($result)) {
    
extract($row);
    
    
$prURL $row[url];
    
$pagerankNum pagerank($prURL);
    
$alexa "1000";
    
$technorati ="50000";
    
    
$sql2 "UPDATE url SET pagerank=$pagerankNum, alexa=$alexa, technorati=$technorati  WHERE url=$prURL";
    
$result2 mysql_query($sql2) or die(mysql_error());
    
    }
    
    if(!
$result2) {
    
    
//show mySQL error
    
    
mysql_error();
    
    } else {
    
    
//successfully updated database with rankings
    
    
echo("Success!");
    
    }

The technorati and alexa variables are pre-defined as I haven't created those functions yet. Any help would be greatly appreciated.
__________________
Michael.Froseth
www.michaelfroseth.com | Personal Portfolio/Blog *DOWN*
Send a message via AIM to mike.fro Send a message via MSN to mike.fro
mike.fro is offline  
Reply With Quote