![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 11 Pomógł: 0 Dołączył: 9.11.2004 Skąd: Jaworzno Ostrzeżenie: (0%) ![]() ![]() |
Witam mam taki oto problemik mam funkcję ( jedną z kilku w każdej mam ten sam problemik) :
Kod function removeCalendar($id ){ $ret = array(); try{ $db = new DBConnection(); $db->getConnection(); $sql = "delete from Kalendarz_1 where `id`=" . $id; if(mysql_query($sql)==false){ $ret['IsSuccess'] = false; $ret['Msg'] = mysql_error(); }else{ $ret['IsSuccess'] = true; $ret['Msg'] = 'Succefully'; } }catch(Exception $e){ $ret['IsSuccess'] = false; $ret['Msg'] = $e->getMessage(); } return $ret; } Która dokonuje usunięcia z bazy i wszystko gula pod warunkiem że nazwa tabeli jest zapisana bezpośrednio czyli Kalendarz_1 ja niestety potrzebuje wstawiać nazwę tabeli dynamicznie w zależności od zalogowanego do systemu user i jak bym nie kobinował nie umiem sobie z tym poradzić np robie tak : Kod $jakasnazwatabeli = 'Kalendarz_11'; function removeCalendar($id ){ $ret = array(); try{ $db = new DBConnection(); $db->getConnection(); $sql = "delete from $jakasnazwatabeli where `id`=" . $id; if(mysql_query($sql)==false){ $ret['IsSuccess'] = false; $ret['Msg'] = mysql_error(); }else{ $ret['IsSuccess'] = true; $ret['Msg'] = 'Succefully'; } }catch(Exception $e){ $ret['IsSuccess'] = false; $ret['Msg'] = $e->getMessage(); } return $ret; } i nie che mi to działać proszę o pomoc (IMG:style_emoticons/default/smile.gif) Z góry dziękuje |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 2 178 Pomógł: 596 Dołączył: 25.09.2009 Skąd: Piwniczna-Zdrój Ostrzeżenie: (0%) ![]() ![]() |
Jednym z rozwiązań jest podanie nazwy tabeli jako parametru:
Innym sposobem jest użycie słowa global - poczytaj. Co do Twojego kodu, to pamiętaj, że funkcję trzeba wywołać. |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 4 655 Pomógł: 556 Dołączył: 17.03.2009 Skąd: Katowice Ostrzeżenie: (0%) ![]() ![]() |
Innym sposobem jest użycie słowa global - poczytaj. Idź precz z takimi pomysłami! |
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 11 Pomógł: 0 Dołączył: 9.11.2004 Skąd: Jaworzno Ostrzeżenie: (0%) ![]() ![]() |
Chyba jestem za tępy do tego :/ bo nie umiem dać sobie rady
Czy mogę prosić o pomoc jak to zmejkować na podstawie poniższego kodu (IMG:style_emoticons/default/questionmark.gif) Kod function listCalendarByRange($sd, $ed){
$ret = array(); $ret['events'] = array(); $ret["issort"] =true; $ret["start"] = php2JsTime($sd); $ret["end"] = php2JsTime($ed); $ret['error'] = null; try{ $db = new DBConnection(); $db->getConnection(); $sql = "select * from TABELKA1 where `starttime` between '" .php2MySqlTime($sd)."' and '". php2MySqlTime($ed)."'"; $handle = mysql_query($sql); //echo $sql; while ($row = mysql_fetch_object($handle)) { //$ret['events'][] = $row; //$attends = $row->AttendeeNames; //if($row->OtherAttendee){ // $attends .= $row->OtherAttendee; //} //echo $row->StartTime; $ret['events'][] = array( $row->Id, $row->Subject, php2JsTime(mySql2PhpTime($row->StartTime)), php2JsTime(mySql2PhpTime($row->EndTime)), $row->IsAllDayEvent, 0, //more than one day event //$row->InstanceType, 0,//Recurring event, $row->Color, 1,//editable $row->Location, ''//$attends ); } }catch(Exception $e){ $ret['error'] = $e->getMessage(); } return $ret; } |
|
|
![]() ![]() |
![]() |
Aktualny czas: 1.10.2025 - 07:43 |