sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
[SOLVED] PHP / MYSQL - 2 COL Result Formatting
sasa replied to xchristensen's topic in PHP Coding Help
if the $num is 9 then $split_num is 4.5 but $i is 1 or 2 or 3 or 4 or 5 and so on $i == $split_num is newer true -
[SOLVED] PHP / MYSQL - 2 COL Result Formatting
sasa replied to xchristensen's topic in PHP Coding Help
ups change $split_num = $num/2; to $split_num = floor($num/2); -
[SOLVED] PHP / MYSQL - 2 COL Result Formatting
sasa replied to xchristensen's topic in PHP Coding Help
change <?php if ($i == $split_num) echo '</td><td>'; $i++; } to <?php if (++$i == $split_num) echo '</td><td>'; } -
try $getvid = preg_replace('/<\s*style.+?<\s*\/\s*style.*?>/', ' ', $getvid );
-
create $new_string when you create $mystrimg [while ($row = mysql_fetch_assoc($query)) { $mystring[] = "<font color='#000099'>".$row ["lastName" ]." "."</font>"."<font color='#663399'>".$row ["firstName" ]."</font>".", "."<font color='#0033CC'>".$row ["school" ]." - ".$row ["year" ]."</font>"."<br />"; $new_strings[] = "&a=".row['lastName']."&b=".row['firstName']."&c=".row['school']."&d=".row['year']; } and foreach($new_strings as $new_string) print $new_string;)
-
change name property to "abc[]"
-
just for debug
-
no, it just chek is it input an array it is recursive function it is build that first solve the simple problem (if input is NOT array just return it (else part)) recursive step: if is array build new array ($out) with values of input array and before add vallue ($v) in $out array rebuild key for it
-
try echo $sql = "UPDATE $table SET pagecontent = '".$_POST['T']. "' WHERE id = ".$_POST['id2'];
-
try <?php function reorder_key($a){ if (is_array($a)){ $out = array(); foreach ($a as $v) $out[] = reorder_key($v); } else $out = $a; return $out; } $list = array( '0'=>array( 'one', 'two', 'three' ), '1'=>array( '001', '1', 'c' ), '2'=>array( '001', '2', 'f' ), '3'=>array( '002', '3', 'i' ), ); unset($list[1][0]); $list = reorder_key($list); print_r($list); ?>
-
can anyone see why this checking script is not working correctly
sasa replied to madspof's topic in PHP Coding Help
are you look for directory 'dir'? if not change to if ( dir_exists($dir) ) { for dir 'madspof' -
use serialize() and unserialize() functions try <?php $array = array ( "0"=>array ( "0"=>array ( "Date", "ID", "Family" ), "1"=>array ( "Date", "ID", "Family" ) ), "1"=>array ( "0"=>array ( "Date", "ID", "Family" ), "1"=>array ( "Date", "ID", "Family" ) ), "2"=>array ( "0"=>array ( "Date", "ID", "Family" ), "1"=>array ( "Date", "ID", "Family" ) ) ); $ser_arr = serialize($array); print_r($ser_arr); $unser_arr = unserialize($ser_arr); echo "\n<br />\n"; print_r($unser_arr); ?>
-
can we see some data or we most look in cristal sphere
-
how $forum_replies look like can we see some data and what you want for output
-
try $qry = mysql_query("SELECT * FROM bodycare WHERE bodycare.avail='true' UNION SELECT * FROM haircare WHERE haircare.avail='true' LIMIT $startrow, $limit")or die(mysql_error());
-
variable $prayer is array and you can not do some math with it in your example it is array( 146, 99, 14019128) try <?php $username = $_POST['username']; $website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player='.$username); $stats = explode("\n", $website); //print_r($stats); $overall = explode(",", $stats[0]); $attack = explode(",", $stats[1]); $defence = explode(",", $stats[2]); $strength = explode(",", $stats[3]); $hitpoints = explode(",", $stats[4]); $range = explode(",", $stats[5]); $prayer = explode(",", $stats[6]); $magic = explode(",", $stats[7]); $cooking = explode(",", $stats[8]); $woodcutting = explode(",", $stats[9]); $fletching = explode(",", $stats[10]); $fishing = explode(",", $stats[11]); $firemaking = explode(",", $stats[12]); $crafting = explode(",", $stats[13]); $smithing = explode(",", $stats[14]); $mining = explode(",", $stats[15]); $herblore = explode(",", $stats[16]); $agility = explode(",", $stats[17]); $thieving = explode(",", $stats[18]); $slayer = explode(",", $stats[19]); $farming = explode(",", $stats[20]); $runecrafting = explode(",", $stats[21]); $hunting = explode(",", $stats[22]); $construction = explode(",", $stats[23]); //calculate base combat if ($prayer[1] & 1) { $prayer[1] = ($prayer[1] - 1)*50; } else { $prayer[1] = $prayer[1]*50; } $base_combat = ($defence[1]*100 + $hitpoints[1]*100 + $prayer[1])/400; //calculate personal class combats for melee, ranged and mage if ($range[1] & 1){ $range[1] = $range[1]*195-65; } else { $range[1] = $range[1]*195; } if ($magic[1] & 1){ $magic[1] = $magic[1]*195-65; } else { $magic[1] = $magic[1]*195; } $melee_combat = ($attack[1]*130 + $strength[1]*130)/400; $range_combat = $range[1]/400; $mage_combat = $magic[1]/400; //calculate final class combat (get max personal combat) if ($melee_combat >= $range_combat & $melee_combat >= $mage_combat) { $class_combat = $melee_combat; } elseif ($range_combat >= $melee_combat & $range_combat >= $mage_combat) { $class_combat = $range_combat; } else $class_combat = $mage_combat; //finalize combat level $combat_level = $class_combat + $base_combat; echo $combat_level; ?>
-
try <?php $whole_string = 'cmd=_notify-validate&mc_gross=15.00&address_status=confirmed&item_number1=&payer_id=6DTZKXWN73SLS&tax=0.00&address_street=1+Main+St&payment_date=02%3A53%3A38+Aug+29%2C+2007+PDT&payment_status=Pending&charset=windows-1252&address_zip=95131&mc_shipping=0.00&mc_handling=0.00&first_name=Test&address_country_code=US&address_name=Test+User¬ify_version=2.4&custom=&payer_status=verified&business=seller_1187360634_biz%40jasonstanley.co.uk&address_country=United+States&num_cart_items=1&mc_handling1=0.00&address_city=San+Jose&verify_sign=AiPC9BjkCyDFQXbSkoZcgqH3hpacAJvfpUVvvwMlmlDbAyd2PSFZvIlt&payer_email=contac_1187360562_per%40jasonstanley.co.uk&mc_shipping1=0.00&txn_id=2XR83823PR178182S&payment_type=echeck&last_name=User&address_state=CA&item_name1=Call+Out+Fee+for+14%3A00+on+29%2F8%2F2007&receiver_email=seller_1187360634_biz%40jasonstanley.co.uk&quantity1=1&receiver_id=7SLSUMDBHZCFY&pending_reason=echeck&txn_type=cart&mc_gross_1=15.00&mc_currency=USD&residence_country=US&test_ipn=1&payment_gross=15.00'; preg_match('/item_name1[^&]+/', $whole_string, $out); $part = $out[0]; echo $part; ?>
-
try $flds = array( 'item_num' , 'item_desc' , 'item_qty' , 'emb_loc1', 'num', 'size', 'artwork'); for($i=0;$i<count($num2);$i++) { $qtmp = array(); foreach($flds as $fld){ if (trim(stripslashes($_POST[$fld][$i])) != ''){ $qtmp[] = $fld . " = '" . mysql_escape_string(trim(stripslashes($_POST[$fld][$i]))) . "'"; } } // $q = "UPDATE c_or_details SET " . implode(', ',$qtmp) . " WHERE `subitemnum` = '$num2'"; $q = "UPDATE c_or_details SET " . implode(', ',$qtmp) . " WHERE `subitemnum` = '" . $num2[$i] . "'"; $rs = mysql_query($q) or die ('Problem with 1 the query: ' . $q . '<br>' . mysql_error()); echo "$q<br /> <br />"; } }
-
can you use echo str_repeat('test', 10);
-
Exporting database to Excel (via website, NOT phpMyAdmin)?
sasa replied to Edward's topic in PHP Coding Help
change x:str from <table ..> tag (<table x:str border=0 cellpadding=0 ...) to x:num big number will be importen in scient form or you can use x:str and x:num in <td ...> tag -
you have $GetUserName = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); it puts result objects in variable $GetUserName, but in next line you fatch variable $GetUserID
-
i try <?php $nsubject = 'subject=" subject="+65+654subject="subject="'; $matchesfound = preg_match_all('/subject="/', $nsubject, $matchfound); echo $matchesfound; ?> and return is 4
-
1st If ($Selection = 1 ) { ia allways true (do you mine $Selection == 1) 2nd $query = "SELECT * FROM userregistration WHERE Username='$Username'"; $GetUserName = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); if (!($row = mysql_fetch_assoc($GetUserID))) { // change $GetUserID to $GetUserName see line before die('This Username does not exist!'); }
-
try $matchesfound = preg_match_all('/subject="/', $nsubject, $matchfound); echo $matchesfound;
-
[SOLVED] convert mysql_fetch_array to string variable?
sasa replied to datafan's topic in PHP Coding Help
try $getmail = mysql_query("SELECT email FROM users", GetMyConnection() )or die(mysql_error()); while ($allmail = mysql_fetch_array($getmail)){ $to[] = $allmail['email']; //$to = THIS IS WHERE I NEED HELP; } $to = implode(', ',$to); echo $to;