Jump to content

PHP MYSQL


StirCrazy

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]
Link to comment
https://forums.phpfreaks.com/topic/10508-php-mysql/
Share on other sites

Archived

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

×
×
  • Create New...

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.