bvondane
02-07-2007, 10:36 PM
I am trying to write a query, am making myself nuts and could use some help...
What I want is a PHP file that; based on the userid of the person logged in, will retrieve the the content of "field7" in the table "userfield" and assign it to a variable so I can pass it to a url in an iframe...
Make sense? I hope so because my brain is fried!
Here's what I have so far:
<?php
require_once('./global.php');
$host = localhost;
$user = *****;
$dbp = *****;
$db = *****;
mysql_connect("$host", "$user", "$dbp");
mysql_select_db ("$db");
// $icao = mysql_query("
// SELECT field7
// FROM userfield
// WHERE userid = $vbulletin->userinfo['userid']
// ");
$icao = kcos; // <-- if I hard code it, it works
echo $icao;
?>
<iframe width="100%" src="http://www.weathermeister.com/html/metar?idents=<? echo $icao; ?>"/>
If I hard code the $icao the file works (however the output of the file needs to be tweaked - it works in IE): http://www.wheelsup.org/testquery.php ...but I need it to be dynamic based on who is logged in...
Thanks in advance!
-Bill
Ok... I am making progress here... This seems to be working:
<?php
require_once('./global.php');
// Make a MySQL Connection
mysql_connect("localhost", "*****", "*****") or die(mysql_error());
mysql_select_db("*****") or die(mysql_error());
// Retrieve all the data from the "example" table
$query = "SELECT userid, field7 FROM userfield WHERE userid = 2";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
$icao = $row['field7'];
// echo $icao;
?>
<iframe width="100%" src="http://www.weathermeister.com/html/metar?idents=<? echo $icao; ?>" marginwidth="0" marginheight="0" border="0" frameborder="0"/>
However, I still need a way to replace "WHERE userid = 2" in the query to something that will automatically input the current logged in user's userid...
Also, the iframe only seems to display correctly in IE, FireFox and Opera both display HTML instead of the content...
Any ideas!??
What I want is a PHP file that; based on the userid of the person logged in, will retrieve the the content of "field7" in the table "userfield" and assign it to a variable so I can pass it to a url in an iframe...
Make sense? I hope so because my brain is fried!
Here's what I have so far:
<?php
require_once('./global.php');
$host = localhost;
$user = *****;
$dbp = *****;
$db = *****;
mysql_connect("$host", "$user", "$dbp");
mysql_select_db ("$db");
// $icao = mysql_query("
// SELECT field7
// FROM userfield
// WHERE userid = $vbulletin->userinfo['userid']
// ");
$icao = kcos; // <-- if I hard code it, it works
echo $icao;
?>
<iframe width="100%" src="http://www.weathermeister.com/html/metar?idents=<? echo $icao; ?>"/>
If I hard code the $icao the file works (however the output of the file needs to be tweaked - it works in IE): http://www.wheelsup.org/testquery.php ...but I need it to be dynamic based on who is logged in...
Thanks in advance!
-Bill
Ok... I am making progress here... This seems to be working:
<?php
require_once('./global.php');
// Make a MySQL Connection
mysql_connect("localhost", "*****", "*****") or die(mysql_error());
mysql_select_db("*****") or die(mysql_error());
// Retrieve all the data from the "example" table
$query = "SELECT userid, field7 FROM userfield WHERE userid = 2";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
$icao = $row['field7'];
// echo $icao;
?>
<iframe width="100%" src="http://www.weathermeister.com/html/metar?idents=<? echo $icao; ?>" marginwidth="0" marginheight="0" border="0" frameborder="0"/>
However, I still need a way to replace "WHERE userid = 2" in the query to something that will automatically input the current logged in user's userid...
Also, the iframe only seems to display correctly in IE, FireFox and Opera both display HTML instead of the content...
Any ideas!??