Jump to content

Strydaris

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by Strydaris

  1. its closer then I was... lol I think you misunderstood my little illustration up there but for the most part works. I did the little illustration of a table to show that I wanted to use <table></table> in the code. Thanks... now I need to figure out how to get the HTML code in there. I think I do the the variables for the amount of columns and rows I want to use. Something like $rows and $cols. lol i dont know for sure though.
  2. Ok I am completely new to this whole PHP scripting stuff and really only try to deal with simple scripts and such for my website. It has done me fine until now. I know this is going to be a simple question to answer and probaly has been answerd before but I have spent an hour on this forum and could not find one yet. Anyways here it is... I have an array of lets say something like $my_array = array( 1=> 'Numbers', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', Now I have been searching for a way to put that array into an html table without any luck. Want I want to do is have lets say 5 columns and 3 rows where it would be laid out something like this in the end. Numbers|one |two |three|four | five |six |seven|eight|nine | ten |eleven| | | | Any help here would be much appiciated!! Cheers
  3. Hey there!! I am kinda new to this MYsql stuff and PHP stuff but I am learning alot as I go. Anyways I am having troubles trying to querying 2 tables. Let me try to explain. I have 2 tables that I am trying to query 2 things from both. For example I have Table 1 with FieldA and FieldB in them and Table 2 with FieldA and FieldC in it. I am trying to use Table1.FieldA and Table2.FieldA to link Table1.FieldB and Table2.FieldC information together. Not sure if thats how you go about doing it but it seems logical to me to search for a similar item from both Table1 and Table 2 to link different items together in the query. Also trying to add a count in there so I can count the number of items. Maybe a better explaination is in order. Table1.FieldA and Table2.FieldA are equal values. Table1.FieldB holds different types of information but I want to filter most of that out and just use a preset value (Lets say its INFO1). Since Table1 now has some filtered values I want to go to Table 2 and use the left over values from Table1.FieldA to find the same values in Table2.FieldA and retrieve the data from Table2.FieldC. I also need to take a count of the like values pulled from Table2.FieldC. LOL now that I through that out on the table this is as far as I have got on my MYsql Query SELECT table1.fielda, table1.fieldb, table2.fieldc, COUNT(table.fieldc ) FROM table1, table2 WHERE table1.fielda=table2.fielda GROUP BY table2.fieldc This is close but not yet there. Problem still is that I dont know how to stop it from gathering the unwanted information from Table1.FieldB I know adding in WHERE tabel1.fieldb = 'INFO1" should work but then I run into the problem of not having the WHERE available to filter the data from from Table1.FieldB. I hope this isnt to confusing and that someone understands enough to help me out!!
  4. nevermind I solved it Had to move $testing = $row['cb_class']; $fullimgname = $urlImgPath .$testing .$imgname; into the while statement!! lol
  5. Ok hopefully someone can help me out with this. I am really new at writing PHP code and have done alot of searching around on this but cant seem to find anything about it. Most of this code is actually working just fine its jsut the images I cant get working. Take a look then I will expalin what I am trying to do. <?php defined( '_VALID_MOS' ) or die( 'Restricted access' ); global $mosConfig_live_site; $query = "SELECT cb_class, COUNT(user_id) FROM jos_comprofiler GROUP BY cb_class"; $result = mysql_query($query) or die(mysql_error()); echo "<table border='1' bgcolor='blue'>"; echo "<tr> <th colspan='2'>Class</th> <th>Amount</th> </tr>"; // setting the images and their path $urlImgPath = $mosConfig_live_site."/modules/mod_recruitment/"; $imgname = "_small.gif"; $testing = $row['cb_class']; $fullimgname = $urlImgPath .$testing .$imgname; while($row = mysql_fetch_array($result)){ // Print out the contents of each row into a table echo "<tr><td>"; echo '<img border="0" src="'.$fullimgname.' ">'; echo "</td><td>"; echo $row['cb_class']; echo "</td><td>"; echo $row['COUNT(user_id)']; echo "</td></tr>"; } echo "</table>"; ?> Basically what I am trying to do is make a list of people that have registered on my website in a nice neat table for everyone to see. In this table I want it laid out with. Class image(an image file) | Class name | Class count(in numbers) I have the last 2 parts are working as intended. What I am trying to do is use the Class name defined by $row['cb_class']; to create a string that includes the image file directory as well as the first part of the image name. If I replace $testing = $row['cb_class']; with something like $testing = "IMAGE NAME"; it works fine. Can someone please point me in the right direction on what I can do here?
×
×
  • 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.