Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. You could try using str_replace to first set them to something else such as and then after you take out the rest, replace them back.
  2. $query = mysql_query("SELECT * FROM $table WHERE 'firstname' LIKE '%$searchin%' OR 'lastname' LIKE '%$searchin%'"); if(mysql_num_rows($query){ while ($row = mysql_fetch_array($query)){ $variable1=$row["id"]; $variable2=$row["firstname"]; $variable3=$row["lastname"]; print ("$variable1, $variable2, $variable3, <br>"); } }else{ print ("$XX"); print(" for $searchin");//another test...fine }
  3. Gah, sorry to bump again, just wanted to add this: What I NOW have done is just use the $a->attribute since it was just one value. The __toString() would be valuable here if I were returning more, such as all of the variables concatenated. However, in this case it's a bit of overkill for what I was trying to do.
  4. What I ended up doing is changing the point of my function so instead of returning a string which I could print later, it just prints the values itself. What I had was: if(count($atts)){ $str = ''; foreach($atts AS $v){ $str .= $v. '<br />'; } return $str; } Change to: if(count($atts)){ foreach($atts AS $v){ print $v; print '<br />'; } } I tried typecasting with (string), using {} syntax, everything I could think of. If anyone ever figures out a way to do this...post!
  5. The girls who would be "repelled" just because you're a geek aren't the kind you want to be with anyway. My husband is the one who got me started in PHP, and I love the fact that he can help me, or understand what I'm doing, and I sorta get what he does
  6. Well I feel silly Thanks Paul. Now I have to figure out how to do it...
  7. I think it's because you're passing it as a copy, not by reference. It gets confusing, but read this chapter: http://us3.php.net/manual/en/language.references.php and http://us3.php.net/manual/en/language.references.pass.php
  8. I am trying to use the PHP5 magic function __toString() (Doc: http://us2.php.net/manual/en/language.oop5.magic.php) in some of my classes, and it isn't returning what I specify, it returns the object ID number. Here's what I have: Class Attribute{ var $attributeID; var $attribute; function __toString(){ return $this->attribute; } } Now, when I try to use it here, when $atts is an array of Attributes() if(count($atts)){ foreach($atts AS $v){ print $v.'<br />'; } } I get stuff that looks like this: Object id #4 Object id #7 But if I do print $v->attribute.'<br />'; It shows up properly as Color Size So, what's the dilly-yo? I made sure it's running PHP5, but even if it were PHP4 it should still work when I do the print, yeah?
  9. I've never done it, so I can't say which I prefer. By the way, those are arrays, not tables. MySQL and HTML can have tables, but PHP doesn't...what you have there is an array.
  10. I know the Application Design/Layout forum mentions OOP, but it also says (No coding help). I think we should have a PHP OOP forum, just for dealing with issues in OOP programming, that IS for coding help.
  11. It looks like whenever you try to use $results, it's saying it's a string. What happens when you print count($results), or try to do a foreach($results AS $r){ }
  12. PHP doesn't quite work like that...It doesn't run until something, it runs until it hits the end of the page, then that's it. To make it do more "stuff" you have to reload the page (or use ajax, blah blah blah). So it wouldn't be while(), it'd be if($entered != 'quit'){
  13. Yes, what did it show when you used what I wrote? Post your new code and the results.
  14. So the one with BOAT in it is $boat = $results[1]; Then six is $boat['value'];
  15. there is no value with the key of boat. What are you trying to get? So it tries to get the first letter of the string $results, which is A.
  16. You need the or die(mysql_error()) part after your mysql_query() too.
  17. roopurt, I'm not sure where you got that - my blog's CSS isn't mine, it's a wordpress theme. Edit: and actually I don't even see that in there. Or in my portfolio's CSS. I guess you weren't talking to me?
  18. Check out this: http://us3.php.net/manual/en/reserved.variables.php 'HTTPS' Set to a non-empty value if the script was queried through the HTTPS protocol. Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol. So you can use $_SERVER['HTTPS'] thorpe - he thanked me! If I make a mistake, I'd rather know about it than continue to make it. Obviously he speaks some english and uses it enough that he can post here, so better to know and learn than to keep using the wrong words. If a kid always says blue for red, you correct them and they learn, you don't just let them think red is blue. PS: You said gramer :-P
  19. Since I already had the CSS from the last time, it just took me the few seconds to recolor the image
  20. I have no idea, but your grammar makes it very hard to understand. I think you mean "to no avail". know is something you do with knowledge. No is the opposite of yes. prevail is something that keeps on going, avail is something of use.
×
×
  • 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.