Friday 15 July 2011

mysql - PHP multiple entries -


I am creating a small project with PHP / MYSQL but I want to query my query the way I need it, I can not get it for him I have 2 tables

Table 1 (four):

  id, name.   

Table 2 (spell):

  id, four, spelling_name   

I am getting the output:

  Name Spell1 name spell2 name spelling 3   

but I may need it:

  Name Spell1 Spell2 Spell3   

This is my query:

  $ query = "select char.name AS name, Spell spsp. Spell_name spelled as four, spells WHERE (Char.id = spells.spell_name) ";   

Any ideas?

I think that you are the first character of the query to get the ID, and then Drag the mantra. Example:

  $ char_id = 0; // value will be assigned arbitrarily $ Query = "SELECT * FROM" is the spell WHERE s.char = $ char_id; "; $ Result = $ pdo- & gt; Query ($ query); While ($ line = $ result-> Fitch obz ()) {// do anything with mornings here obj}   

With SQL, you can capture full lines at a time So, I believe that you want that situation is not possible.

No comments:

Post a Comment