Jump to content

chauhanRohit

Members
  • Posts

    13
  • Joined

  • Last visited

chauhanRohit's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. how can i do this ? i have a number of links , when i click one a pop up is displayed, i need to run a php script depending upon which link is clicked. Or can i run a javascript function once a query string is passed in the url Please advice.
  2. one last thing how do i use a image instead of a button ,the code above uses a button to close the popup. Thanks
  3. Thanks that works. can u explain why this is happening ? is it by default or is it a mistake.
  4. Hi guys, I am using this code to open and close a pop up window, but as soon as i click the close button this http://localhost/popup.php?random=&button= automatically adds in the url, Please tell me what is wrong with the script <script type="text/javascript"> $(document).ready(function(){ $('a.popup-window').click(function(){ var popupBox = $(this).attr('href'); $(popupBox).fadeIn(400); var popMargTop = ($(popupBox).height() + 24)/2; var popMargLeft = ($(popupBox).width() + 24)/2; $(popupBox).css({ 'margin-top' : -popMargTop, 'margin-left' : -popMargLeft }); $('body').append('<div id="mask"></div>'); $('#mask').fadeIn(400); return false; }); $('button.close,#mask').live('click', function(){ $('#mask,.popupInfo').fadeOut(400,function(){ $('#mask').remove(); }); return false; }); }); $(document).keyup(function(e){ if(e.keyCode ==27){ $('#mask,.popupInfo, #popup-box').fadeOut(400); return false; } }); </script> </head> <body> <a href="#popup-box" class="popup-window">Click</a> <div id="popup-box" class="popupInfo"> <form> <label>ANYTHING</label></br> <input type="text" name="random"/></br> <button type="submit" name="button" class ="close">close</button> </form> </div> </body> </html>
  5. hey the first code i posted is giving me the result that i want but as i said earlier it has two outputs, so i tried editing the code and posted the new code here, i dont know why this annoyed you guys i am just looking for a solution here. if you see i have managed to get the results as one outputs in my second code , but the results are being duplicated can you just tell me a way to avoid this. as per the relationship between the two tables i have added a foreign key in the books table (author_id), all i want is the names and the book names from the two tables. if this not possible , can u suggest a way to achieve this.
  6. This is the output that i get when i a use this code, I have 2 tables authors and books and i want to display the author names and book names from the two tables $query = mysql_query("SELECT authors.fname,authors.lname,books.book_name from authors,books ") or die ('cannot connect'); $count = mysql_num_rows($query); if($count ==0){ $output = 'no results'; }else{ $output = '<div>'; while($row = mysql_fetch_array($query)){ $output .='<div> '.$row['fname'].' '.$row['lname'].'</br> '.$row['book_name'].' </br></br> </div>'; } $output .='<div>'; } echo $output; THE output sydney sheldon If Tomorrow Comes Jeffrey archer If Tomorrow Comes Ruskin Bond Chetan Bhagat If Tomorrow Comes sydney sheldon Master of the Game Jeffrey archer Master of the Game Ruskin Bond Master of the Game Chetan Bhagat The output that i want is sydney sheldon Jeffrey archer Ruskin Bond Chetan Bhagat If Tomorrow Comes Master of the Game
  7. This is the code $query = mysql_query("SELECT fname,lname FROM structure.authors "); $query1 = mysql_query("SELECT book_name FROM structure.books"); $count = mysql_num_rows($query); $count1 = mysql_num_rows($query1); if($count ==0 and $count1 ==0 ){ $output = '<div>no results</div>'; }else{ $output = '<div>'; while($row = mysql_fetch_array($query)){ $output .='<div> '.$row['fname'].' '.$row['lname'].' </div>'; } $output .='<div>'; //the output from second table $output1 = '<div>'; while($row = mysql_fetch_array($query1)){ $output1 .='<div> '.$row['book_name'].' </div>'; } $output1 .='<div>'; } echo $output; echo $output1;
  8. Hi guys, can i use a single div to display different data from the database and how to display the output from a php into the html page, THis is the php file how do i output the results back to index.php <?php include 'php_includes/connection.php'; $C_output = ''; //collect //query $query = mysql_query("SELECT * FROM authors WHERE fname LIKE 'Aardema' ") or die("could not search"); $count = mysql_num_rows($query); if($count == 0){ $C_output = '<div>"there was no search result!"</div>'; }else{ $C_output = '<div>'; while($row = mysql_fetch_array($query)){ $C_output .= '<div class="content"> '.$row['fname'].' '.$row['lname'].'<br /> '.$row['content'].' <br /><br /></div>'; } $C_output .= '</div>'; } echo($C_output); mysql_close(); ?> Thanks
  9. Hi experts, can you help me understand how this can be done, i tried but cannot find a solution ... I have two main links PRODUCT-1 and PRODUCT-2 on my homepage, the same page also has a sidebar that contains 1.PRICE . 2.DATE 3.image Now if i click product-1, and then click the price the page should show the price of product-1, if i click DATE then it displays the manufacturing date of the product and so on.( the data is stored in the database) and if i click PRODUCT-2 than the sidebar will show results according to that. plz help thanks.
  10. well i made a search bar that displays the results from the database. and the code is the function that searches the database. please see the code , where should i add the <tr> , <td> tags so that each output is displayed in different rows and each one is a link. now the results are displayed as a single element within div.
  11. sorry i did not mention this , but i am new to php and can you please help me with the code. plz.
  12. Hi, guys this is my first post here thanks for reading it, i was working on a search bar , the search works fine and i would like to add a few more functionalities to it. 1.make the search result as dropdown list from the search bar. 2.make the results from the dropdown list links. can any one know how this can be achieved. this is the code. <?php mysql_connect("localhost","root","") or die("could not connect"); mysql_select_db("test") or die("could not find database"); $output = ''; //collect if (isset($_POST['searchVal']) && trim($_POST['searchVal'])!='') { $searchq = $_POST['searchVal']; $searchq = preg_replace("#[^0-9a-z]#i","",$searchq); $query = mysql_query("SELECT * FROM authors WHERE fname LIKE '%$searchq%' OR lname LIKE '%$searchq%'") or die("could not search"); $count = mysql_num_rows($query); if($count == 0){ $output = 'there was no search result!'; }else{ while($row = mysql_fetch_array($query)){ $firstname = $row['fname']; $lastname = $row['lname']; $output .= '<div> '.$firstname.' '.$lastname.' </div>'; } } } echo($output); ?> at present the results are displayed normally on the page. plz help
  13. hi guys just started php and i hope i meet some super geek here.
×
×
  • 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.