vichu.1985
Members-
Posts
23 -
Joined
-
Last visited
Never
Everything posted by vichu.1985
-
Help with mysql Update - it won't update
vichu.1985 replied to francistan's topic in PHP Coding Help
Dude, Are you sure that your update query is executing? I mean, is execution going inside the if "(!$error) {" condition? If its going then try [ echo $update; ] to check the query. -
Dude, U might need to use union for this: Consider the following query select * from( select * from table_name where field1=value1 union select * from table_name where field2=value2) tab order by field3 Hope this will help you
-
Search multiple mySQL tables for search function
vichu.1985 replied to petenaylor's topic in PHP Coding Help
IN that case we need to use union. Like, select * from store_items where description like \"%$trimmed%\" or title like \"%$trimmed%\" or dimensions like \"%$trimmed%\" order by id ASC union select * from about_text where description like \"%$trimmed%\" or title like \"%$trimmed%\" or dimensions like \"%$trimmed%\" order by id ASC union select * from faq_text where description like \"%$trimmed%\" or title like \"%$trimmed%\" or dimensions like \"%$trimmed%\" order by id ASC here the condition is first query's fields = 2nd query's fields = 3rd queries field -
Search multiple mySQL tables for search function
vichu.1985 replied to petenaylor's topic in PHP Coding Help
Dude, Need to know whether these three tables are related to each other. If its related tables then we'l b using joins. If these are not related, need to know the field names in each tables to write query with union functionality........ -
Dude, I assume that footer.php has some contents and it has an echo statement itself to show the content. In this case you just need to include the footer.php based on your condition. You don't need to use echo in your main file.
-
Dude, I guess u need to change your logic as follows: In first file, separate JS code - <script type="text/javascript"> function call_confirm(){ var answer = window.confirm ("Are you sure you want to delete?"); if (answer) return true; else return false; } </script> <?php echo "<td><a href=delete.php?id=" . $rows['id'] ." onclick=\"return call_confirm()\">Delete</a></td>"; ?> In your delete.php, directly write query. $id=$_GET['id']; $sql="DELETE FROM document WHERE id='$id'";
-
Distribute results evenly between columns
vichu.1985 replied to GalaxyTramp's topic in PHP Coding Help
Dude, Just replace the for loop with this for($i=0;$i<$number;$i++){ if($i%2 == 0){ $left_side .= '<dt> <img src="../pics/'.$images[$i].'" alt="" width="120" height="120" class="border1" /><br /><br /> </dt>'; } else{ $right_side .= '<dt> <img src="../pics/'.$images[$i].'" alt="" width="120" height="120" border="0" class="border1" /><br /><br /> </dt>'; } } -
Distribute results evenly between columns
vichu.1985 replied to GalaxyTramp's topic in PHP Coding Help
Dude, Its a small logic as follows: <?php $query = mysql_query("SELECT COUNT(id) FROM " . $prev . "pics where id=" . $id . ""); list($number_records) = mysql_fetch_row($query); if ($number_records >= 10 ) { $number =10; //LIMIT IMAGES TO 10 } else { $number =$number_records; } echo "<br />"; echo "Displaying $number of $number_records images"; $left_side = ''; $right_side = ''; for($i=0;$i<$number;$i++){ if($i%2 == 0){ $left_side = '<dt> <img src="../pics/'.$images[$i].'" alt="" width="120" height="120" class="border1" /><br /><br /> </dt>'; } else{ $right_side = '<dt> <img src="../pics/'.$images[$i].'" alt="" width="120" height="120" border="0" class="border1" /><br /><br /> </dt>'; } } ?> <div class="thumb-right"> <dl> <?php print $right_side; ?> </dl> </div> <div class="thumb-left"> <dl> <?php print $left_side; ?> </dl> </div> -
how to display selected radio button from Mysql data?
vichu.1985 replied to Darkwoods's topic in PHP Coding Help
Dude, Try with this <form name="test" action="submit.php" method="post"> <?php $selected = 1; // it will be queried value if($selected == 1){ echo '<INPUT TYPE=RADIO NAME="size" VALUE="1" CHECKED >one<BR> <INPUT TYPE=RADIO NAME="size" VALUE="2">two<BR>'; } else{ echo '<INPUT TYPE=RADIO NAME="size" VALUE="1">one<BR> <INPUT TYPE=RADIO NAME="size" VALUE="2" CHECKED >two<BR>'; } ?> </form> -
A problem with select and count function in the same query...
vichu.1985 replied to avdzm's topic in MySQL Help
Dude, You try with this $result = mysql_query("SELECT sum(tblRecipe.UNIT) as 'sumUnit', tblSpice.spiceID, spice, tblRecipe.UNIT as 'rUnit' , tblSpice.UNIT as 'sUnit', tblProduct.productID, product FROM tblRecipe, tblProduct, tblSpice WHERE tblRecipe.productID=tblProduct.productID AND tblRecipe.spiceID=tblSpice.spiceID AND tblProduct.productID= '$productID'"); -
A problem with select and count function in the same query...
vichu.1985 replied to avdzm's topic in MySQL Help
Dude, Can u put the full query? -
Dude, The issue is Default JS wont work with the Dynamic form Elements....... I mean to say that, the second drop down is dynamic here. You cant apply any Loaded JS like on change of the values, do something or blah blah...... You can try with the following manner.... While you are loading the second drop down, add an event function on Change of that... like render the second drop down as follows: <select name="second" onchange="return call_JS_function_for_AJAX_Call_Or_Something_Else()" > <option>1</option> <option>2</option> </select> In that JS function write ur logic......
-
Insert a new row in mysql for each line in a html textarea.
vichu.1985 replied to lynxus's topic in PHP Coding Help
Dude, I assume that every line is separated by "Enter key"(At the end of line you have pressed enter key) in the Textarea. In this case you can use the following code and get the textarea value in array format and write insert query to it...... $values = $_POST['textarea_name']; $array = split("\r\n", $values); foreach($array as $line){ mysql_query("insert into table(field) values($line)"); } -
Bit of a dilemma, need help with cookies and sessions
vichu.1985 replied to nobodyk's topic in PHP Coding Help
Dude, In my view, you can use $_SERVER['HTTP_COOKIE']. While saving any image, save this value also with date if you required. Its easy to retrieve to get a particular client's images..... -
Dude, Using form_alter hook, you can remove that option from the dropdown. Here is the sample code..... function mymodule_form_alter(&$form, $form_state, $form_id){ if($form_id == 'user_admin_account'){ unset($form['options']['operation']['#options']['block']); } } Hope this will help you...................
-
Drupal: login/register form should appear below post
vichu.1985 replied to thestars's topic in Applications
Dude, Try with nodeapi hook as follows function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){ if($node->type == 'blog'){ switch($op){ case 'view': global $user; if($user->uid == 0){ $node->content['show_login'] = array('#value' => drupal_get_form('user_login_block'), '#weight' => 99); } break; } } } hope this will help you............ -
Insert into database multiselect box values
vichu.1985 replied to pahunrepublic's topic in PHP Coding Help
try with php code <?php $test=$_POST['test']; $result = ''; if ($test){ foreach ($test as $t){ $result .= $t.','; } $result = trim($result, ','); } // write ur insert query with $result variable ?> -
Dude, I would say you need to create 1 new table to save friends list. I mean you can save the list as follows id | friend 001 | 002 001 | 003 001 | 004 002 | 003 - - - Here 002 is ID of Joe 003 is ID of Jane 004 is ID of Mike. The reason, later if you want to get all friends of Keith(001), or you need to get the common friends between Keith(001) and Joe(002), its easy to achieve it by a single query.........
-
Dude, I couldn't understand your exact requirement. But still i can give you some tips to follow. You have used strcmp function (http://php.net/manual/en/function.strcmp.php ) .It expects 2 arguments. But the way you used is something different. Also you are creating table inside the while loop. So for every row of database record, 1 new table will get created. You may need to do something like this echo '<table>'; while($row = mysql_fetch_array($query)){ echo '<tr>'; if(strcmp($str1, $str2)) echo '<td>'.$value.'</td>'; else echo '<td>'.$value1.'</td>'; - - - - - - - echo '</tr>'; } echo '</table>'; ----- Hope this will help you
-
Dude, Its a HTML code. So you need to parse it. Refer http://simplehtmldom.sourceforge.net/ . You will see a section called "Quick start". $html = "<put your HTML codes here>"; // Find all links foreach($html->find('a') as $element) echo $element->href . '<br>'; this will return all <a>'s href........... Hope this will help you..............
-
Dude, I would say you need to customize the system by editing the core. I'm sure your session variable will have the info about the logged in user. So write a script that will do a small validation just before sending mail. script may be like this $mail = $_POST['mail_id']; $query = mysql_query("select email_id from user_table where user_id = ".$_SESSION['user_id']); $user_email = mysql_result($query, 0); if($mail == $user_email){ // do required when entered email ID == logged in user's mail ID } else{ // do required when entered email ID != logged in user's mail ID } ------ hope im in the right track
-
Hey dude, You don't need to save the images in mysql. Just save it in some folder example under "images" folder and save the path with User data. Using mod_access module of apache, you can deny permission to access the "images" folder. like <Directory /docroot/images> order deny,allow deny from all </Directory> You may get some idea from this......
-
Help with getting next row data to check for similar data
vichu.1985 replied to Solarian_TK's topic in PHP Coding Help
You should have selected your table's primary key field with $a[]['key'] = "primary key value" to update the leader field. Try with this $index = 1; foreach($a as $value){ if($a[$index]['feeder'] == $value['feeder']){ //update the "leader" field to 1 where key_field = "$a[]['key']" } else{ //update the "leader" field to 0 } $index++; }