Passing variable sql php

Reply

Join Date: Jul 2007
Posts: 30
Reputation: Mylena is an unknown quantity at this point 
Solved Threads: 1
Mylena Mylena is offline Offline
Light Poster

Passing variable sql php

 
0
  #1
Oct 4th, 2008
Hi,

I have a web site in which I pass many javascript variables to php and the other way round. This is my last passing variable challenge, and I cannot figure it out.

There's an alphabet letter that i pass into showhide1(v) function, and i try to pass it to IN(). For example IN ('b') will retrieve all items beginning with letter b.

The way I did it below does not work for some reason. Does anyone know how to do it?

Thanks

  1. function showhide1(v)
  2. {
  3.  
  4. <?php
  5. $result = mysql_query("SELECT * FROM birdstable
  6. WHERE left(Name, 1) IN ($_GET[v])
  7. ORDER BY Name;");
  8.  
  9. while($row = mysql_fetch_assoc($result)){
  10. $varr= $row['BirdID'];
  11. ?>
  12. document.getElementById("Layer1").innerHTML = "hello";
  13.  
  14. <?php
  15.  
  16. }
  17. ?>
  18.  
  19.  
  20. }
Last edited by Mylena; Oct 4th, 2008 at 2:53 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Passing variable sql php

 
0
  #2
Oct 6th, 2008
i think you can't get the java script function values by this way: $_GET[v].
if you want to send javascript values to php try this way:
  1. function showhide1(x)
  2. {
  3. d.action="yourpage.php?v="+x;
  4. d.submit();
  5. }
And the you can get the function value by $_GET['v'];
then pass it to N() ...
Last edited by Shanti Chepuru; Oct 6th, 2008 at 4:08 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC