Jump to content

DarkSuperHero

Members
  • Posts

    342
  • Joined

  • Last visited

Everything posted by DarkSuperHero

  1. coma separated values, you can use, the following functions, <?php $filename = 'somefile.txt'; //csv file $delimeter = ','; //the stuff separating the values $csvstring = file_get_contents($filename); //reads a files contents into a string.... $csvarray = explode($delimeter, $csvstring); print_r($csvarray); //prints readable contents of the array /* print_r outputs the following: array([0] => 'value1', [1] => 'value2', [2] => 'value3', ......and so on.... to only display certain value you would sort through the csv array, using other functions that would help you sort, like preg_match(), strstr(), strpos(); in_array(); ect... :-) */ hope that helps some... :-)
  2. No wonder, since no such thing exists. Returns 1000000 here... hahahhaha oops, isn't there a name for it ? i might be getting names for this confused... :-P
  3. <?php $n = (int)4.39518e+7; //YOUR NUMBER to start $m = (float)4.39518e+7; echo $m; echo $n; /* returns the following on script ran by Zend Studio IDE. 43951800 43951800 */ ?> PHP Hard Type Variables...not very common, yet.... :-P
  4. well, if anything I think handlers is the only one i had trouble with remotely, other than the if(function_exists($f)) statment. I would suggest changing @mysql_query to just mysql_query i would want error reporting off on something when im debugging.....but i didnt see anything "wrong"... try commenting out blocks of code, to find the source of the trouble...
  5. try the following; <?php $n = 4.39518e+7; //YOUR NUMBER printf("SCINO = '%e'\n", $n); //%e specifies sci-notation printf("FLOAT = '%d'\n", $n); // %d specifies decimal ?> http://us2.php.net/sprintf
  6. i believe most Servers/Host do not allow external MySQL connections. If that is the case I would suggest runing a PHP/MYSQL installation on your computer, try XAMMP or EasyPHP both are easy install, low maintanance, great for development/testing/learning enviornments.
  7. i'll rewrite the script, and do what i'm trying to explain... :-) anyways ill post it tomorrow sometime, but for now I have other things i need to attend to :-).... ill see ya tomorrow... :-P
  8. get what I am trying to get at ? Your asking the script to choose a different image everytime...you need to somehow keep track of what type of card was chosen before the current card. like you keep track of the number the card was in the session....
  9. what about... <img src="http://gangster.game-design.djw-designs.com/images/Cards/<?=$img."-".$card_type[rand(0,3)]?>.gif"> is that snippet, saying choose a random image type? eg; pick a random type (CLUBS, HEARTS, DIAMONDS, or SPADES) and "show it".... hence you have different card type every time it refreshes ?
  10. i believe that everytime you use: shuffle($card_type); it changes the keys of the array, so that you no longer have what you started with... <?php $card_type[0] = "c"; $card_type[1] = "d"; $card_type[2] = "h"; $card_type[3] = "s"; changes to: $card_type[3] = "c"; $card_type[2] = "d"; $card_type[1] = "h"; $card_type[0] = "s"; // (randomizes, so the key gives a diff value every time)
  11. I would start by determining what information I would store in the MySQL Database, Here's a simple Table layout for possible entry.... IDNAMESUBMITTEDAUTHORSTATUS 1PHP-GTK12-21-08PEARSON0 2PHP-GTK212-25-08PEARSON1 Next i would go about creating a form for possible file upload/other information eg; <form action="" method="POST" > <input type="text" name="project" value="" /> <input type="text" name="author" value="" /> <input type="file" name="file" value="" /> <input type="submit" name="submit" value="" /> </form> /* you would process the upload, or data, and pass it into the database....at which point the user part of this would be complete... You would simply extract the data from the database and create approve/disable links from an admin page, which would then call another piece of php to edit the given value of the table for the given item... :-) */ Hope this kinda makes sense... are you trying to make this as a stand alone script ? or making part of a greater, already active project ?
  12. nice arguments for checking user credentials on every page, maybe you could implement a conditional credential check....maybe on pages where the user may edit and delete any entries you might want to double check his credentials...not really necessary on every single page IMO, each to his own...
  13. You Could try obtaining all names from the database and then using a series of array and string functions to order them to your liking... :-)
  14. have you thought of making your own function to cut off the extra numbers after 2nd significant number after the decimal? that would probably be the best solution....use a combination of explode() and substr() ....
  15. if he did want that one there then he has an extra } at the end of his code.... ...I love Zend Studio its so awesome! found the "mistake" very quickly...
  16. im a bit confused as to what your trying to do....are you; a) trying to send out single e-mail to multiple clients with their unique individual invoices b) trying to build the html for the invoice then sending it to a single client, then (a). ? ///before this you connect and query the database for the certain user this might be put inside a loop $body = "<table>"; while ($row = mysql_fetch_row($result)) { $body .= "<tr>"; $body .= "<td>"; $body .= $row[1]; $body .= "</td>"; $body .= "</tr>"; }; $body .="</table>"; $to = $some_one; $subject = "Your Invoice For Order: ".$orderid; $headers = "The headers"; mail($to, $subject, $body, $headers); //close possible outer loop....and continue to next client.... hope that kinda makes some sence....
  17. I agree with the above responses...also learn to format your code and indent...it makes it easier to read, and spot errors...get a syntax highlighting editor like ConTEXT, or programers notepad, if at all possible Zend Studio is phenomenal! anyways before your first "elseif" you have an extra } i dont think you meant to have that there....and also one of your comments isnt escaped with //.... anyways here the "fixed" code...hope this helps you solve your issue.... <?php if(in_array($search_where2,$search_where3)){//check if allowed search if($search_where==$search_allowed[1]){ //this works if i search for$search_allowed[1] $query = "SELECT * FROM "; $query.='chess_events'; $query.=" WHERE "; $query.='event_name'; $query.=" LIKE \"%$trimmed%\" "; $query.=" ORDER BY "; $query.=$order_by; } elseif($search_where==$search_allowed[2]){//this doesnt work $query = "SELECT * FROM "; $query.='chess_location'; $query.=" WHERE "; $query.='name'; $query.=" LIKE \"%$trimmed%\" "; $query.=" ORDER BY "; $query.=$order_by; } elseif($search_where==$search_allowed[3]){//not tested yet $search_table='chess_news'; $search_where4='title'; $query = "SELECT * FROM "; $query.='chess_news'; $query.=" WHERE "; $query.='title'; $query.=" LIKE \"%$trimmed%\" "; $query.=" ORDER BY "; $query.=$order_by; } else{ echo'Error on Line 129: Error Matching Location to Search'; } // Build SQL Query $numresults=mysql_query($query)or exit('Error on Line: 144'); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0){ echo "Sorry, your search: "" . $trimmed . "" returned zero results"; $search_error=665; echo'Error on Line: 145'; } // next determine if s has been passed to script, if not use 0 if (empty($_REQUEST['s'])) { $s=0; } elseif($_REQUEST['s']>=0){ $s=$_REQUEST['s'];}else{$s=0; } // POST results $query .= " LIMIT $s,$limit"; $result = mysql_query($query) or die('Error on Line: 158'); } ?>
×
×
  • 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.