Jump to content

Why won't it select anything?


forumnz

Recommended Posts

I am trying to get an id from a table where clientid is equal to a session var. I know the session is set because if I echo it, it shows up, and I know there is a row in the db that matches because I am looking at it right now.

 

The problem is, the query is not selecting any data. I need to select the clientid from the table so I can set another session var.

 

Please please help my brain is not coping! Thank you!

 

<?
session_start();
$uid = $_SESSION['logid'];

include('../connectdb.php');
mysql_select_db("maindb", $con);

$result = mysql_query("SELECT * FROM projects WHERE clientid = $uid");

while($row = mysql_fetch_array($result))
  {
echo $row['id'];
  }

?>

 

I'm down to just echoing the row to problem solve but nothing comes up.

Link to comment
https://forums.phpfreaks.com/topic/226813-why-wont-it-select-anything/
Share on other sites

I did some error reporting and I got:

Notice: Undefined variable: con in /var/www/vhosts/pricelesswebsites.co.nz/subdomains/client/httpdocs/SignUp/upload.php on line 8

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /var/www/vhosts/pricelesswebsites.co.nz/subdomains/client/httpdocs/SignUp/upload.php on line 8

 

Line 8 is:

mysql_select_db("maindb", $con);

 

(with the error reporting code.

 

Help please?

The only reason I can think of is a path problem with the include, but changing it to require_once should have generated a fatal error if that was the case.  Are you sure you're including the correct file, rather than maybe another file that exists, but doesn't contain the right credentials?

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.