Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. remove line 8 $imgID = $_GET['imgID']; $mdl = $_GET['mdl']; $clixpix = array(); mysql_select_db($database_stool, $stool); $query = "SELECT * FROM PRODUCT_IMAGE WHERE ITEM_KEY = '$mdl' AND IMAGE_TYPE_KEY = '1' AND ACTIVE_STATUS_KEY = '1' ORDER BY PROD_IMAGE_KEY ASC"; $sql = mysql_query($query) or die('Crapped Out Here' . mysql_error()); //$result = mysql_fetch_assoc($sql); <-- remove this line $count = mysql_num_rows($sql); while($result = mysql_fetch_assoc($sql)) { //$img = $result['IMAGE_URL']; array_push($clixpix, $result['IMAGE_URL']); } for($i=0; $i<$count; $i++) { echo "<font color=\"#FF0000\">ARRAY : [ " . $i . " ]" . $clixpix[$i] . "<BR>"; }
  2. try //query = " SELECT " .$select_cols . " FROM " .$_SESSION["nomtab"]. " "; //$result = mysql_query($query); //$num_types = array( 'NUMERIC', 'DECIMAL', 'INTEGER', 'SMALLINT', 'FLOAT', 'REAL', 'DOUBLE PRECISION'); $out .=$first_row ? "<tr>\n" : ''; $result = explode(',', $select_cols); //while ($row = mysql_fetch_array($result)){ foreach($result as $field){ $f_name[] = trim($field);; $out .=$first_row ? '<td class=xl2216681 nowrap><b>'.trim($field).'</b></td>'."\n" : ''; } $out .= $first_row ? "</tr>\n" : '';
  3. change $Username = mysql_real_escape_string($_POST['Username']); to $Username = mysql_real_escape_string($_POST['Editbox1']); or change name property to Username
  4. can you ecko $Username; before start query i think that $Username is not set
  5. change line print <<<NEW //The Main Links to print <<<NEW no spaces after NEW
  6. try and see <?php $a = array('aa','bb','cc','dd','ee','ff','gg','hh','ii','jj','kk'); unset($a[2]); echo "\n<br />\n"; print_r($a); //after you can rebuild keys $a = array_values($a); echo "\n<br />\n"; print_r($a); ?>
  7. try $result = mysql_query('DESCRIBE table_name'); while ($row = mysql_fetch_array($result)){ echo $field_name[] = $row['Field']; } i put names of fields in array in same time
  8. look http://www.phpfreaks.com/forums/index.php/topic,155530.0.html
  9. SELECT i.ItemId, i.Name, f.Name From item i, features f, itemfeatures itf Where i.ItemId = itf.ItemId AND f.FeatureId = itf.FeatureId AND f.Name = 'Sugar Free' OR f.Name = 'Chocolate' change to SELECT i.ItemId, i.Name, f.Name From item i, features f, itemfeatures itf Where i.ItemId = itf.ItemId AND f.FeatureId = itf.FeatureId AND (f.Name = 'Sugar Free' OR f.Name = 'Chocolate')
  10. use $row_survey_results[$search]
  11. try <?php $b = 5+2; echo $b; echo '<br />Sasa<br >'; // not output echo '<hr />script source:<br />'; echo '<pre>'; echo htmlentities(preg_replace('/[\r\n]*\/\/ not output.*not output[\r\n]*/s',"\r\n",file_get_contents($_SERVER['SCRIPT_FILENAME']))); echo '</pre><hr />'; // not output ?>
  12. try $sSql = "SELECT *, 'news' as table_nam from news WHERE publish_date <= '$now' AND hide = '0' UNION SELECT *, 'regional' as table_nam from regional WHERE publish_date <= '$now' AND hide = '0' ORDER BY publish_date DESC LIMIT 30";
  13. try <?php function sum_time($a, $b){ $tmp = 0; $a = explode(':',$a); $b = explode(':',$b); $c = array(); for ($i = 2; $i >=0; $i--){ $tmp += $a[$i] + $b[$i]; $c[$i] = sprintf('%02u', $tmp % 60); $tmp = floor($tmp / 60); } return implode(':', array_reverse($c)); } echo $result = sum_time('10:42:00','00:25:15'); ?>
  14. $_GET[amount]=$amount1; $_GET[price] = $price; change to $amount1 = $_GET[amount]; $price = $_GET[price];
  15. try <?php header('Content-type: text/plain'); $authcode = ' AUTH CODE'; $fontdir = "/home/alabamaw/public_html/beta/places/font/"; error_reporting(0); $icao_array = isset($HTTP_GET_VARS["icao"]) ? explode(',',$HTTP_GET_VARS["icao"]) : array(); foreach($icao_array as $icao){ if (!preg_match('/^\w\w\w\w$/',$icao)) { exit; } $buildit = 0; $txt = "$tmpdir/current-$icao.txt"; if (file_exists($txt)) { $mtime = filemtime($txt); // cache every 10 minutes $time = time()-30; if ($mtime < $time) { $buildit = 1; } } else { $buildit = 1; } if ($buildit) { ignore_user_abort(true); $text = BuildText(); print $text; } }
  16. try <?php require_once ('connect.php'); // Connect to the database. // Generate a list of all of the sponsorhip_ids $query_ids = mysql_query("SELECT id FROM images WHERE type_id='5' AND active='Y' ORDER BY sponsorship_id"); while ($all_ids = mysql_fetch_array ($query_ids, MYSQL_NUM)) { //$all_ids[0]; $content[] = $all_ids[0]; //$content.=$all_ids[0].','; } //echo 'Listed ids from table: '.$content.'<br>'; // print the results to check results (4 testing) //$desc_len = strlen($content); //$content[$desc_len-1] = ''; //remove the remaining comma //$array_content = strip_tags($content); print_r($content); //echo $array_content.'<br><br>'; // print the results to check results after the final commer has been removed (4 testing) //$numbers = array($array_content); $numbers = $array_content; //Get 5 unique random keys from $numbers array. $rand_keys = array_rand($content, 5); //if you want to sort the random keys sort($rand_keys); //print out the random numbers using the //random keys. foreach ($rand_keys as $k=>$v) { echo $numbers[$v].", "; } ?>
  17. all your error is mean that scrip can not connect to database or database don't setup right
  18. try <?php mysql_connect('localhost'); mysql_select_db('test'); $sql = 'SELECT email, catid FROM users_table'; $result = mysql_query($sql); $emails = array(); while ($row = mysql_fetch_array($result)){ $tmp = array(); $tmp['email'] = $row['email']; $sql = 'SELECT title FROM jobs_table WHERE catid IN ('. implode(', ',explode('~', $row['catid'])). ')'; $result1 = mysql_query($sql); while ($row1 = mysql_fetch_array($result1)){ $tmp['contest'][] = $row1['title']; } $emails[] = $tmp; } foreach ($emails as $email) { echo 'Email:',$email['email'],"<br />\n",implode("<br />\n",$email['contest']),'<hr />'; } ?>
  19. try <?php $string = "Call Out Fee for 10:00 on 20/8/2007"; preg_match_all('/([0-9]+:[0-9]+)[^0-9]*([0-9]+\/[0-9]+\/[0-9]+)/', $string, $result); print_r($result); ?>
  20. $playerGames = "SELECT * FROM players WHERE playerID IN (". implode(", ",$players). ")";
  21. generate $pages array that have all value in navigation part $how_much_before = 2;<-- define how much link want to display before current page $how_much_after = 2; (for this forum value is 5) $pages = array(1); <-- always set page no 1 if ($page > $how_much_before + 2) $pages[] = '...'; <-- check if I need ... for ($i = max($page - $how_much_before, 2); $i < min($page + $how_much_after + 1,$total_pages); $i++) $pages[] = $i;<-- add middle part but not 1st and last page if ($page < $total_pages - $how_much_after - 1) $pages[] = '...'; <-- check if I need ... if ($total_pages > 1) $pages[] = $total_pages; <-- add last page if number of pages is > 1 (I tested after and i see if i have just 1 page in pagination it shows 2 times) foreach ($pages as $i){ <--do what you do before but use just $i in pages array if($page == $I or $i == '...'){ <-- no link for current page and for ...
  22. if ($var->activity <= $var->pre_activity){
  23. try <form method="POST"> Database name: <input type="text" name="db_name" value="test"><br /> Table name: <input type="text" name="table"><br > Replace NULL by <input type="text" name="nul" value="NULL"><br /> <input type="checkbox" name="header_row"> Put fields names at first row<br /> Field name: <input type="text" name="field" value="test">.xls<br /> <input type="submit" name="Submit" value="Convert to Excel 2000"> </form> <?php function convert_to_xls($table_name, $first_row = false, $data_base = 'test', $null_to = 'NULL') { mysql_connect('localhost','root'); $result = mysql_query('show databases'); $test = false; while ($row = mysql_fetch_row($result)){ if ($row[0] == $data_base) $test = true; } if (!$test){ die('Not exsist DB'); } mysql_select_db($data_base); $result = mysql_query('show tables'); $test = false; while ($row = mysql_fetch_row($result)){ if ($row[0] == $table_name) $test = true; } if (!$test){ die('Not exsist table: '. $table_name); } $out = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html> <head> <meta http-equiv=\"Content-type\" content=\"text/html;charset=utf-8\" /> <style id=\"Classeur1_16681_Styles\"> </style> </head> <body> <div id=\"Classeur1_16681\" align=center x:publishsource=\"Excel\"> <table x:str border=0 cellpadding=0 cellspacing=0 width=100% style='border-collapse: collapse'>\n"; $result = mysql_query('describe '.$table_name); $num_types = array( 'NUMERIC', 'DECIMAL', 'INTEGER', 'SMALLINT', 'FLOAT', 'REAL', 'DOUBLE PRECISION'); $out .=$first_row ? "<tr>\n" : ''; while ($row = mysql_fetch_array($result)){ $f_name[] = $row['Field']; $out .=$first_row ? '<td class=xl2216681 nowrap><b>'.$row['Field'].'</b></td>'."\n" : ''; } $out .= $first_row ? "</tr>\n" : ''; $result = mysql_query('select * from '.$table_name); while ($row = mysql_fetch_array($result)){ $out .= '<tr>'; foreach ($f_name as $k) $out .= '<td class=xl2216681 nowrap>'. ($row[$k]== null ? $null_to : $row[$k] ).'</td>'."\n"; $out .= "</tr>\n"; } return $out .= '</table> </div> </body> </html>'; } if ($_POST['Submit']){ $hr = isset($_POST['header_row']) ? true : false; $file = $_POST['field']; if ($file){ $file .= eregi('.xls',$_POST['field']) ? '' : '.xls'; $fp = fopen($file, 'w'); fwrite($fp ,convert_to_xls($_POST['table'],$hr,$_POST['db_name'],$_POST['nul'])); fclose($fp); echo '<hr /><a href="',$file,'">FILE</a>'; } else echo '<hr />No file name'; //echo convert_to_xls($_POST['table'],$hr,$_POST['db_name'],$_POST['nul']); } ?>
  24. ups change $pages[] = $total_pages; to if ($page < $total_pages) $pages[] = $total_pages;
  25. try to change for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "$i "; } else { echo "<a href=\"multimedia.php?go_to={$temp_go_to}&page=$i\">$i</a> "; } } with $how_much_before = 2; $how_much_after = 2; $pages = array(1); if ($page > $how_much_before + 2) $pages[] = '...'; for ($i = max($page - $how_much_before, 2); $i < min($page + $how_much_after + 1,$total_pages); $i++) $pages[] = $i; if ($page < $total_pages - $how_much_after - 1) $pages[] = '...'; $pages[] = $total_pages; foreach ($pages as $i){ if($page == $i or $i == '...'){ echo "$i "; } else { echo "<a href=\"multimedia.php?go_to={$temp_go_to}&page=$i\">$i </a> "; } }
×
×
  • 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.