/********* * mysql * *********/ $dbHost = "db01.crpt.xyz"; $dbUser = "ainstain"; $dbPass = "4rdKfWQI8Hn7v0HE"; $dbName = "ainstain_bttb"; $wsCount = 5; //Anzahl >= Artikel zum Wholesale wird $lcCount = 1; //Anzahl <= Artikel zu "Last Copies" wird /** Function : dump() * Arguments : $data - the variable that must be displayed * Prints a array, an object or a scalar variable in an easy to view format. * * got this from: http://www.bin-co.com/php/scripts/dump/ */ function dump($data) { if(is_array($data)) { //If the given variable is an array, print using the print_r function. print "
-----------------------\n"; print_r($data); print "-----------------------"; } elseif (is_object($data)) { print "
==========================\n"; var_dump($data); print "==========================="; } else { print "=========> "; var_dump($data); print " <========="; } } /* **************************************************** * DB Functions **************************************************** */ /* open MySQL Socket */ function openSocket($dbHost, $dbUser, $dbPass) { $sock = mysql_connect($dbHost,$dbUser,$dbPass); return $sock; } /* close MySQL Socket */ function closeSocket($sock) { if($sock) { if(!mysql_close($sock)) { echo(mysql_error()); } } } /* check MySQL Socket */ function checkSocket($sock) { // global $sock; if(!$sock) { echo(mysql_error()); exit; } } /* open MySQL DB */ function openDB($sock, $dbName) { mysql_select_db($dbName,$sock); } /* check MySQL DB */ function checkDB($sock, $dbName) { if(!mysql_select_db($dbName,$sock)) { echo(mysql_error()); closeSocket($sock); exit; } } /* DB Abfrage mit 1 Ergebniss */ function getRowQuery($field, $table, $where, $order) { global $sock; if($order != ""){$order = " ORDER BY ".$order;} if($where != ""){$where = " WHERE ".$where;} $query = "SELECT ".$field." FROM ".$table.$where.$order.""; // echo $query; if(!($resource = mysql_query($query,$sock))) {echo(mysql_error()); mysql_close($sock); exit;} $queryRow = mysql_fetch_row($resource); $fieldArray = explode(",", $field); // printError($query,"","yellow","Query:"); // printForEach($fieldArray); $tz=0; while($tz < count($fieldArray)) { $result[$tz] = $queryRow[$tz]; // printError($result[$tz],"","#777777","Results:"); $tz++; } return $result; } /* DB Abfrage mit >1 Ergebnissen */ function getArrayQuery($field, $table, $where, $order) { global $sock; if($order != ""){$order = " ORDER BY ".$order;} if($where != ""){$where = " WHERE ".$where;} $query = "SELECT ".$field." FROM ".$table.$where.$order.""; if(!($resource = mysql_query($query,$sock))) {echo(mysql_error()); mysql_close($sock); exit;} $fieldArray = explode(",", $field); // printError($query,"","yellow"); // printForEach($fieldArray); $tx = 0; while ($queryRow = mysql_fetch_array($resource)) { $tz=0; while($tz < count($fieldArray)) { $fieldResult[$tx] = $queryRow[$fieldArray[$tz]]; $tz++; } $result[$tx] .= $fieldResult; $tx++; } return $result; } /* DB Abfrage universell * got this from: http://www.bin-co.com/php/scripts/query/ */ function getQuery($query) { if(!$query) return ""; $result = mysql_query($query) or die("MySQL Error : " . mysql_error() . "\n<br />In Query <code>$query</code>"); if(mysql_num_rows($result) == 1) { //If there is just one result, return it. $arr = mysql_fetch_assoc($result); if(count($arr) == 1) { //If there is just one result... $item = array_values($arr); return stripslashes($item[0]); // Creates the effect of 'getOne()' } else { foreach($arr as $key => $value) $arr[$key] = stripslashes($value); return $arr; // Makes the 'query()' effect } } else { $arr = array(); $primary_key = false; while ($all = mysql_fetch_row($result)) { if(count($all) == 1) array_push($arr,$all[0]); elseif(count($all) == 2) { if(!$primary_key) { //Happens only one time $meta = mysql_fetch_field($result,0); //If the first element is a primary key, make $primary_key = $meta->primary_key; // the result an associative array. } //Make it an Associative Array if there is a primary_key in the given data. if($primary_key) $arr[$all[0]] = $all[1]; else break; } else break; } if($arr) { //Do a stripslashes() on each element foreach($arr as $key => $value) $arr[$key] = stripslashes($value); return $arr; // For 'getAll()' } else { //If nothing matches... mysql_data_seek($result,0); //Reset the Query. return $result; // This results in 'getSqlHandle()' effect } } } /* open DB socket and database */ $sock = openSocket($dbHost, $dbUser, $dbPass); openDB($sock, $dbName); $lastUpdate = getRowQuery("max(updated)", "mo_zeug", "status < 2", ""); //$stuffArr = getQuery("SELECT bestNr, medium, band, title, priceSale, comment FROM mo_zeug WHERE status < 2"); $stuffQuery = "SELECT bestNr, medium, band, title, priceSale, comment, status, count FROM mo_zeug WHERE status < 2 AND count > 0 ORDER BY band ASC, title ASC"; if(!($resource = mysql_query($stuffQuery,$sock))) {echo(mysql_error()); mysql_close($sock); exit;} $row = mysql_fetch_array($resource); $tz = 0; while ($row = mysql_fetch_array ($resource)) { $bestNr[$tz] = $row[0]; $medium[$tz] = $row[1]; $band[$tz] = $row[2]; $title[$tz] = $row[3]; $priceSale[$tz] = $row[4]; $comment[$tz] = $row[5]; $status[$tz] = $row[6]; $count[$tz] = $row[7]; $priceSpecial[$tz] = number_format(round($priceSale[$tz]*(1-0.30),2), 2, ',',''); $tz++; } ?>
Ja, bin ich denn total bescheuert?! Ne, aber total blank!
Deswegen löse ich meinen Mailorder auf und ihr könnt an meinem Elend profitieren :)
Schreibt mir ne Mail für weitere Details und/oder zum bestellen an: order@bttb.de
Bezahlung und Spenden per Paypal an paypal@bttb.de
Von den Artikeln mit GRÜNEM HINTERGRUND gibts noch reichlich.
Von Artikeln mit ROTEM HINTERGRUND nur noch wenige - wer zuerst kommt...
Von den grauen irgendwas dazwischen ;)
No | Band | Title | Medium | Price | Comment |