943,740 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1768
  • PHP RSS
Oct 4th, 2008
0

Passing variable sql php

Expand Post »
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

PHP Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
Mylena is offline Offline
30 posts
since Jul 2007
Oct 6th, 2008
0

Re: Passing variable sql php

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:
PHP Syntax (Toggle Plain Text)
  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 C; Oct 6th, 2008 at 4:08 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Please help me with sorting column heading
Next Thread in PHP Forum Timeline: Image upload into directory storing path in database





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC