Jump to content

1042

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by 1042

  1. Concrete5 is a fine CMS with a growing user base. The structure is well defined, it is very easy to theme and create custom modules and is very expandable, i have work with Drupal and Joomla for a few years now and after i tried Concrete5 i switch to them, the security issues have been fixed but as with any web application nothing is 100% secure although the concrete guys are fast to fix issues and release security patches, i mean look at Drupal and their issues; http://secunia.com/advisories/search/?search=drupal Concrete5 was a commercial product before they release it as open source so the company actually got paid to make it better, unlike Drupal or Joomla. The forums are very supporting as well, anyway i encourage you to give it a try, it doesn't hurt to learn something new and i really think Concrete5 will soon be very popular. just my 2 cents.
  2. this is what i ended up doing; $number="161321"; $number = substr(chunk_split($number, 2, ':'), 0, -1); //If $number is '1234567', result is '1 234 567'. //echo $number; echo date('h:i:s ', strtotime($number)); is there a better way?
  3. That's weird, im using php 4.4.7, would that be an issue?
  4. Im pulling information from an xml file tha returns the time formatted like this 161322, how would i format the result like this, 16:13:22 ? i tried: $thetime="160000"; echo date('H:i:s A', strtotime($thetime)); but all i get is 00:00:00 AM any help is greatly appreciated, thanks.
  5. You can do this; print_r($_COOKIE);
  6. Im trying to run this query to get totals on per month basis, so far this is what i have below; PHP Code: //run the query to get the totals on per month basis// $query = "SELECT order_date, SUM(grand_total) FROM order_details WHERE order_status='completed' GROUP BY order_date order by order_date"; $result = mysql_query($query) or die(mysql_error()); // Print out results while($row = mysql_fetch_array($result)){ $order_date=$row['order_date']; // show the results by month// echo "$order_date = $". $row['SUM(grand_total)']; echo "<br />"; } this returns the following format: 2007-06-19 17:51:15 = $117.69 2007-06-19 17:58:57 = $76.99 2007-06-19 18:08:46 = $137.5 2007-06-19 18:22:25 = $94.19 2007-06-20 10:57:50 = $82.41 2007-06-21 15:09:21 = $94.19 2007-07-17 11:05:39 = $94.2 2007-08-19 17:52:52 = $26.5 but what i would like is to get the following format july, 2007 = $total June, 2007 =$total in other words group the totals for the month for each month, hope i made sense. what would be the best way to do this? thanks all for the help
  7. $select_result = mysql_query("SELECT * FROM $dbTable ORDER BY 'Score' ASC", $conn); No need for quotes around Score, try that.
  8. A nice way to do this would be AJAX, you show Tours and based on the tour they select theywill get a drop down with the course belonging to each tour, im i correct? anyway, here is a good tutorial that help me when i had to do something similar to what you are doing now. http://www.scriptygoddess.com/archives/2007/02/13/store-locator-using-php-and-ajax/ you just need a few changes to customize it to you needs.
  9. You are not closing you else if statement on line 17, you need to close it on line 26 see below, i added for you at the end; else if (isset($PHP_AUTH_USER)) { if (($PHP_AUTH_USER != "a") || ($PHP_AUTH_PW != "ab")) { header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } }
  10. Hi, checkout http://www.phpclasses.org , im sure you can find the class you need there.
  11. Hi, Check out this link http://dhtmlgoodies.com/index.html?whichScript=ajax_client_lookup , you can start with this and modify it to achieve what you need. Cheers.
  12. this is what i got Unknown column 'sd.staff_office' in 'field list' what does sd. stand for, sorry if is a dumb question
  13. Hello mjdamato , thanks for the help, here is the code; $sql = "SELECT users.*, sd.staff_office FROM users LEFT JOIN staff_departments sd ON users.staff_office = sd.dep_id ORDER BY sd.dep_name"; $result = mysql_query($sql); $columns = 4; $deptName = ""; $currentColumn = 0; echo "<table>\n"; while ($row = mysql_fetch_array($result)) { if ($currentColumn == $columns) { echo "<\tr>"; $currentColumn = 0; } if ($row['dep_name'] != $deptName) { $deptName = $row['dep_name']; echo "<tr><td colspan=\"{$columns}\"><b>{$deptName}</b></td></tr>"; $currentColumn = 0 ; } if ($currentColumn == 0) { echo "<tr>"; } echo "<td>{$row['staff_name']}</td>"; $currentColumn++; } echo "</tr></table>"; however im getting this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in path\to\site\staffonly_new\print2.php on line 104 any ideas? thanks
  14. Hello all, i have this code that shows the department categories in a 4 column format, my problem is how do i insert the names of the people that belong to that category to be shown under the category name? i have 2 tables, one is the department categories and the other one is users, under users there is a field that is called staff_department..here is the code that shows the categories only; PHP Code: $sqlCat = MySQL_Query("SELECT dep_name FROM staff_departments ORDER BY dep_name"); $columns = 4; $numRows = MySQL_Num_Rows ($sqlCat); $rows = ceil($numRows / $columns); while($category = MySQL_Fetch_Array($sqlCat)) { $cat[] = $category['dep_name']; } echo '<br><br>'. '<table cellpadding="0" cellspacing="0" align="center" width="100%" border="1">'; for($i = 0; $i < $rows; $i++) { echo '<tr>'; for($j = 0; $j < $columns; $j++) { if(isset($cat[$i + ($j * $rows)])) { echo '<td><strong>'. $cat[$i + ($j * $rows)] . '</strong></td>'; } } echo '</tr>'; } echo '</table>'; i guess im missing a query to show the names under the category example SELECT * FROM users WHERE staff_department = '$sqlCat [dep_name]' but where do i do this? thanks to all in advance
  15. Hi, not sure if this would help but try echoing the variable that you are trying to pull the info from, like this; [code]<? $variable = "test"; echo "$variable; ?>[/code] cheers.
  16. Hi all, i hope i explain this clearly :), what im trying to acomplish is to have a form that on submision it will create records on different tables, example form will have email date product region country - here im going to have some customers assign on by country basis when the from gets submited the info should go in to a table called latest product offers that will track the date of the email sent, the product sent the region, the country  and a list of customers that the email was sent, so far so good... the problem im having is that i need to create also tickets (records on a different new table) for each of the customers that the product was sent, the table will have the fields, customer name, product sent and date sent, so if for instance on a certain country i have 5 customers then on submission of the first form i also need to create 5 new records on this second table... is there a way to acomplish this? i guess i need to do 2 queries? but how do i acomplish this?  thanks to all in advance.
  17. thanks, i would really appreciate your help.
  18. Hi all, i have the following code that displays data in a double column in the format id1|id2 id3|id4 id5|id6 [code] $getpress = mysql_query("SELECT * FROM events ORDER BY eventid ASC");//query the database for all of the news $i = 1; // counter var $cols = 2; // or however many columns you want echo "<table>"; while($r=mysql_fetch_array($getpress)){//while there are rows in the table extract($r);//remove the $r so its just $variable if ($i == 1) echo "<tr>"; // start new row     echo "<td td width=\"50%\"><font color=#000000><strong>$eventtitle</strong></font><br> <font color=black>$eventinfo </font><br> <font color=blue>$eventlink  </font><br></td>";     if ($i == $cols) { // we've reached the end of our number of cols so end the row and reset the counter         $i = 0;         echo "</tr>";     }     $i++; // increment our counter } if ($i != $cols) echo "</tr>"; // if we haven't finished off the row end it now echo "</table>"; [/code] what would i need to change to display the data in the format id1|id4 id2|id5 id3|id6 thanks to all in advance.
  19. [quote author=sasa link=topic=110111.msg444867#msg444867 date=1159734607] try [code]$detailpress = mysql_query("SELECT * FROM press WHERE id= {$_GET['pressid']}") or die(mysql_error());[/code] [/quote] Thanks SASA and to everybody for the help, this is a great community specially for newbies like me  , i was able to solve the issue following the advice given in this post, here is how my query looks now: PHP Code: [code]$detailpress = mysql_query("SELECT * FROM press WHERE pressid= {$_GET['pressid']}") or die(mysql_error());[/code] once again, you help was greatly appreciated, thanks all.
  20. Hi thanks for the help, i change that line and i got this error Unknown column 'id' in 'where clause' so i change the code to this [code]$detailpress = mysql_query("SELECT * FROM press WHERE pressid= '$pressid'") or die(mysql_error())[/code] instead of this [code]$detailpress = mysql_query("SELECT * FROM press WHERE id= '$pressid'") or die(mysql_error());[/code] if i do this i can see the first record on the database but if i do press.php?id=2 i still see tha same record, it wont change to that particular record if i do this: [code]$detailpress = mysql_query("SELECT * FROM press WHERE id= $_GET['pressid']") or die(mysql_error());[/code] i get this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\xampp\htdocs\headinteractive\press.php on line 171 any ideas? thanks in advance.
  21. Hello All, im creating this sort of news script and im having an issue, the code to display the date, title and the read more link is below the name of this page events.php [code] $getpress = mysql_query("SELECT * FROM press ORDER BY pressid DESC");//query the database for all of the news while($r=mysql_fetch_array($getpress)){//while there are rows in the table extract($r);//remove the $r so its just $variable echo(" <font class=\"bluetext\">$date</font> - <font class=\"blueboldpress\"><strong>$title</strong></font><br> <a href=\"press.php?id=$pressid\">[Read More]</font></a><br><br>"); } [/code] and the code to display the complete news article is below the name of this page is press.php [code] $detailpress = mysql_query("SELECT * FROM press WHERE id= '$pressid'");//query the database for detail news article while($r=mysql_fetch_array($detailpress)){//while there are rows in the table extract($r);//remove the $r so its just $variable echo(" <font class=\"bluetext\">$date</font> - <font class=\"blueboldpress\"><strong>$title</strong></font> <font class=\"bluetext\">$content</font><br>"); } [/code] the problem is that i get an error "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\interactive\press.php on line 173" line 173 would be were the "while" statement starts on the press.php file, any ideas what im doing wrong, any help is appreciated, thank you in advance.
  22. my bad, but that was not the issue, still not showing anything, any ideas? thank you.
  23. ok so i grab this fubction from the web and im having trouble making it work here is the fuction called showdate.php [code] <?php /*     What this does:     getcal($year) generates a calendar for any given year,     with intelligent links.     Synopsis of operation:     The getcal($year) function creates a calendar for the said year.  The     getcal() function in turn calls the gen_month($month,$year)     which generates the month table with the name/day headings/day numbers.     The gen_day_url($day,$month,$year) function is called by gen_month()     to display the day number.  If there are any records in the table     specified by $table_name that contain the date specified in the $day,     $month, and $year vars, it generates a link.  If there are no records,     it just returns the day number. // Decide if you want just a calendar, or also a db with the events // Complex table CREATE TABLE calendar ( id int(10) unsigned NOT NULL auto_increment, date date NOT NULL default '0000-00-00', time time default NULL, title varchar(128) default NULL, description text, infolink varchar(128) default NULL, infocontact varchar(128) default NULL, infoemail varchar(128) default NULL, infophone varchar(32) default NULL, closed enum('Y','N') NOT NULL default 'N', closedlink varchar(128) default NULL, closedemail varchar(128) default NULL, price double NOT NULL default '0', PRIMARY KEY  (id), KEY title (title,closed), FULLTEXT KEY title_2 (title,description) ) TYPE=MyISAM; // Simple table     CREATE TABLE calendar (       id int(10) unsigned NOT NULL auto_increment,       date date DEFAULT '0000-00-00' NOT NULL,       PRIMARY KEY (id)     ); // Add first entry     INSERT INTO calendar (id, date) VALUES ( '1', '2002-01-20'); */ // // Configuration options for calendar function // //    This script is written for a mysql database.  I'm too busy (and ignorant) //    to write a wrapper for it.  If you don't want to use the database features //    of this script, just leave the $db_host variable blank. // $db_host =  "localhost"; $db_name =  "eventstest"; $db_username =  "root"; $db_passwd =  ""; $db_table_name =  "calendar"; $db_column_name =  "date"; $db_type = 1; // 0=simple 1=complex // //    How many months across to display? // $num_columns_static = 1; // //    Formatting variables -- change to your heart's content! // $month_table_header =  "\n<table border=0 cellspacing=12>"; $month_row_header =  "\n<tr>"; $month_td_tag =  "<td valign=top>"; $cal_table_tag =  "\n<table width=140 border=0 bgcolor=#DDDDDD>"; $cal_mon_tr_tag =  "\n<tr bgcolor=#D3DCE3>"; $cal_dayname_tr_tag =  "\n<tr bgcolor=#CCCCCC>"; $cal_day_tr_tag =  "\n<tr>"; $cal_day_opentd = "<td align=center>"; $cal_day_closetd = "</td>"; $cal_event_opentd = "<td align=center bgcolor=#c0c0ff><b>"; $cal_event_closetd = "</b></td>"; $event_table_opentag =  "<table cellspacing=0 cellpadding=4 border=0>\n"; $event_table_closetag =  "</table>\n"; $event_tr_opentag =  "\t<tr>\n"; $event_tr_closetag =  "\t</tr>\n"; $event_th_opentag =  "\t\t<th bgcolor=#D3DCE3>\n"; $event_th_closetag =  "\t\t</th>\n"; $event_td_opentag =  "\t\t<td bgcolor=#CCCCCC>\n"; $event_td_closetag =  "\t\t</td>\n"; // //    Connection to the database and selection of the correct db. // $db_link = mysql_connect($db_host, $db_username, $db_passwd); $db = mysql_select_db($db_name, $db_link); // // Function fixlen($string) adds a zero to the front of the string if the // string length does not equal 2 // function fixlen($fixit) {         if (strlen($fixit)<2) {                 return  "0$fixit";         } else {                 return $fixit;         } } // // Function getcal($year) will generate a calendar for the given year. // function getcal($year) {     global $num_columns_static,$month_table_header,$month_row_header,$month_td_tag;     $num_of_months = 12;     $count_up = 1;     echo $month_table_header;     while ($count_up<=$num_of_months) {         echo $month_row_header;         $num_columns = $num_columns_static;         while (($num_columns>0) && ($count_up<=$num_of_months)) {             echo $month_td_tag;             echo gen_month($year,$count_up);             echo  "</td>";             $count_up++;             $num_columns--;         }         echo  "</tr>";     }     echo  "\n</table>"; } // // Function gen_month($year,$month) will generate a month for // the year and month given. // function gen_month($year,$month) {     global $cal_table_tag,$cal_mon_tr_tag,$cal_dayname_tr_tag,$cal_day_tr_tag;     global $cal_event_opentd, $cal_event_closetd;     global $cal_day_opentd, $cal_day_closetd;     $mon_date = getdate(mktime(0,0,0,$month,1,$year));     $mon_name = $mon_date[month];     $mon_total_days = strftime( "%d",mktime(0,0,0,$month+1,0,$year));     echo $cal_table_tag;     echo $cal_mon_tr_tag .  "<td colspan=7 align=center><b>$mon_name $year</b></td></tr>";     echo $cal_dayname_tr_tag .  "<td>Sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Thu</td><td>Fri</td><td>Sat</td></tr>";     $day_count = 1;     while ($day_count<=($mon_total_days-7)) {         $fweek = getdate(mktime(0,0,0,$month,$day_count,$year));         if ($day_count<=7) {             $sb_cnt_td = $fweek[wday];             $sb_cnt = $fweek[wday];             $sb_max = 7;             $p_line = $cal_day_tr_tag;             while ($sb_cnt_td>=1) {                 $p_line .=  "\n<td>&nbsp;</td>";                 $sb_cnt_td--;             }             while ($sb_cnt<$sb_max) {                 //                 // The $urldisp is what shows the number of the                 // day.  the gen_day_url() function makes the                 // number linkable if there is data in a                 // certain table for that day.                 //                 //                 //    $find_data is used in the SQL query in gen_day_url()                 //    If there is any occurrence of $find_data in                 //    $db_column_name, then a link is generated.                 //                 $find_data = $fweek[year] ."-". fixlen($fweek[mon]) ."-". fixlen($day_count);                 $urldisp = gen_day_url($find_data,$day_count);                 if (strlen($urldisp) > 2)                     $p_line .=  $cal_event_opentd . $urldisp . $cal_event_closetd;                 else                     $p_line .=  $cal_day_opentd . $urldisp . $cal_day_closetd;                 $sb_cnt++;                 $day_count++;             }             echo  "$p_line</tr>";         } else {             $weekday_count = 1;             $p_line = $cal_day_tr_tag;             while ($weekday_count<=7) {                 //                 //    $find_data is used in the SQL query in gen_day_url()                 //    If there is any occurrence of $find_data in                 //    $db_column_name, then a link is generated.                 //                 $find_data = $fweek[year] ."-". fixlen($fweek[mon]) ."-". fixlen($day_count);                 $urldisp = gen_day_url($find_data,$day_count);                 if (strlen($urldisp) > 2)                     $p_line .=  $cal_event_opentd . $urldisp . $cal_event_closetd;                 else                     $p_line .=  $cal_day_opentd . $urldisp . $cal_day_closetd;                 $weekday_count++;                 $day_count++;             }             $p_line .= "</tr>";             echo $p_line;         }     }     $sb_cnt_td = 7-($mon_total_days - $day_count);     $p_line = $cal_day_tr_tag;     while ($day_count<=$mon_total_days) {         //         //    $find_data is used in the SQL query in gen_day_url()         //    If there is any occurrence of $find_data in         //    $db_column_name, then a link is generated.         //         $find_data = $fweek[year] ."-". fixlen($fweek[mon]) ."-". fixlen($day_count);         $urldisp = gen_day_url($find_data,$day_count);         if (strlen($urldisp) > 2)             $p_line .=  $cal_event_opentd . $urldisp . $cal_event_closetd;         else             $p_line .=  $cal_day_opentd . $urldisp . $cal_day_closetd;         $day_count++;     }     while ($sb_cnt_td>1) {         $p_line .=  "\n<td>&nbsp;</td>";         $sb_cnt_td--;     }     echo  "$p_line</tr>";     echo  "</table>"; } // // Function gen_day_url($day,$month,$year) makes either a // a plain text day number, or a linked number, depending on if a record // exists for that day. // function gen_day_url($data,$day) {     global $db_table_name,$db_column_name,$db_host, $db_link;     if (strlen($db_host)>0) {         $qrsql =  "SELECT * FROM $db_table_name WHERE ($db_column_name='$data')";         $qr_ret = mysql_query($qrsql, $db_link); $qr_num=mysql_num_rows($qr_ret);         if ($qr_num>0) { // //    Here is where you put the link to the action //    you want to perform if there is data in the //    table. // $row=mysql_fetch_array($qr_ret); return  "<a href=\"showdate.php?date=$data\" alt=\"$qr_num event(s)\" title=\"$qr_num event(s)\">$day</a>";         } else {             //             //    Returns just the number of the day if there             //    is no data in the table for that date             //             return $day;         }     } else {         //         //    This returns just the number of the day, because         //    the $db_host variable is empty (the user does not         //    want to use the db functions of the snippet.         //         return $day;     } } // // Function showdate($date) shows the events for the passed date // function showdate($date) { global $db_table_name,$db_column_name,$db_host, $db_link, $db_type; global $event_table_opentag, $event_table_closetag, $event_tr_opentag, $event_tr_closetag, $event_th_opentag, $event_th_closetag, $event_td_opentag, $event_td_closetag; $dateformatted="<b>Events on $date</b>";     $ret  = $event_table_opentag; $ret .= $event_tr_opentag . $event_th_opentag . $dateformatted . $event_th_closetag . $event_tr_closetag;     if (strlen($db_host)>0) {         $qrsql =  "SELECT * FROM $db_table_name WHERE ($db_column_name='$date') ORDER BY $db_column_name, time";         $qr_ret = mysql_query($qrsql, $db_link); $qr_num=mysql_num_rows($qr_ret);         if ($qr_num>0) { $n=0; // //    Show all Event seperated by a ruler // while($row=mysql_fetch_array($qr_ret)) { $ret .= $event_tr_opentag . $event_td_opentag; if($n) $ret .= "<hr noshade>\n"; // Write time if set if($row[time]) $ret .= "<small>$row[time]</small><br>\n"; // Write title and description $ret .= "<b>" . $row[title] . "</b>" . "<br>\n" . $row[description] . "<p>\n"; // else // $ret .= "<small>All day event</small><br>"; // Provide info if this is a closed event if($row[closed]=='Y') { $ret .= "<small>"; $ret .= "Closed Event<br>"; if($row[closedlink]) $ret .= "To signup, click here: <a href=\"$row[closedlink]\" alt=\"Sign-up using Online Form\" title=\"Sign-up using Online Form\">$row[closedlink]</a><br>\n"; if($row[closedemail]) $ret .= "To signup, write to: <a href=\"mailto:$row[closedemail]\" alt=\"Send email to sign-up\" title=\"Send email to sign-up\">$row[closedemail]</a><br>\n"; $ret .= "</small><br>\n"; } // Write price if set if(intval($row[price])) $ret .= "<b>Price: \$ $row[price]</b><br>\n"; $ret .= $event_td_closetag . $event_tr_closetag; $n++; }         } else {             //             //    Returns just the number of the day if there             //    is no data in the table for that date             //             $ret .= $event_tr_opentag . $event_td_opentag . "No events found for this date" . $event_td_closetag . $event_tr_closetag;         }     } else {         //         //    This returns just the number of the day, because         //    the $db_host variable is empty (the user does not         //    want to use the db functions of the snippet.         //         $ret .= $event_tr_opentag . $event_td_opentag . "No Database defined. How can you have any events?!" . $event_td_closetag . $event_tr_closetag;     }     $ret .= $event_table_closetag;     $ret .= "\n\n<p>\n\n<a href=\"\" OnClick=\"javascript:back()\">Back to Calendar</a><p>\n"; return $ret; } ?> [/code] and then i have the file that shows the calendars with the link to show the events on a particular date named calendar.php: [code] <? require("showdate.php");   // Here is the call!!!   $year = 2006;   getcal($year); ?> [/code] the problem is when i click on a date i only get a blank page, no information about an events shows as it suppost, just blank, any ideas what im doing wrong? thanks for any help in advance.
  24. I see, but how would both tables be combined when inserting data in to them? thanks for the help in advance.
  25. Hi Sorry for the late reply, ok, i know what you mean now, i found this nice easy to follow tutorial that will show you how to do this in a snap follow the below link: http://www.netcode.net/tutorials/php_mysql/easy_navigation.php hope that helps  ;D
×
×
  • 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.