ziedinjsh Posted July 25, 2011 Report Share Posted July 25, 2011 skatos, skatos, skatos, bet bļāviens nevaru ne ieraudzīt ne saprast kapēc nepostojas prom informācija.. ar var_dump(); ir array empty if($data['type']=='producer'){ if($musican=='addprofile'){ echo "<div class='pro'> <form method='post' action='process/musican_process.php' enctype='multipart/form-data' id='addmusican'> <h3>Producenta nosaukums</h3> <input type='text' name='musican' class='input'> <h3>Biogrāfija</h3> <textarea name='biografy' class='textarea' style='font-size:14px;'></textarea> <h3>Profila bilde</h3> <input type='file' name='cover' class='input'> <input type='hidden' name='user_id' value='".$data['user_id']."'> <input type='submit' name='addmusican' value='Izveidot profilu' class='button'> </form> </div> <div class='info'> <div id='result'></div> kaut kas šeit! </div>"; } }else{ header("Location: index.php"); } error_reporting(E_ALL); $folder = "../covers/"; $image = mysql_real_escape_string($_FILES['cover']['name']); $tmp = mysql_real_escape_string($_FILES['cover']['tmp_name']); $type = mysql_real_escape_string($_FILES['cover']['type']); $size = mysql_real_escape_string($_FILES['cover']['size']); $musican = mysql_real_escape_string($_POST['musican']); $biografy = mysql_real_escape_string($_POST['biografy']); $user_id = mysql_real_escape_string($_POST['user_id']); $iname = trim($musican); $cover = $iname."_".basename($_FILES['cover']['name']); $uploading = $folder.$iname."_".basename($_FILES['cover']['name']); $statuss = "ok"; if(empty($image) || empty($musican) || empty($biografy)){ $error = "<div class='i-error'>Kads no lauciniem ir tukš!</div>"; $statuss = "error"; } if(file_exists($data['cover'])){ unlink($folder."/".$data['cover']); } if($statuss<>"ok"){ echo $error; }else{ $sql = mysql_query("INSERT INTO musicans (musican, biografy, cover, user_id) VALUES ('$musican', '$biografy', '$cover', '$user_id')") or die(mysql_error()); if(move_uploaded_file($_FILES['cover']['tmp_name'], $uploading)){ createAvatar70("../covers/","../covers/small/",70); createAvatar200("../covers/","../covers/medium/",200); createAvatar400("../covers/","../covers/",400); echo "<div class='i-ok'>Profils ir izveidots!</div>"; } } Quote Link to comment Share on other sites More sharing options...
briedis Posted July 25, 2011 Report Share Posted July 25, 2011 ziediņ, man liekas, ka tev nav lemts :D Iemācies debugot un nevajadzēs katras 30 minūtes veidot jaunu topiku ar stulbu kļūdu... Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted July 25, 2011 Author Report Share Posted July 25, 2011 es skatījos caur firebug, bet tur neko nevaru atrast kur būtu kļūda! Quote Link to comment Share on other sites More sharing options...
Faks Posted July 25, 2011 Report Share Posted July 25, 2011 (edited) Nevajaga Būt ģenijam lai to visu saprast vienīgi tavs kodešanas stils mani nobeidz ... iesaku nedaudz vel pacept kodu un sekot līdzi savādāk ar tevi te neviens neauklēsies un šeit tā visi darīs :) if ($statuss != "ok") { echo $error; } elseif ($statuss == "ok") { $sql = mysql_query("INSERT INTO musicans (musican, biografy, cover, user_id) VALUES ('".$musican."', '".$biografy."', '".$cover."', '".$user_id."') ") or die(mysql_error()); } Edited July 25, 2011 by Faks Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted July 25, 2011 Author Report Share Posted July 25, 2011 Nevajaga Būt ģenijam lai to visu saprast vienīgi tavs kodešanas stils mani nobeidz ... iesaku nedaudz vel pacept kodu un sekot līdzi savādāk ar tevi te neviens neauklēsies un šeit tā visi darīs :) if ($statuss != "ok") { echo $error; } elseif ($statuss == "ok") { $sql = mysql_query("INSERT INTO musicans (musican, biografy, cover, user_id) VALUES ('".$musican."', '".$biografy."', '".$cover."', '".$user_id."') ") or die(mysql_error()); } šinī jau nav problēma kapēc viņš neposto datus! Dati nemaz nenonāk līdz tam musican_process.php Quote Link to comment Share on other sites More sharing options...
404 Posted July 25, 2011 Report Share Posted July 25, 2011 (edited) Ja dati nesūtās vispār,tātad: - neesi form action parametrā norādījis pareizu ceļu uz apstrādes failu - forma satur kritiskas kļūdas Bet ja sūtās,tad apstrādes faila sākumā ieliekot print_r($_POST); un print_r($_FILES); visas atbildes tiks izvadītas acu priekšā.Atliks tikai salīdzināt,vai tiek saņemts viss ko centies nosūtīt. Edited July 25, 2011 by 404 Quote Link to comment Share on other sites More sharing options...
daGrevis Posted July 25, 2011 Report Share Posted July 25, 2011 if ($statuss != "ok") { echo $error; } elseif ($statuss == "ok") { $sql = mysql_query("INSERT INTO musicans (musican, biografy, cover, user_id) VALUES ('".$musican."', '".$biografy."', '".$cover."', '".$user_id."') ") or die(mysql_error()); } Nākotnē ieteiktu rakstīt... if ($has_errors === true) { echo 'Errors!'; } else { echo 'All cool!'; } 1) Būleāni, 2) Bezjēgā tas 'else if'; Protams, ir situācijas, kur vajag darīt kā Tu darīji (līdzīgi), bet tomēr centies pieturēties Manam piemēram. :) Quote Link to comment Share on other sites More sharing options...
Maris-S Posted July 26, 2011 Report Share Posted July 26, 2011 Par koda sakārtošanu piekrītu, sakārto kodu un nesaspied, saliec atstarpes un tabus, kur to vajag. Būs pārskatāms kods, būs pašam vieglāk saprast un īpaši citiem, ja gribi, lai kāds palīdz. Sāc ar kļūdu paziņojumu ieslēgšanu. error_reporting(E_ALL); ini_set('display_errors','1'); nevis error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted July 26, 2011 Report Share Posted July 26, 2011 (edited) es gan nākotnē ieteiktu rakstīt <? class myClass { public static function factory(){ return new self(); } public function __construct(){ $this->checkDriverConnection(); return $this; } public function insert($table,$items){ $this->buildQuery("INSERT INTO `{$table}` (".$this->getKeys($items,"`").") VALUES(".$this->getValues($items,"'").")"); return $this; } ... } ?> Edited July 26, 2011 by EdgarsK Quote Link to comment Share on other sites More sharing options...
daGrevis Posted July 26, 2011 Report Share Posted July 26, 2011 Labs! Nezināju, ka statiskā metode var atgriezt 'self'. Vienmēr atgriezu ko līdzīgu 'new __CLASS__()'. Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted July 26, 2011 Report Share Posted July 26, 2011 tu vēl daudz ko nezini :) Quote Link to comment Share on other sites More sharing options...
daGrevis Posted July 26, 2011 Report Share Posted July 26, 2011 Jā, tāda jau ir tā doma... palīdzēt citiem un pašam mācīties. Vēl kādus nākamos trīsdesmit gadus būšu tepat. Valodas mainīsies, bet purni paliks. :D Quote Link to comment Share on other sites More sharing options...
EdgarsK Posted July 26, 2011 Report Share Posted July 26, 2011 (: Skaties ka nenoveco, tāpat kā te daži labi, aizsēdējušies 2002. gada php versijā un domā, ka visu māk. Visu laiku ir jāseko līdzi jaunākajām versijām/tendencēm, optimizacijām un citam bullshit.. g...w... Quote Link to comment Share on other sites More sharing options...
daGrevis Posted July 26, 2011 Report Share Posted July 26, 2011 Es lepojos ar Savu 'augšanas līkni'. :D Redzi, pirms diviem trim gadiem nu pilnīgi neko nerubīju. Ķipa ziedinsjsj, bet vēl trakāk. Bet tagad? :) Quote Link to comment Share on other sites More sharing options...
codez Posted July 26, 2011 Report Share Posted July 26, 2011 Drīz PHP tāpat nomainīs javascript aka. node.js. Lūk tas ir izstrādes rīks uz goda un valoda arī forša. Pie tam biznesa loģiku var kodēt vienreiz un izmantot gan klienta, gan servera pusē, jo abās ir viena valoda, cromes gadījumā pat vienz javascript dzinējs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.