PravinS
Members-
Posts
459 -
Joined
-
Last visited
-
Days Won
2
Everything posted by PravinS
-
mysql_real_escape string or htmlspecialchars, etc. what to use?
PravinS replied to justAnoob's topic in PHP Coding Help
Use this function function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number or a numeric string if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } -
You can you date function with hour/minute/second as first parameter and the timestamp value as second parameter
-
You can also convert date into timestamp using mktime() function and use it in loop.
-
Alert the "result" and check what you are getting.
-
Categories dropdown with x amount of subcategories.
PravinS replied to ram4nd's topic in PHP Coding Help
May this will help you, its a simple dynamic multilevel menu https://sourceforge.net/projects/multilevelmenu/files/latest/ -
You mean to add text box to edit in combo box?
-
Also if you want to display any other text from table then you need to add field name in query and you drop down will be like this. while ($row=mysql_fetch_array($result)) { echo '<option value="'.$row['supp_id'].'">'.$row['TXTFIELD'].'</option>\n'; } check the TXTFIELD in drop down, just replace your field name there
-
Replace the while loop while ($row=mysql_fetch_array($result)) { echo '<option value="'.$row['supp_id'].'">'.$row['supp_id'].'</option>\n'; }
-
Try this function function sort_array($array, $key, $order) { if ($order=="DESC") $or="arsort"; else $or="asort"; for ($i = 0; $i < sizeof($array); $i++) { $sort_values[$i] = $array[$i][$key]; } $or($sort_values); reset ($sort_values); while (list ($arr_key, $arr_val) = each ($sort_values)) { $sorted_arr[] = $array[$arr_key]; } return $sorted_arr; }
-
Give name to submit button and write your search code in isset of submit button. <form method="get"> <input type="text" name="search" value="<?php echo $search; ?>"> <input type="submit" value="Search" name="btnSubmit"> </form> <?php if (isset($_POST['btnSubmit'])) { //you search code } ?>
-
Use like this <a href="#"><img src="" border="0"></a>
-
Ok, I have attached the zip file [attachment deleted by admin]
-
You can download this simple PHP/MYSQL/JAVASCRIPT menu designed by me from below given link. It is freeware. https://sourceforge.net/projects/multilevelmenu/files/latest/
-
If data type of the date field is DATE or DATETIME then you can use DATE_FORMAT(date,format) function in your select query.
-
You can use this function function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number or a numeric string if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; }
-
If the session variable "area" is blank then that option will be selected.
-
problem with 'W' but fine with all other date-related letters, why?
PravinS replied to artist19's topic in PHP Coding Help
What PHP version you are using? -
Check the % character, it should be in single quotes $sql = SELECT * FROM articlessection where 1 and ArticlesSection_Name LIKE '%ar%' and Language_ID =2 Order by ArticlesSection_Order ASC
-
May this will help you. It will give you complete folder path. You can explode it with "/" character and take the last value of array for current folder name. $dir = dirname($_SERVER['REQUEST_URI']);
-
Try this <?PHP $res = mysql_query("SELECT id, DATE_FORMAT(date, '%S %D %Y') as dt, firstname, lastname, testimonial FROM testimonials ORDER BY date DESC LIMIT 10"); while ($row = mysql_fetch_assoc($res)) { echo "<b>{$row['firstname']} {$row['lastname']}</b><br />on {$row['dt']}<br />{$row['testimonial']}<br /><br />"; } ?> If "date" is you field name then it should work.
-
I cannot concatinate things to save my life
PravinS replied to deansaddigh's topic in PHP Coding Help
Use like this echo '<a href="http://www.dhcottages.co.uk/testsite/admin/clients/addClients.php?id='.$id.'">Client allready exists click here to view and change client details.</a>'; -
Use preg_split() function <?php $string = 'Sam Neill|William H. Macy|Tea Leoni|'; $keywords = preg_split("/[|$*]+/", $string); print_r($keywords); ?>
-
Use explode() function to separate.
-
how can I validate this simple contact us form?
PravinS replied to co.ador's topic in PHP Coding Help
You can use javascript validation -
PHP + MYSQL Categories > Sub Categories | Help!
PravinS replied to GFXUniverse's topic in PHP Coding Help
You can change your table structure as told by "laffin" and then you can use recursive function to retrieve the subcategories.