Jump to content

cheeseus

Members
  • Posts

    52
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

cheeseus's Achievements

Member

Member (2/5)

0

Reputation

  1. Excellent! Thank you! It is sorted now. I did have two "overflow:hidden" statements in the CSS - one applied to images, and the other was to everything contained in the #body container. Neither of them affected presentation though, they were left over from the old design which I am little by little changing and improving. But the real problem was exactly where you said it was - so I set the #news_archive DIV to float left and the DIV with calendar went into place. Then I set the DIV width to 98% to fill in the entire area and everything looks great! Now to the rest of the appearance
  2. Hello, I am not too sure if this is for the HTML or for the CSS section; if Mods think it is for the CSS, please move it. Problem: In this site I am making, I am nesting a table displaying a calendar with a news archive. The table will not show in Firefox (updated to latest version). It shows in Chrome, IE 9, and Opera. It even shows in my phone's browser (Android 4.0)! Both the HTML and the CSS of the site validate, I have examined everything a dozen times, I even inserted <tbody></tbody> tags, which is never do... The table's actual code is there when you look at the page source, it just won't display. I have no idea what is wrong and I hope someone can help me out here. Here's the site: http://amalipe.com
  3. RESOLVED: It appears I had to declare the table I was copying the data from in the UPDATE part:
  4. I also tried this: UPDATE news_text1 SET news_text1.date = news.date WHERE news_text1.parent = news.id I've noticed that whichever column I put after the equal sign is the "unknown column". I guess I'm making some some really stupid mistake or some is broken in my PhpMyAdmin. ... Help please!
  5. I tried this to test how this thing works (first time ever I need to copy data from one table to another). So, now I tried this: INSERT INTO news_text (date) SELECT news.date FROM news This is supposed to copy ONLY the "date" field, isn't it? Now, it copies ALL the fields of that table. Am I writing this correctly? EDIT: Did some more reading and decided to try this: UPDATE news_text1 INNER JOIN news ON news.id = news_text1.parent SET news_text1.date = news.date This gets executed but "0 rows are affected".
  6. It does exist. I wouldn't be asking a question here if I wasn't sure it exists and yet I get this mistake.
  7. Hello, I am trying to copy the data from one of the columns of a table to a column of the same name in another table but can't seem to make it work. The two tables have a different structure. I am trying to copy the "date" field from "news" into the "date" field of "news_text". INSERT INTO news_text (news_text.date) SELECT news.date FROM news WHERE news_text.parent = news.id I get the following error: The "news.id" field corresponds to the "news_text.parent" field. I can't figure out what I am missing :-\
  8. Problem solved. I don't know how. I switched to PHP 5.2.5 a couple of times. Clicked through the different menu items for editing, e.g. News, Programs, Projects, and when I returned to News, the textarea suddenly became editable. I then switched back to PHP 5.3.0 and it was still editable. I will not close the topic as Solved yet, because the problem is unknown and will appreciate any comments that may help me, or other users who happen to encounter this problem.
  9. Hello, I have encountered a problem and I am not even sure it's stricty PHP-related. The problem is with website I want to migrate to a better hosting provider and I also have to edit the code to make it PHP 5 compatible. I have a news editing panel that uses FCKEditor. There are 3 fields: date, news title, and news text. The first two are OK, but the textarea is empty and non-editable, i.e. I cannot click in it to put the cursor inside. The problem only exists on my local Wampserver (PHP 5.3.0). When I upload all the files to the old hosting server (PHP 5.2.5) the textarea is editable. Here is the code that loads the news editing page: <?php class page extends admin{ function page(){ if(isset($_GET['do'])) { if($_GET['do']=='del'){ mysql_query("DELETE FROM news WHERE id = '$_GET[id]'"); mysql_query("DELETE FROM news_text WHERE parent = '$_GET[id]'"); $this->loc("?nav=news"); } if(!empty($_POST['date'])){ $sql="UPDATE news SET ".$this->post_insert(array("date"))." WHERE id = '$_GET[id]'"; mysql_query($sql); echo $sql; $parent=$_GET['id']; //insert lang values $this->update_langs("news_text",array("name","content"),$parent); $this->loc(); } } } // Sub menu Buttos var $sub_menus=array( array("Списък новини","news"), array("Добави новина","add_news") ); //Sub menu generation function sub_menu(){ for($i=0;$i<sizeof($this->sub_menus);$i++){ echo "<li><a href=\"?nav=".$this->sub_menus[$i][1]."\">".$this->sub_menus[$i][0]."</a></li>"; } } // Language form template function lang_form($name,$id){ echo ' <fieldset> <legend>'.$name.'</legend> <div class="line"><label>Име: </label> <input name="name_'.$id.'" class="text" style="width:450px;" value="'.$this->get_sql_value("SELECT * FROM news_text WHERE parent='$_GET[id]' AND lang='$id'","name").'" type="text" /> </div> <div class="line"><label>Съдържание: </label></div>'; $oFCKeditor = new FCKeditor('content_'.$id); $oFCKeditor->BasePath = 'includes/fckeditor/'; $oFCKeditor->Height= '500px'; $oFCKeditor->Value= $this->get_sql_value("SELECT * FROM news_text WHERE parent = '$_GET[id]' AND lang='$id'","content"); $oFCKeditor->Create(); echo' </fieldset>'; } } $p=new page(); ?> <div id="left"> <ul> <li><h1>Опции:</h1></li> <?php echo $p->sub_menu(); ?> </ul> </div> <div id="center"> <h1>Amalipe.com / Администрация / Новини / Редакция на новина</h1> <form name="add" id="add" action="" method="post"> <fieldset> <legend>Основна информация</legend> <div class="line"><label>Дата: </label> <input name="date" class="text" type="text" value="<?php echo $p->get_value("news","date"); ?>" /></div> </fieldset> <?php $p->lang_forms(); ?> <input value="Промени" class="btn" type="submit" /> </form> </div> The encoded characters you see in the code are Cyrillic names. At first I thought this had something to do with the FCKEditor version so I upgraded it to the last one (FCKeditor_2.6.6) but nothing changed. On my local Wampserver I have two PHP versions - 5.2.9-2 and 5.3.0 - neither works. I have also added 5.2.5 to see if this changes anything but no, it doesn't - the textarea is still empty and non-editable. I hope I can get some help!
  10. You're right, I don't need that function for error reporting outside the form check script. I have done it as you suggest, much easier indeed. What I'm working on is a system for my own use that will not go online, so detailed error reporting is unnecessary. Thank you all for your help!
  11. Thank you! I wrote isset checks for every array I create and got rid of all the warnings Now, the session... Yes, I am concatenating it. That's the way I decided to get all the missing post values after submitting the form and display them - by storing the errors array in a session. Maybe that's not a very good idea then? But, if I stick to this way of displaying error feedback, how do I collect all the missing $_POST values AND get rid of the warning? I tried adding a line where I create an index value, to which to add the $err_messages but this way only the first of the missing fields is printed (and no warning). function formError($err_message) { $_SESSION['errors'] = "fields: "; if(isset($err_message)) { $_SESSION['errors'] .= $err_message.", "; } }
  12. OK, and how do I define an array key? By declaring an empty array before I start filling the array? (this doesn't work) :-\ $income[] = array(); $income[$client][$currency] += $client_sum; And is this the same situation: When validating a form, I check if $_POST[] is empty. If empty I call an error display function: if(empty($_POST['country'])) { formError("Country"); } ..... function formError($err_message) { if(isset($err_message)) { $_SESSION['errors'] .= $err_message; } } Here I get an undefined index notice for the $_SESSION value: "Undefined index: errors... "
  13. I have fixed this error - turns out the notice appeared because I had a clientname but no projects and no currency were added for the client. Now that the variable is not empty, it's OK. However, I have the same kind of notice on another page. Now that all variables have a value, I don't understand what else is wrong. As I posted earlier here, this is where I get 12 x 3 notices of undefined indexes (because there are 12 clients in the DB): $income_total = calculate("income"); foreach($income_total as $row) { $clientID = $row['clientID']; $clientname = $row['clientname']; $client = "<a href=\"index.php?page=Project&do=view&sortby=$clientID\">".$clientname."</a>"; $currency = $row['currency']; $client_sum = $row['client_sum']; $year_sum = ''; $year_sum += $client_sum; $income = ''; $income[$client][$currency] += $client_sum; $income_list = statistics($income); $income_all = ''; $income_all[$currency] += $client_sum; } The calculate("income") function returns the results expected, which I fill in the $income_total array that I then break into separate values. The "bad" line is this: $income[$client][$currency] += $client_sum; But the variable $client gets a value, so it's not the first time I declare it. At first I thought it could be because $client contains HTML + $clientname, but when I changed it to $income[$clientname][$currency] += $client_sum; and comment out the line where I assign a value to $client, I still get the same notice, on the same line. What puzzles me is that the notices have the actual clientname/currency name as a undefined index, e.g. Please help me comprehend this.
  14. OK, I will try to write proper code and to do that I need to know what I'm doing wrong. Is it the same kind of mistake here (this is the complete file). I get two notices about the same undefined variable $currency on line 44: <td>".$currency."</td> here: <?php $list = "<table> <tr><td colspan=\"6\"><h3>Client List</h3></td></tr> <tr> <th>ID</th> <th>Name</th> <th>No. Projects</th> <th>Revenue</th> <th>New</th> <th>View all</th> </tr>"; $client_list = showClients(); foreach($client_list as $row) { $clientname = $row['clientname']; $clientID = $row['clientID']; $client_work = showClientWork($clientID); $np = 0; foreach($client_work as $row) { $projectname = $row['projectname']; $projecttype = $row['projecttype']; $sourcelang = $row['sourcelang']; $targetlang = $row['targetlang']; $totalprice = $row['totalprice']; $subprice = $row['subprice']; $currency = $row['currency']; $paid = $row['paid']; $np += 1; } $list .= "<tr> <td><a href=\"index.php?page=Client&do=edit&clientID=$clientID\" title=\"EDIT $clientname INFO\">".$clientID."</a></td> <td><a href=\"index.php?page=Client&do=edit&clientID=$clientID\" title=\"EDIT $clientname INFO\">".$clientname."</a></td> <td>".$np."</td> <td>".$currency."</td> <td><a href=\"index.php?page=Project&do=new&clientID=$clientID\" title=\"New Project for ".$clientname."\"> <img src=\"images/add.gif\" alt=\"add.gif\" border=\"0\" /></a></td> <td><a href=\"index.php?page=Project&do=view&sortby=$clientID\" title=\"All projects by ".$clientname."\"> view all</a></td> </tr>"; } $list .= "</table>"; echo $list; ?> $currency gets its value above, in $currency = $row['currency']; And, what about the "undefined index" issues?
  15. Hello, I have just upgraded my wampserver and with it MySQL, PHP and PhpMyAdmin versions. And my scripts, which ran normally before, not burst hundreds of undefined variable and undefined index notices. I realize it's "notices", not "errors" but this is quite irritating. I believe it might be due to some upgrade in PHP scripting rules or something but I don't know what. I hope you can help me. The first type of notice is "undefined variable". This function will return the notice if I remove the bold red line, where I define the variable as empty before I use it in the loop. I didn't need to do this before. function statistics($array) { [color=red][b]$list = '';[/b][/color] if(is_array($array)) { foreach($array as $name => $value) { // Rip out the name of the client. $list .= "<li>".$name." - "; // set an integer so we know how many tier2 values we have read. $x = 0; foreach($value as $difference => $sum_total) { // if this is the more than the first tier2 values, use a '+' between the units. $list .= (++$x > 1) ? " + ".$sum_total." ".$difference : $sum_total." ".$difference; } // close the line out. $list .= "</li>"; } } return $list; } To avoid the 10+ like notices on the page I declare them empty before the variable's first occurrence. But this sounds stupid to me. Wasn't this one of PHP's benefits, not to have to declare the variable before using it? I also get about 30+ undefined index notices, e.g. Here are those lines: $income_total = calculate("income"); foreach($income_total as $row) { $clientID = $row['clientID']; $clientname = $row['clientname']; //$client = "<a href=\"index.php?page=Client&do=view&clientID=$clientID\">".$clientname."</a>"; $client = "<a href=\"index.php?page=Project&do=view&sortby=$clientID\">".$clientname."</a>"; $currency = $row['currency']; $client_sum = $row['client_sum']; $year_sum = ''; $year_sum += $client_sum; $income = ''; $income[$client][$currency] += $client_sum; $income_list = statistics($income); $income_all = ''; $income_all[$currency] += $client_sum; } Line 37 is: It's the values assigned to $client and to $currency that seem to cause the notice. How do I deal with this? I don't just want to turn error/notice display off, I want to resolve this issue.
×
×
  • 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.