Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help a old newbie

Status
Not open for further replies.

wudz

Programmer
Mar 28, 2001
135
GB
Hi,
As you may see below I am a newbie to sql/php..
my problem is I have a 3 column table..
1st column hold an email address, second column holds an id number for another Table.
I want to extract the id number (user_id)from the associated email(list_name) match.
I have set the list_name as primary in the table and to test I have hard input the email address for the query..
What have I done wrong as it does not come back with the user_id.....arrrrrggghhh

$query = "SELECT user_id from PHPAUCTION_invitedbuyerslist where list_name = 'test@++++++++++++.co.uk'";
$res = mysql_query($query);
if(!$res) {
MySQLError($query);
exit;
}

$intro_id = $res;
once I get this sorted I wish to do the simlar with the result..so hopefully if I get this sorted first it would be easier next time...

Thanks in anticipation

John
 
Your query looks OK. Have you tried running it outside of PHP; in something like MySQL Query Browser for instance? If it works there, then the problem probably lies in your PHP.
 
Hi Tony,

Thanks for the quick response..it is appreciated.
I must have spent the past 4 hrs trying different sysntax to get it to extract the data...what a so and so..
Ok about the browser. just downloaded it so I will check it out...
Got me stumped as this is only one of about 20 tables all work Ok, just this beast...

Cheers again and will keep posted as to the hopeful outcome.

John
 
Hi Tony,
Trouble getting access to mySQL db with denied report..

Just as a matter of interest how should my fields be set..

As is now..

Attributes Null Default Extra Action
list_name varchar(32) No
user_id int(32) Yes 0
credit_passed char(1) Yes n



Indexes : [Documentation]
Keyname Type Cardinality Action Field
PRIMARY PRIMARY 19 Drop Edit list_name

Create an index on columns Space usage : Type Usage
Data 548 Bytes
Index 2,048 Bytes
Total 2,596 Bytes

Row Statistic : Statements Value
Format dynamic
Rows 19
Row length ø 28
Row size ø 137 Bytes
Creation Jan 08, 2006 at 07:48 PM
Last update Jan 08, 2006 at 07:48 PM

Does the above look correct for the requirements below..is INDEX not required anywhere?

My requirements are I query the user email against the emails stored in list_name column, if a matched is found extract the associated id out of user_id....in future coding the credit_pass will then be changed to 'y'

Just want to get the basic call sorted before I place a more accurate data call and error check....

Oh!. What is Cardinality (19)? is it associated with rows!
Most of the above baffles me as I am a Flash graphics lad....

Cheers
John
 
That looks reasonable, but you don't need to worry about those figures; they're only useful for performance tuning. If you need details of your table structure, just do a query: "SHOW CREATE TABLE tablename".

If you're getting "access denied" messages when you try to connect to the server, make sure you are using the correct credentials (username and password).
 
Hi Tony,
Everthing checked out OK, thinking cap went back on and then relised that I was not dropping the site between testing the Introducing User then signing in the Recommended User as the header ID cookie had not been changed at that point and this situation would not occur under normal use,,,ended up with the right email, but wrong ID...we live and learn.

Many thanks for your swift input and help...GREAT

Cheers

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top