Cannot Display Array from Select Statement + Login question
Posted on
16th Feb 2014 07:03 pm by
admin
Hi,
I'm new to PHP but so far so goog. I was assigend a project and I'm very close to completion.
I have a site that logs you in, sets a cookie, and then what I would like to do is depending on the user loging in, certain records from a table are selected and displayed
I have the following code:
Code: // Connects to your Database
mysql_connect("localhost", "root", "escrma") or die(mysql_error());
mysql_select_db("rma_portal") or die(mysql_error());
//Set Login Variable with the UserID
$login = $_COOKIE['ID_my_site'];
echo "This is it set to $login
";
// Collects data from "users" table
$data = mysql_query("SELECT *
FROM users, cust_info
WHERE cust_info.Cust_ID = '.$login'")
or die(mysql_error());
// puts the "users" info into the $info array
$info = mysql_fetch_assoc($data);
//Test Print of Login ID passed value
echo $data; WORKS Resource id #3
echo $info["Cust_Name"]; DOES NOT WORK
echo "$Cust_Name"; DOES NOT WORK
echo "$login
"; WORKS
echo $info["Cust_Company"]; DOES NOT WORK
1 Question is why I can echo the $login but then I canot pull anything from the query?
Table users
Cust_ID, Username, Password
Table cust_info
Cust_ID, Cust_Name, Cust_Company, Cust_Phone.....
2 I don't know if using the Cookie variable to use the login is a good idea. What would be the best way to pass the username to next page so I can use it in the SELECT ststement. Should I use a _SESSION global?
Thanks in advance
No comments posted yet
Your Answer:
Login to answer
263
20
Other forums
Add User script "Could not execute query"
This should be an easy script but I can't get it to run. Can someone please help me?
<
Mysql error message
help me find out what this error message means:
"Duplicate entry '0' for key 'PRIMARY'&q
Is there a more efficient way to code this than what I have?
I have three associative arrays.
$combinedSettings
$userSettings
$defaultSettings
Error: SQL Syntax; Line 1
Code:
<?php require "global_settings.php"; ?>
<title&g
some query on multilingual website
Hi all,
Which is the simplest and easiest method to make a website multilingual,
is it put
url- go to webpage
i have an input text field and submit button.
how do i make the url entered into the textfiel
How do I use a global footer..?
If my index.php has a bole bunch of if functions and exit's in them
Spliting paragraph into sentences and attach in
Here is what I am trying to do
example: Para1[123.456.789!] 3 sentences
Para2
Simple Question
I know this is a simple question, that if I knew what it was technically called i could probably loo
Removing Title From database problem
Hi again ! i am having an issue with updating database. When i update any price of a title it remove