Jump to content

soullessj

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Everything posted by soullessj

  1. thanks for everyones help. I managed to find out what the problem was and fix it. Basically it was me being an idiot. i had two $row commands capturing the results. deleted the other and left the one in the while command and it worked perfectly So thanks again
  2. thanks for everyones help. I managed to find out what the problem was and fix it. Basically it was me being an idiot. i had two $row commands capturing the results. deleted the other and left the one in the while command and it worked perfectly So thanks again
  3. also the $id im getting is through a url
  4. Yeah sorry i don't have it on me as im doing it at home and am at work at the moment. the query im using at the start of the page is SELECT anime.*, ani_character.* FROM anime, ani_character WHERE anime.id=ani_character.anime_id AND anime.id=1 and then i have it display the information for the show etc... and beneath that i run the while statement. Whether i use another query or as i have done there or use the original one above i only get the results from the 2nd row not the 1st onwards. include('includes/conn.inc.php'); $que = "SELECT * FROM ani_character WHERE anime_id=$id"; // Execute the query $res = mysql_query( $que ); if (!$res){ die ("Could not query the database: <br />". mysql_error( )); } // Fetch and display the result while ($result_row = mysql_fetch_assoc(($res))){ echo '<div id="content_character">'; echo '<div id="cha_img">' . '<img src=" ' .$result_row[ac_img] . '" width="120"/>' . '</div>'; echo '<div id="cha_right">' .$result_row[ac_name] . '</div>'; echo '<hr id="m2"/>'; echo '<div id="cha_rightvj">' . 'Voice Jap : ' .$result_row[ac_jap] . '</div>'; echo '<div id="cha_rightve">' . 'Voice Eng : ' .$result_row[ac_eng] . '</div>'; echo '</div>'; } i know it has to print the html i was just wondering if there was an easier way of using the while command in regards to printing it, but i'll managed with it.
  5. and sorry i took out a_id form anime and id from ani_character
  6. okay i will check it again but when i run the query in a separate file and include it with the include command it works fine but if i join it up on the same page with a previous query that is when it skips the first row. this is basically how the database is set up. except for the id for the anime table is 1 and the a_chid is now anime_id and is also 1 for those. what i was doing before was running a query between the two tables to select the information where the id = 1 and told it that the anime and ani_character id's where linked ie. anime.id=ani_character.anime_id AND id=1 and i was using the and command to select the show as above but when i load the page like i said i only get the information after the first row. I don't know if maybe the query is using the first row to join them together or what but when i run the query in mysql console i get all the information i requested, and like i said when i use the include() it works fine. is there any other way to use a loop command like while and is there an easier way to display information with it besides having to echo the tables and things like that. thanks [attachment deleted by admin]
  7. Hi i was wondering if anyone can help me with this. I'm using the while loop to get multiple rows of information from a table called ani_character with a common id - in this case anime_id where the table has all the character information. When i run it along with a query to get information from another table - anime where information about the show is stored. It gets the information i need but it seems to skip the first row and display all the others after that. So if there are four characters linked to the show it will only display the 2nd -- to the last row and not the first. How can i tell the while command to start from the first row found and loop from there and also is there a better way to display with the while command than having to echo everything. include('includes/conn.inc.php'); $que = "SELECT * FROM ani_character WHERE anime_id=$id"; // Execute the query $res = mysql_query( $que ); if (!$res){ die ("Could not query the database: <br />". mysql_error( )); } // Fetch and display the result while ($result_row = mysql_fetch_assoc(($res))){ echo '<div id="content_character">'; echo '<div id="cha_img">' . '<img src=" ' .$result_row[ac_img] . '" width="120"/>' . '</div>'; echo '<div id="cha_right">' .$result_row[ac_name] . '</div>'; echo '<hr id="m2"/>'; echo '<div id="cha_rightvj">' . 'Voice Jap : ' .$result_row[ac_jap] . '</div>'; echo '<div id="cha_rightve">' . 'Voice Eng : ' .$result_row[ac_eng] . '</div>'; echo '</div>'; } thanks for any help
  8. isn't there a command in php to tell the query to start from the first row of the query and repeat it self until the last row of the query is found and how to use it in a while loop thanks
  9. so i need it to show the first row to the last with the same id
  10. sorry anime.id=$id. i'm using a $_GET variable to get the id number from a variable passed through the url
  11. ok i don't know why but its working now. I continued with my original query and tried it in the mysql command console and it gave me the reults i wanted so i tried the while command above with only the original query being used. SELECT anime.*, ani_character.* FROM anime, ani_character WHERE anime.id=ani_character.anime_id AND anime.id=1 something like that. Now i do still have one problem. it seems to display the info now but it displays from the 2nd row onward, basically it joins the show information to the first row of the character table and displays from the row after that. How can i tell it to include the first row so that it can display it. thanks
  12. i've been checking for any similiar help and i found one. http://www.phpfreaks.com/forums/index.php?topic=336634.0 in this one the guy has a similiar problem but im wondering if my problem is that at the end of each command of his there is a \n at the end of each line could that be my problem or is it something else thanks
  13. no i haven't tried that what does it do exactly as i have seen it but haven't looked into it yet
  14. it is simply this there is the first table with the show information that has an id and id=1 then there is the character table where at the moment there are 3 characters and i've put anime_id as the id to link it to the first table and they all have anime_id=1 what i need it to do is to show the show information which is working. Then underneath that i want to qeuery the character table for all the characters with the coresponding id and then display them. ie.. show and details then beneath that character details. i have tried the above command to query and display the information but whether i use mysql_fetch_array or mysql_fetch_assoc all i get is the first character and it doesn't show the rest. But, if i have the query as shown above on its own in a seperate page it shows me all the information i ask for, but when i try to put them together like i said it only shows one of them not all. thanks
  15. i did try that and will try it again. while reading it i was trying to remember if i changed the $row_result[1] in to the column names, so i will try it again and see what happens thanks
  16. ok i have been trying to get information to show from the first table which has the show information. then i have been trying to get the page to show the character information below that on the same page. the show has and id key and the character list has a anime_id key where i use id=anime_id. so if the show id is 1 all the characters in ani_characters anime_id =1. i have managed to one its own get this to show me all the characters in the database with the same anime_id, but when i put it together i only get one character shown (the first one in the list). include('includes/conn.inc.php'); $que = "SELECT * FROM ani_character WHERE anime_id=$id"; // Execute the query $res = mysql_query( $que ); if (!$res){ die ("Could not query the database: <br />". mysql_error( )); } // Fetch and display the result while ($result_row = mysql_fetch_array(($res))){ echo '<div id="content_character">'; echo '<div id="cha_img">' . '<img src=" ' .$result_row[5] . '" width="120"/>' . '</div>'; echo '<div id="cha_right">' .$result_row[1] . '</div>'; echo '<hr id="m2"/>'; echo '<div id="cha_rightvj">' . 'Voice Jap : ' .$result_row[2] . '</div>'; echo '<div id="cha_rightve">' . 'Voice Eng : ' .$result_row[3] . '</div>'; echo '</div>'; } i'm thinking that it is still maybe using the query from at the top of the page to display the show information or am i just doing this wrong. It should be showing 3 characters at the moment but like i said it is only showing the first one, but when the code is on its own it shows them all. and the $result_row[] lets me put in the colum names where as if i do it with the show query i have to put a number as shown above for the array made by the query. do i need to add a close connection command and what is it, or as i said am i doing something wrong Thanks for the help
  17. yeah sorry i have only been playing around with php for a little while and still figuring out how everything works so thanks for the help and i'll play around with that and see how it goes.
  18. thanks i will try it out. i was just explaining why its like that. so if i use the echo command it will display all the info from all 4 rows or do i have to tell it which row and how thanks
  19. okay what i am trying to do is that in table 1 - anime is the info for the show etc. in table 2 is the characters from the show. what i am trying to do is store and retrieve the info for the characters along with the info for the show so that i can display them on one page. i have tried putting all the character info into one row but it ends up being to long and i have to repeat the same columns ie. charac1, charac2, desc1, desc2 etc... i thought that if i put them in there own rows and use a column to link them together so that when i queried the database it would retrieve all 4 rows and not just the first one. if this isn't a good or right way to do it could you show me how then. i have managed to get the info from the other rows but i have to repeat the query multiple times on the same page and manually tell it to retrieve info from a specific row thanks
  20. if you check the previous page there is a zip file of the two tables with info in them. anime is table 1 and ani_character is table 2 thanks
  21. so then how do i get it to retrieve the data from the first table and the other 4 rows of data that have the same id linking them (bgc). If i put a query to retrieve info with the same id (a_id and a_chid) i only get the first row from the second table (ani_character). I have managed to get the info by repeating the query multiple times and storing in a different array, but i want to get all the info in one query and be able to display it.
  22. can anyone help me out with this. especially if you can show me what the actual query is. I know i should figure it out myself but if someone can show it to me i'll be able to figure out how it works and see where i went wrong. thanks
  23. i couldn't get it working. i managed to create another query after the first and to load the data into another array, but i know from reading that, that can cause problems if to many querys are running.
  24. thanks i will check it out but is there anyway you can show me the actual query or what it would look like. Once i know what its suppost to be like i can work from there. Thanks
×
×
  • 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.