Jump to content

StevenAFC

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

StevenAFC's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Perfect! Thank you very much for your help!
  2. array ( 0 => array ( 'Car' => array ( 'id' => '2', 'name' => 'BMW', ), 'Owner' => array ( 'id' => '4', 'car_id' => '2', 'name' => 'Bob', ), ), 1 => array ( 'Car' => array ( 'id' => '4', 'name' => 'Mercedes', ), 'Owner' => array ( 'id' => '4', 'car_id' => '4', 'name' => 'Jules', ), ), 2 => array ( 'Car' => array ( 'id' => '4', 'name' => 'Mercedes', ), 'Owner' => array ( 'id' => '4', 'car_id' => '4', 'name' => 'Simbad', ), ), 3 => array ( 'Car' => array ( 'id' => '4', 'name' => 'Mercedes', ), 'Owner' => array ( 'id' => '4', 'car_id' => '4', 'name' => 'El Savador', ), ), )
  3. I get invalid offset if I use something like that, this is a print_r of the array: Array ( [0] => Array ( [Car] => Array ( [id] => 2 [name] => BMW [created] => 2010-08-15 22:44:26 [modified] => 2010-08-15 22:47:04 ) [Owner] => Array ( [id] => 4 [car_id] => 2 [name] => Bob [created] => 2010-08-18 22:15:45 [modified] => 2010-08-18 22:15:45 [user_id] => 1 ) ) [1] => Array ( [Car] => Array ( [id] => 4 [name] => Mercedes [created] => 2010-08-16 21:26:01 [modified] => 2010-08-16 21:26:01 ) [Owner] => Array ( [id] => 4 [car_id] => 2 [name] => Jules [created] => 2010-08-18 22:15:45 [modified] => 2010-08-18 22:15:45 [user_id] => 1 ) ) [2] => Array ( [Car] => Array ( [id] => 4 [name] => Mercedes [created] => 2010-08-16 21:26:01 [modified] => 2010-08-16 21:26:01 ) [Owner] => Array ( [id] => 4 [car_id] => 2 [name] => Simbad [created] => 2010-08-18 22:15:45 [modified] => 2010-08-18 22:15:45 [user_id] => 1 ) ) [3] => Array ( [Car] => Array ( [id] => 4 [name] => Mercedes [created] => 2010-08-16 21:26:01 [modified] => 2010-08-16 21:26:01 ) [Owner] => Array ( [id] => 4 [car_id] => 2 [name] => El Salvador [created] => 2010-08-18 22:15:45 [modified] => 2010-08-18 22:15:45 [user_id] => 1 ) ) )
  4. Hi All, I have an array like this where the cars are the first level of the array, and the owners are children of that first level: [Car 1] ----[Owner 1] [Car 2] ----[Owner 2] [Car 2] ----[Owner 3] [Car 2] ----[Owner 4] I want to convert it to: [Car 1] ----[Owner 1] [Car 2] ----[Owner 2] ----[Owner 3] ----[Owner 4] So I started making this script: $cars = array(); foreach($owners as $owner) { if(!in_array($owner['Car'], $cars)) { $cars[] = $owner['Car']; } echo array_search($owner['Car'], $cars, true); $cars[array_search($owner['Car'], $cars)]['Owner'][] = $owner['Owner']; } The result of this is the same as the beginning result, any ideas what could be causing that?
  5. Hi All, I have a fairly deep array sort I am struggling to get working. Basically, I have a list of topics, which are associated to a message, these messages have a posting time. I would like to sort the topics by the most recent message posting time. I have everything loaded into a single array which looks like this : Array ( [Category] => Array ( [id] => 1 [name] => General [forum_id] => 1 [description] => Feel free to chat about whatever you want ) [Topic] => Array ( [0] => Array ( [id] => 1 [sticky] => 0 [locked] => 0 [message_id] => 1 [category_id] => 1 [last_post_id] => 2 [Message] => Array ( [0] => Array ( [id] => 1 [topic_id] => 1 [user_id] => 3 [time] => 2009-03-23 01:07:15 [subject] => First Forum [body] => This is the body of my first post [modified] => 2009-03-23 01:07:15 [user] => Array ( [id] => 3 [username] => BlackICE ) ) [1] => Array ( [id] => 2 [topic_id] => 1 [user_id] => 2 [time] => 2009-03-23 01:08:15 [subject] => First Forum [body] => I dont know how you make such genius posts [modified] => 2009-03-23 01:07:15 [user] => Array ( [id] => 2 [username] => Chk1 ) ) ) ) [1] => Array ( [id] => 3 [sticky] => 0 [locked] => 0 [message_id] => 4 [category_id] => 1 [last_post_id] => 4 [Message] => Array ( [0] => Array ( [id] => 4 [topic_id] => 3 [user_id] => 2 [time] => 2009-03-23 01:10:15 [subject] => Another Heading [body] => Another post [modified] => 2009-03-23 01:08:15 [user] => Array ( [id] => 2 [username] => Chk1 ) ) ) ) ) )
  6. Its on a local host , Its ok Im going to attempt a slightly different method, ive been playing with this all day, and im about to chuck the computer through the windows, then go round bill gates house and smash him in the face with the biggest shard of glass i can find from my broken window, and then tell him to make IE behave. Thanks for your time.
  7. <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php while ($row = $db->createRowObject($criticReviews)) { ?> <tr> <td style="padding-left: 5px;"><br /> <?php echo("<a href='../publication/reviewers.php?reviewerID=".$row->reviewerID."'>".$row->reviewer."</a>"); echo(" : <a href='../publication/profile.php?id=".$row->publicationID."'>".$row->publication."</a><br /><br />"); ?> </td> </tr> <tr> <td width="88%" rowspan="2" style="border-bottom: 1px solid #6DB09D; padding: 5px;"><p><?php echo("$row->review"); ?></p></td> <td width="10%"> <br /> </tr> <tr> <td height="45" width="10%" align="center" style="border-bottom: 1px solid #6DB09D; background-color:#6DB09D"> <?php if($row->rating < 0) { $rating = "0"; } else { $rating = $row->rating; } echo("<img src='../../inc/img/numbers/".$rating.".gif'/>"); ?> </tr> <?php } ?> </table> Thanks for your help, but still no change =(
  8. <table width='100%' border='0' cellspacing='0' cellpadding='0'> <?php while ($row = $db->createRowObject($criticReviews)) { ?> <tr> <td style='padding-left: 5px;'><br /> <?php echo("<a href='../publication/reviewers.php?reviewerID=".$row->reviewerID."'>".$row->reviewer."</a>"); echo(" : <a href='../publication/profile.php?id=".$row->publicationID."'>".$row->publication."</a><br /><br />"); ?> </td> </tr> <tr> <td width='88%' rowspan="2" style='border-bottom: 1px solid #6DB09D; padding: 5px;'><p><?php echo("$row->review"); ?></p></td> <td width='10%'> <br /> </tr> <tr> <td height="45" width='10%' align="center" style='border-bottom: 1px solid #6DB09D; background-color:#6DB09D'> <?php if($row->rating < 0) { $rating = "0"; } else { $rating = $row->rating; } echo("<img src='../../inc/img/numbers/".$rating.".gif'/>"); ?> </tr> <tr> </tr> <?php } ?> </table>
  9. I have no patience when it comes to designing websites for this exact reason, Firefox displays my table perfectly, and IE displays it wrong. Only its impossible to fix because Dreamweaver and firefox display things the same, and IE is out there on its own! Anyway! Basically I have a table that looks like this.... _________________ | | | | | B | | A |_____| | | C | |_________|_____| I hope that displays OK, basically one big cell on the left, with two rows split on the right. C has to be X high to display correctly, B has to be flexible because the height of A is not set. So in code ive not explicitly stated a height for B, but I have explicitly stated a height for C. In mozilla this displays fine, but in internet explorer the B's height is completely dependent on its content. But because its height cant be set, I cant explicitly say B = 10, I cant say B=100% because then it tries to be the same height as A and messes up Firefox and IE. How can I get around this?
  10. Yeah Only 1 piece though, but if i echo ($data["heading"]; i get the first bit. So the query is working.
  11. [code] if (!$result) { echo("The database could not be accessed at the moment"); } else { $data = mysql_fetch_array($result); } while ($row = mysql_fetch_assoc($result)) { echo ($row["heading"]); }[/code] I thought this would work but no joy so far.
  12. Hi Im trying to display a certain number of results from my database, basically the last 10 entries. $result = mysql_query("SELECT * FROM tblNews LIMIT 0 , 10"); if (!$result) { echo("The database could not be accessed at the moment"); } else { $data = mysql_fetch_array($result); } while($row = mysql_fetch_array($result)) {   echo $row['heading'] . '<br>'; } At the moment I dont get any results, where am I going wrong? 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.