Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. you'd do it this way...for dynamic variables [code]$arrays = "graphValues" . $c; $$arrays[]=$row['RATING'];[/code] but yeah kenrbnsn is right a multi-dim array would work more smoothly
  2. you could much easier do the IF in the query itself like so [code] $sql = " IF ( SELECT name FROM bUser where name = '$name' IS NULL ) THEN      INSERT INTO bUser Values ('$name','$mail'); ELSE      UPDATE bUser SET email = '$mail' where name = '$name'; END IF; "; mysql_query($sql);[/code] I think that should work
  3. you can get a zip code database here [a href=\"http://civicspacelabs.org/home/releases/civicspace/civicspace-0.8.3.zip\" target=\"_blank\"]http://civicspacelabs.org/home/releases/ci...space-0.8.3.zip[/a] download it, extract it, and look through the folders for the zipcodes.sql file or something like that you'll have to INSERT them like 400 to 600 at a time on your MySQL server depending on your CPU speed. but that's a place to find the zipcodes and there a plenty of free script templates for distance most all free it's about 7 or so lines of code
  4. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]do you mean creating a function on-the-fly???[/quote] I think he means that he wants to call functions from within a function just do it like you think you would [code] function Test() { return "function 1"; } function Test2() { return "function 2"; } function MainFunction() {   $msg = Test();   $msg .= Test2();   return $msg; } echo Main(); //returns function 1function2 [/code]
  5. try doing it like this $sql = mysql_query("INSERT INTO elemento ( ele_tec, valor, id_potencia) values ('[b]{$ele_tec}[/b]', '[b]{$valor}[/b]','[b]{$id_potencia}[/b]')"); note the curly braces
  6. really...you don't need a testing server a testing server is for when you are publishing to a remote server you create a testing server that is....hopefully...identical in it's settings....so you know [b]before[/b] you publish it if it will work but since you're doing it on localhost you just need to tell it where you're local files are and just...forget about the testing server or cloaking server or anything else besides your local files.
  7. The most blunt question is.. "What would you like to see on the page"... so you can rule out what will be script and what you really have to worry about...what's being displayed If they can't answer then ask What they're offering on the site....that's so special they need a site. It's pretty much winging it anyway you go but sometimes the dumbest questions in your perspective turn out to give the best answers.... I always bring a paper and pencil with me to map out where certain things could go.....in front of them Good Luck PS...this isn't a PHP question, I'm moving it to the Misc forum please watch where you post
  8. you can use the parse_str function to separate all you're vars if I think that's what you want to do [code]print_r(parse_str($_SERVER['REQUEST_URI']));[/code]
  9. somewhere in your equip_list.php file you are telling it to do something like this I assume [code]$sql = "SELECT * FROM sometable WHERE subcat = '" . $_GET['subcat'] . "'";[/code] you need to have it do this instead [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$sql = "SELECT * FROM sometable WHERE subcat [b]LIKE [/b]'" . $_GET['subcat'] . "'";[/quote] so just change you link to go to [a href=\"http://www.rcubed.com/equip_list.php?item_code=SONIC&sub_cat=app%\" target=\"_blank\"]http://www.rcubed.com/equip_list.php?item_...IC&sub_cat=app%[/a] after you have changed your PHP script
  10. Zane

    Problem

    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Also the code is really long and i need to add about 8x more stuff in so i was wondering if anyone could shorten it a bit please.[/quote] you can't just post code and ask us to fix it up for you.... you need to shorten it yourself and then explain what you need help on and FYI your problem is that you're putting the row for NAME PRICE etc inside your while loop start the table first then put the while loop and end the table after the loop
  11. you're topics being moved to the CSS Forum
  12. hmm....learn something everyday well I guess you'd have to do this then wolves [code] class foo {   public $string = foo::bar();   public function __construct($str = $this->string) {            echo $str;     }   public static function bar() {       return "hello";   } }[/code] notice it's still static
  13. how are you sending the Search to the URL first of all and secondly what code are you using to Search from the url helps more if you provide some code my guess is that when you are searching from what's shown in the URL you're assuming subcat is always equal to it's value it that's the problem you should have it look at the value.....(likeapp%)...first and then tell it to say..... WHERE subcat LIKE 'app%' instead of WHERE subcat = 'likeapp%' LIKE works just as good as equals...especially when you're going to be using wildcards
  14. I would think that would work at first glance, but class integration with a regular PHP file is kinda hectic anyway I would say if it doesn't work, you could *grits teeth* make it global most of the time it's not a good idea to make things global but if it works it works and the best alternative I could think of would be to make the function bar just a static method in your class but that just depends on how much bar() has to do with the class at all see example [code] class foo {   public function __construct($str = foo::bar()) {            echo $str;     }   public static function bar() {       return "hello";   } }[/code] [!--quoteo(post=362550:date=Apr 7 2006, 11:29 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 7 2006, 11:29 AM) [snapback]362550[/snapback][/div][div class=\'quotemain\'][!--quotec--] You cannot call a function when when using parameters. [/quote] are you sure....I've never ran into such a problem as what wolves is doing but I would think that you could very well use a function to declare an argument value it works for any other function [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] echo date("g:m", [!--coloro:#FF6600--][span style=\"color:#FF6600\"][!--/coloro--]strtotime()[!--colorc--][/span][!--/colorc--]) [/quote] but maybe classes are a different story I dunno...I'm not on my own machine
  15. on your input boxes..the HTML part change the name of each box to something like whatever[]...note the brackets the when the form is sent you'll have a 0 to 15 list of all the input in an array called whatever [code]A<input name='stuff[]' type='text'> B<input name='stuff[]' type='text'> C<input name='stuff[]' type='text'> D<input name='stuff[]' type='text'> //$stuff[2] would be the C one [/code] anyway...once you do that...do a foreach loop with it to make sure each one is unique and if it is just continue if not.....stop everything I guess and throw your error say [code]foreach($stuff as $val) [ if(in_array($val, $stuff))    die("ERROR"); }[/code]
  16. Yes, you can do this Same script but modified [code]function loop_thing(){ //sql query stuff here $results = array(); $i = 0; while($row = mysql_fetch_array($sql_r, MYSQL_NUM)){      $results[] = $row[$i]; } return $results; } //then to output: $results = loop_thing(); echo $result[0]. "<br>"; echo $result[1]. "<br>"; echo $result[2]; [/code]
  17. the header function has to be used before ANY output to the browser and all this is output [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<p> </p> <form name="form1" method="post" action=""> <p>login (email): <input type="text" name="em"> <input name="pass1" type="password"> <input name="submitf" type="submit"> <input name="resetf" type="reset"> </p> </form> <p> </p>[/quote] I'm surprised you're not getting a "Cannot modify header" error
  18. use the is_null() function [code]if(is_null($var) || is_null($anotherVar))[/code]
  19. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]I was wondering how you guys made the code block[/quote] well...we didn't make it first of all and most likely regex was used to do it all it is is it replaces stuff between [code] with a formatted div tag whilst removing the code tag and then they CSS to make it look prettier
  20. This could work as well it will delete every key that has a matching one in the other table...leaving the 'unrelated' ones as I assume you wanted [code] DELETE FROM cvs, jscvs USING cvs, jscvs WHERE cvs.id = jscvs.id;[/code]
  21. go to [a href=\"http://php.net/addslashes\" target=\"_blank\"]http://php.net/addslashes[/a] and learn the function it should fix it all up
  22. I wonder if this works...try it [code]strtotime("7 hours 30 minutes", strtotime("8:30"));[/code]
  23. I bet the message is parsed before it's added to the database and the PHP parts were just formated beforehand using regex or something, that would explain why the quote tags from way back are different too see check it out [a href=\"http://www.phpfreaks.com/forums/index.php?s=&showtopic=34590&view=findpost&p=126084\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...ndpost&p=126084[/a]
  24. could you just convert it to UNIX timestamp and do a couple date/time functions [code]date("g:i", strtotime("8:30 + 7 hours 30 minutes"));[/code]
  25. [!--quoteo(post=360123:date=Mar 30 2006, 02:44 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 30 2006, 02:44 PM) [snapback]360123[/snapback][/div][div class=\'quotemain\'][!--quotec--] Please tell me that this is all generated from the same page and you just want to look at the status of a field in a database of all your users. [/quote] I think, no I'm pretty sure that he's trying to phish data from a database he doesn't have access to. [!--quoteo(post=360123:date=Mar 30 2006, 02:44 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 30 2006, 02:44 PM) [snapback]360123[/snapback][/div][div class=\'quotemain\'][!--quotec--]Otherwise, that's gotta be the worst design of a website I've ever heard of. [/quote] These forums are laid out such a way.....for instance, the 'newbies'. 'lurkers', and 'gurus' all have a significant field value on their profile...wouldn't be too hard to just do a loop, but it would take such a long time
×
×
  • 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.