Jump to content

Stephen68

Members
  • Posts

    168
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Stephen68's Achievements

Member

Member (2/5)

0

Reputation

  1. can't you just use in_array? http://php.net/manual/en/function.in-array.php. not sure if that helps. On my way out the door will check back later...
  2. Hello! I have a table and I would like to group all the values that are the same. Not sure if you can even do this, look around and didn't find what I was trying to do. Anyway here is what I'm trying to do. Table has a field name of "weight" (lets say) and a field name of "name". I wold like to group all the same value that are in the "weight" field that have the value of ?? in the "name" field. I hope this makes some sense to you fine people. Thanks for you help Cheers!
  3. you main should not float I think.. #sidebar-left { float: left; width: 16%; margin: 0; padding: 0; background-color: #FFFFFF; } #main { margin: 0; padding: 0; width: 66%; } #sidebar-right { float: left; width: 16%; margin: 0; padding: 0; background-color: #FFFFFF; } or something like that, you might have to indent it on the left and right sdies to make room for the sidebars.
  4. Figured it out I just needed to add a float value in there, works great not. #item_container { float:left; text-align:center; width:158px; height:193px; border:dashed; border-color:#F00; z-index:2; } Cheers! Stephen
  5. I failed to say that the site is laid out in tables, so the information that I'm trying to get side by side is located in a table cell.
  6. Stephen68

    div layout

    Hello all! I'm using PHP to query some information from a DB. I then wanted to loop through the results and have them display 3 wide and however many down I need. I wanted to try and do this with CSS so I made this container code I guess it would be called. #item_container { position:relative; width:158px; height:193px; z-index:2; } But I'm not sure how to get them to go side by side, if I use absolute they just all stack on top of each other. and Relative just list one under the other straight down the page. Am I missing something or do I have to figure out how to put a location value in there? Any help would be great! Thanks! Stephen
  7. I'm looking to display information about items in my DB while using some of the values from the DB as links. I was wondering if the way I'm doing this is ok or not. First I have a 3 tables (spring_types, spring_sub_types, springs) in spring_types table I have spring_type-id PK spring_name in spring_sub_types I have spring_sub_type_id PK spring_type_id FK spring_sub_name in springs I have spring_id PK spring_sub_type_id FK spring_type_id FK spring_name spring_weght ect... So I use the PHP to get the values I want and make links and what not. Is this heading in the right direction or am I totally off base on this? Thanks for your help... Stephen
  8. Well right now there are only 6 lets say headings in the table. I would like to display them in a table 2 columns wide and how ever many rows I need. I think I have it worked out though it might not be the best way of doing it. Now the problem I am having I guess is with mysql since it will not list all 6 headings. Here is some of the code I'm using, please forgive me if you eyes bleed. <?php $i = 0; //place holder for creation of table //Strat loop for making 2 column table while ($row = mysql_fetch_array($results)) { //Check to see if $i is 0, if so start new row if ($i == 0){ echo "<tr>\r"; $i= $i+1; }else{ //columns echo "<td>\r<div class='smallhead'>".$row['type_name']."</div>\r"; echo "<p>"; //Loop through all spring_sub_types names for this type while ($sub_row = mysql_fetch_array($results_sub)) { echo "\r<div id='items'>\r"; echo "<a href='item_display.php?subType=1'>".$sub_row['sub_type_name']."</a>\r"; echo "<br>\r"; } echo "</div>\r"; echo "</p>\r"; echo "</td>\r"; $i = $i+1; } if ($i > 2) { //end table row echo "</tr>\r"; $i = 0; } } ?> for some reason the while loop is not showing me all the information I get back from the query. I did a mysql_num_rows and it tells me that it is getting all 6 headings so I'm not sure what it wrong. Should I not use the while ($row = mysql_fetch_array($results)) { any help would be great, thanks Stephen
  9. Not to sure how to do this but it looks like you could use some ajax, which I know nothing about really. You could use an i-frame as well maybe, I'm new as well. You could have one drop down box show in the page in an i-frame with your choices, once they pick one you have it refresh the frame. Using the choice they made you query your DB and make the second drop down box form that info. Not sure if this is right way to go about it but it's where I would likely start, again I'm new to this as well.. Stephen
  10. This may be in here already and I'm sorry for not being able to find it but.. I just want to display some information that I get from the database in a HTML table only using 2 columns. Do I just set i=1 and run a if statement to see what column I am on? like $i =0 While ($row = msyql_fetch_array($result)) { if ($i==0) { // start a new row echo "<tr>"; $i = $i++; }else{ //columns echo "<td>info</td>"; $i=$i++; } if ($i < 2) { //end the row reset $i echo "</tr>"; $i =0; } } Or something like that, am I heading in right direction? Thanks Stephen
  11. Well I'm just really fooling around with classes for the first time and thought it would be neat to make this. I do find is useful in that I can now run an update query from a forum with just a few lines of code, I don't have to create the SQL.
  12. So if I will have to make another function that will just grab one for and another one that will grab more then one run? The one the will give me all the rows will just have to be a multi array? or is there a way I could make it a 1 d array?
  13. Hello I have two function in my class, one runs a query and the other fetches the row/s. The problem is that it is sending back a multi dimension array. Any help would be great <?php #-----------------------------------------# # Fucntion for running query on the db # #-----------------------------------------# function query($sql) {## Start of query function $this->query_holder = mysql_query($sql,$this->conn); //Test to see if query ran if (!$this->query_holder) { //Query did not run show error message $this->errorMsg("<p>There was an error in running the query, please contact site admin."); return 0; } $this->numRows = mysql_affected_rows($this->conn); return $this->query_holder; }## End of query function #-------------------------------------------------# # Function for fetching all the information from # # the database. # #-------------------------------------------------# function fetchRecords ($rows) { $out = array(); while ($results = mysql_fetch_assoc($rows)) { $out[] = $results; } //Test to see if there are any errors if (!$rows) { $this->errorMsg('There was an error fetching record/s information, please contact site admin.'); return 0; } return $out; }#End of fetchReocrds function ?> There are more functions and what not in there for connect to db and stuff as well. Here is how I call it. <?php $db = new admin(bla, bla); $db->dbConnect(); $sql = "SELECT * FROM TABLE"; $results = $db->query($sql); $rows = $db->fetchRecords($results); print_r($rows); ?> The print_r puts out an 2-d array not sure why?
  14. I fixed it but still don't know what was wrong with the first version. I change the query to adding field names and then values. INSERT INTO logs (field,field,field) VALUES ('value','value',value') It work's not but if you can think of why the other way didn't I surely would like to know. Stephen
  15. sorry I normaly do post everthing I took out the space out but for some reason there looks to be another quote, that might be part of the error message though. The first field is autoincrement.
×
×
  • 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.