Jump to content

1 query, 2 selects?


karimali831

Recommended Posts

Ok so there will be a particular id you are looking up and need fields from both tables.

 

so if the id you are looking up is in $lookupid

 

$ergebnis = safe_query("select ca.status, ca.ID, ca.name  from".PREFIX."cup_all_clans ca,cups c WHERE ca.ID = c.ID and c.ID=$lookupid");

Link to comment
Share on other sites

Thanks for that but I get an SQL error.

 

$ergebnis = safe_query("select ca.status, ca.ID, ca.name  from".PREFIX."cup_all_clans ca,cups c WHERE ca.ID = c.ID and c.ID=$cupID");

 

and error:

 

# errorno=1064
# error=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ca,cups c WHERE ca.ID = c.ID and c.ID=4' at line 1
# query=select ca.status, ca.ID, ca.name fromficocup_cup_all_clans ca,cups c WHERE ca.ID = c.ID and c.ID=4

 

It reads the correct ID from the correct table :D

 

any ideas?

Link to comment
Share on other sites

Now how didn't I spot that.. ok but now this:

 

error=Table 'ficomedi_ficomedia.cups' doesn't exist

 

It should be ficomedia_cups, reading prefix twice?

 

I remove PREFIX and I get

 

error=Table 'ficomedi_ficomedia.cup_all_clans' doesn't exist

 

I don't understand how it reads the prefix twice, followed by a dot?

Link to comment
Share on other sites

you do need your ficocup_  prefix on your table names either as your define, or hardcoded

 

$ergebnis = safe_query("select ca.status, ca.ID, ca.name  from".PREFIX."cup_all_clans ca,".PREFIX."cups c WHERE ca.ID = c.ID and c.ID=$cupID");

or

 

$ergebnis = safe_query("select ca.status, ca.ID, ca.name  from ficocup_cup_all_clans ca,ficocup_cups c WHERE ca.ID = c.ID and c.ID=$cupID");

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.