Jump to content

jefkin

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jefkin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Agreed Ken, That's a lot easier to understand and maintain. Jeff
  2. More appropriate to post the code that changes the user's image. Probably all you need to do as the last thing in the part that verifies the new image is set $_SESSION['profile_pic'] to their new image. then just to be safe call: session_write_close(); and refresh the page to wherever you need it. Jeff
  3. I've seen this error many times. It means that the variable you sent to the foreach isn't an array. This can usually be fixed by changing code like [code] if ($myCond) {     $myArray = somefunc(); } foreach ($myArray as $elem) {     // .... } [/code] into code with a preset default for the var (an empty array). [code] $myArray = array(); [/code] Trust me on this, that eror only occurs when some path to your foreach doesn't let the variable become an array. Jeff
  4. you can create an access method in class b class B extends A {   /// your stuff   function A_Hello()   {       parent::sayHello();   } } For a non invasive means, if A's sayHello method doesn't involve any class variables, you can say A::sayHello(); But the first is probaly a safer bet for anything non-trivial, and deffinitely for any method that uses class variables (instance variable).  Sometimes Global class variables will be okay. So, the absolute safest way is the first one.  Use that if at all possible. Jeff
  5. If I understand your problem, then replaceing your quoted code with my sample should work for you. So, How about foreach?  And, there's no need for the $daysMale and $daysFemale array  (along with some other stuff) [code] // your database fetch, assuming you still build $monMaleAge, $tueMaleAge, etc... $days  = array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'); $ages  = array('Teen' => 'teen', '18+' => '18', '21+' => '21'); foreach ($days as $day) {     $varDB                = "{$day}MaleAge";     $daysMaleImage[$day]  = "<img src=\"images/M{$ages[$$var]}.gif\" width=\"21\" height=\"18\" />";     $varDB                = "{$day}FemaleAge";     $daysFemaleImage[$day] = "<img src=\"images/F{$ages[$$var]}.gif\" width=\"21\" height=\"18\" />"; } // to output your built arrays: echo "<table><tr><th>Day</th><th>Male</th><th>Female</th></tr>\n"; foreach ($days as $day) {     echo "<tr><td>$day</td><td>{$daysMaleImage[$day]}</td><td>{$daysFemaleImage[$day]}</td></tr>\n"; } echo "</table>\n"; [/code] If this doesn't do quite what you want, it should be close, though, I didn't actually test it. Jeff
  6. Um, what about 37  do you want 37.00 or 37.0  ??? Do you mean signifigant figures? How about .00002323  do you want .000  or do you want .0000232 round() provides some functionality you might find useful. Jeff
  7. [code] $sigfig = 2; for ($i = 2; $i < 15; $i ++) //  use a bigger number if 15 is too small {     $var  = "col$i";                        // store the working var name col2, col3, etc...     $$var = round($$var, $sigfig); // set and round the variable named 'col2', 'col3', etc... } [/code] Jeff
  8. Hi lJesterl change the echo code bit from: [code] for ($i=0; $i <$num_results; $i++) { $row = mysql_fetch_array($result); echo"<tr>"; echo"<td>"; echo ($row["ip"]); echo"</td>"; echo"<td>"; echo ($row["entries"]); echo"</td>"; echo"</tr>"; } [/code] to [code] for ($i=0; $i <$num_results; $i++) {   $row    = mysql_fetch_array($result);   $iplist .= "<tr><td>{$row['ip']}</td><td>{$row["entries"]}</td></tr>"; } [/code] Jeff
  9. Hi bob_the_builder, trim()  only removes leading and trailing spaces from the string, so: "    Hello  World      " is changed to "Hello World" And "  MY      name      is      Jeff  " becomes "MY      name      is      Jeff" As for your second question, if your data is numeric, and simple, such as $_SESSION['user_id'] as an integer, then there's no need to 'clean' it. Generally if you're passing complicated data, including spaces, or funky chars, then you use $my_url = "index.php?action=user&user_id={$_SESSION['user_id']}&my_funky_chars=" . urlencode($_SESSION['funky_chars']); Doe that cover it ? Jeff
  10. For a one time fix for your articles, first look in the database and find out your authorid.  For my example, I'm assuming your authorid is 133, if you have a different one (probably) just change the SQL below to use your number instead of 133. then from mysql or from MysqlAdmin of your favorite flavor, run this command: [code] UPDATE articles SET visible = 'Y' WHERE authorid = 133; [/code] This will enable all your articles. HTH Jeff
  11. Hi Tunnleram, looks like you need to change this line: [code] $query = "INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) VALUES ('localhost', '$username', PASSWORD('$password'), 'Y', 'Y', 'Y')"; [/code] into this: [code] $query = "INSERT INTO user (host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', '$username', PASSWORD('$password'), 'Y', 'Y', 'Y')";                                                                             ^^^^^^^^^^^ [/code] The 'update_'  and the 'priv' need to go together!! Jeff
  12. Slight typo, I think onlyican, [quote author=onlyican link=topic=107532.msg431588#msg431588 date=1157893699] [code] <?php function getImap() { global $servername; global $username; global $password; $mbox = imap_open("{".$servername.":110/pop3/notls}INBOX", $username, $password); return $mbox; } $mbox = getImap(); $mcheck = imap_check($mbox); $mnum = $mcheck->Nmsgs; $overview = imap_fetch_overview($mbox, "1:$mnum", 0); ?> [/code] [/quote]
  13. A minor suggestion, onlyican, If you want to avoid javascript, You could save the entered data in a mysql table, then let the browser load right on top.  Once the user's selected the recipient, you can retrieve it. Another way that might fit the bill better:  To acomplish almost the same thing you could use sessions.  So once they hit the 'select user' button or whatever, it saves the entered stuff in the session and opens the recipient chooser page.  The chooser page let's them pick and when they resubmit, grab their stored session data and display it along with the user. HTH Jeff
  14. to echo it, change this: [code] while ( $arr = mysql_fetch_array($res) ) eval($arr[0]); [/code] to this: [code] while ($arr = mysql_fetch_array($res)) {   echo "<pre>{$arr[0]}</pre>\n";   eval($arr[0]); } [/code] It will still die at the same place, but your ouput should include a bunch of  *whatevers* you keep in 'Conf' field in the database table Modules. when it dies, look at the last output before the death, and count down to line 13...  That's your error. Jeff
  15. You may be right tleisher, but without his code, I just guessed that he's having a problem retrieving the '\' on the php side.  before he could get to it with a str_replace(). Maybe I missunderstood.  If so, appologies rshadarack. Otherwise, I'm thinking the problem is he's got magic_quotes or some such set to muddle with his form input strings. Like I said, could be wrong... Jeff
×
×
  • 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.