Search found 336 matches

by PHPycho
Tue Apr 19, 2011 3:37 am
Forum: Databases
Topic: How to query for this?
Replies: 2
Views: 1159

How to query for this?

Hi I have following two tables: tbl_customers id customer_name customer_email ------ ------------- ------------------ 1 Name1 email@hotmail.com 2 Name2 email2@hotmail.com 3 Name3 email3@hotmail.com And tbl_customer_category_clicks id category_id customer_id clicks ------ ----------- ----------- ----...
by PHPycho
Tue Nov 09, 2010 2:21 am
Forum: Javascript
Topic: auto submit form outside of frame
Replies: 1
Views: 993

auto submit form outside of frame

Hi i have a form inside a frame, for example: <html> <body> <div><h1>Header</h1><hr /></div> <iframe height="75%" width="75%" src="iframe.php" frameborder="0"> Iframe should be enabled. </iframe> <div><hr /><h1>Footer</h1></div> </body></html> in iframe.php <f...
by PHPycho
Wed Mar 10, 2010 10:43 pm
Forum: PHP - Code
Topic: which one is better?
Replies: 1
Views: 90

which one is better?

Which one do you prefer among the two? function genRandomNo($length = 5){      $string = substr(md5(uniqid(rand(), true)), 0, $length);     return $string; } Vs function genRandomNo($length = 5){      $string = substr(md5(microtime() * mktime()), 0, $length);     return $string; } also you can sugge...
by PHPycho
Fri Mar 05, 2010 5:05 am
Forum: PHP - Code
Topic: help in db design
Replies: 3
Views: 169

Re: help in db design

Please suggest me among the two?
yes ofcourse i will take that separation of image details into separate table in mind.
thanks
by PHPycho
Fri Mar 05, 2010 12:34 am
Forum: PHP - Code
Topic: help in db design
Replies: 3
Views: 169

help in db design

Hello forums!! I am in dilema regarding DB design, so I am expecting the forumians help here. I have 3-4 tables(say categories, brands, products, etc.) and each table has images. I would like to design db for images for all those tables. 1> My first Approach: ---------------- category_images -------...
by PHPycho
Tue Feb 23, 2010 2:48 am
Forum: Databases
Topic: how to manage products with different flags??
Replies: 4
Views: 656

Re: how to manage products with different flags??

@Luke: Can you elaborate??
Why my question doesn't make much sense???
by PHPycho
Tue Feb 23, 2010 1:59 am
Forum: Databases
Topic: how to manage products with different flags??
Replies: 4
Views: 656

how to manage products with different flags??

How do you handle product with different flags like featured, new, christmas special, valentine special..?

do you use fields in the same product table (sayroducts)
or different table
But How?
by PHPycho
Wed Jan 20, 2010 4:45 am
Forum: PHP - Code
Topic: avoid repeated mysql_real_escape_string?
Replies: 10
Views: 166

Re: avoid repeated mysql_real_escape_string?

I have made one such utility regarding automatic sql escaping: Please have a look and comment/suggest if there is any rooms for improvements. //utility functions function escape($input){     if(is_array($input)){                   return array_map('escape', $input);         }else{                  $...
by PHPycho
Tue Jan 19, 2010 5:40 am
Forum: PHP - Code
Topic: avoid repeated mysql_real_escape_string?
Replies: 10
Views: 166

avoid repeated mysql_real_escape_string?

Consider: $sql = "SELECT * FROM table WHERE field1='".mysql_real_escape_string($field1_value)."' AND field2 ='".mysql_real_escape_string($field2_value)."'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ //fetching goes here.. } above approach is...
by PHPycho
Fri Jan 15, 2010 6:31 am
Forum: PHP - Code
Topic: PHP's strip_tags() equivalent MYSQL function
Replies: 4
Views: 555

Re: PHP's strip_tags() equivalent MYSQL function

Consider my case and see what if your's keywords_tag_stripped = 'font' (which itself is stripped btw)
I dont think this approach will work.
by PHPycho
Fri Jan 15, 2010 5:40 am
Forum: PHP - Code
Topic: PHP's strip_tags() equivalent MYSQL function
Replies: 4
Views: 555

PHP's strip_tags() equivalent MYSQL function

Hello forums! I was just wondering to know how this can be accomplished: Case: SELECT * FROM cms_pages WHERE body LIKE '%keywords%'; Problem: Suppose my keyword=font & body field contains: <div style="font-size:12px">This is a body area</div> then above query fetches this row. I would ...
by PHPycho
Thu Jan 14, 2010 5:03 am
Forum: PHP - Code
Topic: array issues with intersect
Replies: 3
Views: 566

Re: array issues with intersect

foreach($array1 as $array1key => $array1value) {      $final_array[$array1key] = array_merge($array1value, $array2[$array1key]);  }   should be foreach($array1 as $array1key => $array1value) {      $final_array[$array1key] = array_merge($array2[$array1key], $array1value); } note the changes made. T...
by PHPycho
Thu Jan 14, 2010 4:08 am
Forum: PHP - Code
Topic: array issues with intersect
Replies: 3
Views: 566

Re: array issues with intersect

yes exactly..
many thanks :lol:
by PHPycho
Wed Jan 13, 2010 11:48 pm
Forum: PHP - Code
Topic: array issues with intersect
Replies: 3
Views: 566

array issues with intersect

Problem: see the inline comments in the following code: <?php $array1 = array(     'key1' => array(         'name' => 'Product1.1'         ,'price' => 220         ,'qty_in_x' => 100     )     ,'key2' => array(         'name' => 'Product1.2'         ,'price' => 120         ,'qty_in_x' => 150     )   ...
by PHPycho
Wed Jan 13, 2010 6:34 am
Forum: PHP - Code
Topic: query in multiple DB
Replies: 6
Views: 244

Re: query in multiple DB

different databases within the same instance