Jump to content

Archived

This topic is now archived and is closed to further replies.

StirCrazy

PHP MYSQL

Recommended Posts

Can someone help me with the correct syntax for the following ~ not sure what i'm doing wrong.

trying to call username,sr_classifieds_score,sr_classifieds_pcnt and put them in $username,$score,$percentage

keep getting mysql_fetch_row(): supplied argument is not a valid MySQL result resource on line 15 - list($username,$score,$percentage) = mysql_fetch_row($r);

Thanks in advance.

S.C>

[code]
<?php

$db = "******";
$dbname = "*******";
$dbpass = "********";

$link = mysql_connect ('localhost', $dbname, $dbpass) or die;
@mysql_select_db('$db', $link);

function my_query($sql) {
  global $link;
  $result = @mysql_query($sql, $link);
  if ($result) return $result;

}

$r = my_query("select username,sr_classifieds_score,sr_classifieds_pcnt  from user
  where userid='$user_id'");
  list($username,$score,$percentage) = mysql_fetch_row($r);

       @mysql_close( $link );
  
  ?>
[/code]

Share this post


Link to post
Share on other sites
[code]@mysql_select_db('$db', $link);[/code]

Remove the single quotes from '$db'

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.