Jump to content

arunpatal

Members
  • Posts

    273
  • Joined

  • Last visited

Everything posted by arunpatal

  1. So am using it like this now....... but the problem is that it shows all username which have S P N in it. <?php require("connect/connection.php"); $result = mysql_query("SELECT * FROM $demo WHERE username RLIKE '[SPN]'"); while ($row = mysql_fetch_array($result)) { echo "$row[username] from $row[country]<br/>"; } ?> I want only those username which are starting with letter S P and N
  2. How do i use this with mysql ??? please help me
  3. True.... I want to display all username starting with S, P and N... I am following this tutorial but still not working....... http://www.w3resource.com/sql/wildcards-like-operator/wildcards-charlist.php Tutorial
  4. Hi, i am trying to use charlist wildcard but its not working..... Please check and help I want to display all username starting with S,P and N. <?php require("connect/connection.php"); if (!empty ($_POST['start'])) { $start = $_POST['start']; $result = mysql_query("SELECT * FROM $demo WHERE username LIKE '[$start]%'"); while ($row = mysql_fetch_array($result)) { echo "$row[username] from $row[country]<br/>"; }} ?> <form method='post'> <input type='text' name='start' placeholder="ugn" size='50'/><br><br> <input type='submit' value='Search' /> </form>
  5. Hi, Is there any function like highlight_string in PHP for Javascript..... I just need a simple function without including many files.... PHP example <?php highlight_string('<?php echo "world"; ?>') ?>
  6. Hi, i can bold or underline the text which is inside textarea.... but how can i make like if i select some text and click on div button then the slected text will be inside a div. Also i want to have id for this div.... <html> <head> <script type="text/javascript" src="rich_textarea.js"></script> </head> <body onLoad="iFrameOn();"> <h2>My web application that intakes data from users</h2> <form action="my_parse_file.php" name="myform" id="myform" method="post"> <div id="wysiwyg_cp" style="padding:8px; width:700px;"> <input type="button" onClick="iBold()" value="B"> <input type="button" onClick="iUnderline()" value="U"> </div> <textarea style="display:none;" name="myTextArea" id="myTextArea" cols="100" rows="14"></textarea> <iframe name="richTextField" id="richTextField" style="border:#000000 1px solid; width:700px; height:300px;"></iframe> <br /><br /><input name="myBtn" type="button" value="Submit Data" onClick="javascript:submit_form();"/> </form> </body> </html> This is rich_textarea.js file function iFrameOn(){ richTextField.document.designMode = 'On'; } function iBold(){ richTextField.document.execCommand('bold',false,null); } function iUnderline(){ richTextField.document.execCommand('underline',false,null); } function submit_form(){ var theForm = document.getElementById("myform"); theForm.elements["myTextArea"].value = window.frames['richTextField'].document.body.innerHTML; theForm.submit(); }
  7. Hi, Am not storing data in one table because there is lot of information..... I will try UNION ALL tomorrow and will come back with the result But thanks for looking into the matter
  8. Hi, i have 4 tables and three of them have same fields T1 = CSS T2 = PHP T3 = HTML T4 = subcat_table now i am sending one value via get link page.php?sub_id=14 now i want to display all data from T1, T2, T3 which have sub_id value = 14. ofcourse T1, T2, T3 have sub_id field.
  9. Hi This is jquery code <script type="text/javascript" src="style/jQuery.js"></script> <script type="text/javascript" src="style/jquery-ui.min.js"></script> <script type="text/javascript"> $(document).ready(function() { // Mouse Enter Animation Mechanism $("#menu a").mouseenter(function () { $(this).switchClass("style1", "style2", 500); }); // Mouse Leave Animation Mechanism $("#menu a").mouseleave(function () { $(this).switchClass("style2", "style1", 500); }); }); </script> Should i upload jquery-ui.min.js file also ???? Hope this problem can be solve
  10. Hi, I am using jquery for hover effect on div here is the code <style type="text/css"> body{margin:0px;} #menu{background:#FFF; border:#1E1E1E 0px solid; padding:8px 0px 9px 0px;} .style1 { background-color:#FFF; font-size:16px; color:#666; padding:10px 50px 10px 50px; border-right:#1E1E1E 1px solid; text-decoration:none; } .style2 { background-color:#055F7C; font-size:16px; color:#FFF; padding:10px 50px 10px 50px; border-right:#1E1E1E 1px solid; text-decoration:none; } #header_menu_tr{ height:30px; } #header_menu_td{ background:#FFF; text-align:left; } .header_menu_div{ padding-left:30px; width:980px; margin:auto; float:left; } /* End styles for the menu elements */ </style> </head> <table id="header_table"> <tr id="header_top_tr"> <td id="header_left_td"> </td> <td id="header_center_td"> </td> <td id="header_right_td"> </td> </tr> <tr id="header_menu_tr"> <td id="header_menu_td" colspan="3"> <div class="header_menu_div" id="menu"><a class="style1" href="#">Home</a><a class="style1" href="#">Home</a></div> </td> </tr> </table> But on left side there is 1px margin and i dont want this. checkout image.
  11. Got it.. Thanks
  12. OK so this is how it works This form send values <form method='POST' action="list.php"> <input type="hidden" name="image[]" value="<?php echo $row_list['id']; ?>" /> <input type="hidden" name="image[]" value="<?php echo $row_list['image_1']; ?>" /> <input type="hidden" name="image[]" value="<?php echo $row_list['image_2']; ?>" /> <input type="hidden" name="image[]" value="<?php echo $row_list['image_3']; ?>" /> <input type="hidden" name="image[]" value="<?php echo $row_list['image_4']; ?>" /> <input type="submit" value="Delete" /> </form> This code deletes the all images + id row from database <?php if(isset($_POST['image'])) { for ($i=0;$i<count($_POST['image']);$i++) { $pictodelete = ("images/".$_POST['image'][$i].""); if (file_exists($pictodelete)) { unlink($pictodelete); } $sql = mysql_query("DELETE FROM test WHERE id='".$_POST['image'][$i]."' LIMIT 1") or die (mysql_error()); }} ?>
  13. Finally i come up with this code....... I think this is the best way. Please let be know if it can be written better <?php if(isset($_POST['image'])) { $del = array ($_POST['image'][0], $_POST['image'][1], $_POST['image'][2], $_POST['image'][3], $_POST['image'][4]); for ($i=0;$i<count($del);$i++) { $pictodelete = ("images/$del[$i]"); if (file_exists($pictodelete)) { unlink($pictodelete); } }} ?> $_POST['image'] is already array and i tried the code below but it gives me error in line images/$_POST['image'][$i] <?php if(isset($_POST['image'])) { for ($i=0;$i<count($_POST['image']);$i++) { $pictodelete = ("images/$_POST['image'][$i]"); if (file_exists($pictodelete)) { unlink($pictodelete); } }} ?>
  14. Hi, I am trying to loop like this <?php if(isset($_POST['image'])) { for ($i=0;$i<count($_POST['image']);$i++) { $pictodelete = ("images/$_POST['image'][$i]"); } } ?> But images/$_POST['image'][$i] gives me error i am sending these values <form method='POST' action="list.php"> <input type="text" name="image[]" value="<?php echo $row_list['id']; ?>" /> <input type="text" name="image[]" value="<?php echo $row_list['image_1']; ?>" /> <input type="text" name="image[]" value="<?php echo $row_list['image_2']; ?>" /> <input type="text" name="image[]" value="<?php echo $row_list['image_3']; ?>" /> <input type="text" name="image[]" value="<?php echo $row_list['image_4']; ?>" /> <input type="submit" value="Delete" /> </form>
  15. Hi, i wanted to do this thing via loop but its very hard for me to understand..... But the way i make is also working..... I am passing 5 values via delete link <?php if (isset($_GET ['deleteid'])) { $id = $_GET ['deleteid']; $pic1 = $_GET ['deleteimg1']; $pic2 = $_GET ['deleteimg2']; $pic3 = $_GET ['deleteimg3']; $pic4 = $_GET ['deleteimg4']; $pictodelete1 =("images/$pic1"); $pictodelete2 =("images/$pic2"); $pictodelete3 =("images/$pic3"); $pictodelete4 =("images/$pic4"); if (file_exists($pictodelete1)) { unlink($pictodelete1); unlink($pictodelete2); unlink($pictodelete3); unlink($pictodelete4); } $sql = mysql_query("DELETE FROM test WHERE id='$id' LIMIT 1") or die (mysql_error()); }; ?> But am eager to know that how will this function with the help of loop....... :confused: :confused:
  16. Surly, i will come back within 24hours from now and hopefully with nice results
  17. Your are right..... It will take much more time then asking for help but i will be learning more... I will try myself and hopefully will figer out how can i delete these images. Thanks for nice advice and also help
  18. I am trying to delete the image This code is very simple <?php if (isset($_GET['delete'])) $id_to_delete = $_GET['delete']; $pictodelete = ("images/$id_to_delete"); if (file_exists($pictodelete)) { unlink($pictodelete); } ?> Here is the delete link code <a href='list.php?delete=<?php echo $row_list['image_2']; ?>'>delete</a> But the problem is that i want to delete 4 images which are in same row $row_list['image_1'] $row_list['image_2'] $row_list['image_3'] $row_list['image_4'] I tried like this <a href='list.php?delete=<?php echo $row_list['image_1']; ?>&<?php echo $row_list['image_2']; ?>'>delete</a> But its only deleting $row_list['image_2'] How can i delete all these images at once ???????
  19. I don't understand the value (name of image) of image shows like this $row_list['image'] $row_list['image1'] What should i do?
  20. This code delete the image which is saved as id number: Example In my table there are 4 fields id (ai and pk) name image1 image2 Now if my id is 137 and the name of image also 137.jpg then the script delete the image... I want to delete images from images folder and name of these images are not saved as id but in image1 and image2 <?php // Delete Item Question to Admin, and Delete Product if they choose if (isset($_GET['deleteid'])) { echo 'Do you really want to delete product with ID of ' . $_GET['deleteid'] . '? <a href="list.php?yesdelete=' . $_GET['deleteid'] . '">Yes</a> | <a href="list.php">No</a>'; exit(); } if (isset($_GET['yesdelete'])) { // remove item from system and delete its picture // delete from database $id_to_delete = $_GET['yesdelete']; $sql = mysql_query("DELETE FROM test WHERE id='$id_to_delete' LIMIT 1") or die (mysql_error()); // unlink the image from server // Remove The Pic ------------------------------------------- $pictodelete = ("images/$id_to_delete.jpg"); if (file_exists($pictodelete)) { unlink($pictodelete); } header("location: list.php"); exit(); } ?> <table> <tr> <td>Name</td> <td>Action</td> </tr> <?php do { ?> <tr> <td><?php echo $row_list['name']; ?></td> <td> <a href='list.php?deleteid=<?php echo $row_list['id']; ?>'>delete</a></td> </tr> <?php } while ($row_list = mysql_fetch_assoc($list)); ?> </table>
  21. The code works... now i will try to understand the code Thanks
  22. am waiting...
  23. When i add item from from 1.... it display the item like this array(1) { ["item"]=> array(1) { [2]=> string( "Computer" } } and when i go back to 1st page and add item from form 2 then the 1st item from from 1 is not there... i want to display multi items from different forms This is my form page <?php session_start(); ?> <form action="b.php" method="post"> Item 1: <input type="text" name="item[1]" value="1"> <input type="submit" value="add"> </form> <form action="b.php" method="post"> Item 2: <input type="text" name="item[2]" value="2"> <input type="submit" value="add"> </form> and this is the page which receive items <?php session_start(); ?> <?php echo var_dump ($_POST); ?>
  24. i looked around and found some shopping cart tutorials but they are very complicated. I am just looking a simple example via which i can add multi item to session.
  25. But i want to add different items... just like shopping cart
×
×
  • 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.