Jump to content

[SOLVED] Need help with this please :)


adamjones

Recommended Posts

Hi.

I have this code;

 

<?php
   session_start();
   require_once('config.php');
   
   $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
   if(!$link) {
      die('Failed to connect to server: ' . mysql_error());
   }
   
   $db = mysql_select_db(DB_DATABASE);
   if(!$db) {
      die("Unable to select database");
   }
   
   $qry="SELECT * FROM `members` WHERE `username`='"$rows['user']."'";
   $result=mysql_query($qry);
   
   $getbadge = mysql_query($qry) or die(mysql_error());
   
   if($result) {
      while ($row = mysql_fetch_array($getbadge)) {
	  $imgs = explode(",",$row['badges']);
	  foreach ($imgs as $v)
	  	{
	  	echo "<img src='badges/".$v.".gif' alt='".$v."'>";	
	  	}
} 
}else {
                  echo "<p>".$error."</p><br>";
                  }
                  ?>

 

The problem is this bit;

WHERE `username`='"$rows['user']."'";

I know that it's not ""$rows['user']."'";

 

I just don't know what it is... :/

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/146403-solved-need-help-with-this-please/
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.