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
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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.