RyanSF07 Posted June 19, 2007 Share Posted June 19, 2007 Hi all, I'm testing this <a href \"http://$row[user_url]\">$row[user_name]</a> and it's coming back as a link to the url of the present webpage rather than pulling the "users website url" from the data base. The sql select statement says to pull * from the database. Thus, the row user_url should be coming up. Any ideas? Thanks, Ryan Link to comment https://forums.phpfreaks.com/topic/56261-solved-need-a-second-pair-of-eyes/ Share on other sites More sharing options...
chocopi Posted June 19, 2007 Share Posted June 19, 2007 you would need $row['user_url'] and $row['user_name']; you need to remember the ' ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/56261-solved-need-a-second-pair-of-eyes/#findComment-277874 Share on other sites More sharing options...
MikeDXUNL Posted June 19, 2007 Share Posted June 19, 2007 i would do something like $query = "SELECT * FROM database"; $result = mysql_query($query); while ($line = mysql_fetch_array($result)) { echo "<a href=\"http://".$line['user_url']."\">".$line['user_name']."</a>"; } ;-) try that but change the database name Link to comment https://forums.phpfreaks.com/topic/56261-solved-need-a-second-pair-of-eyes/#findComment-277876 Share on other sites More sharing options...
RyanSF07 Posted June 19, 2007 Author Share Posted June 19, 2007 Thanks Guys, I tried adding the single quotes, but that produces a parse error. The username and other info all displays as it should. All I'm trying to do is pull the "user_url" too ... Here is my select statment. looks similar to the one suggested: $sql = "SELECT * FROM video, registered_users WHERE video.id = '$_GET[id]' AND video.user_id = registered_users.id"; //Register session key with the value $_SESSION[get] = $_GET[id]; $query_result = mysql_query($sql); $row = mysql_fetch_array($query_result); thanks for your help! ryan Link to comment https://forums.phpfreaks.com/topic/56261-solved-need-a-second-pair-of-eyes/#findComment-277883 Share on other sites More sharing options...
lewis987 Posted June 19, 2007 Share Posted June 19, 2007 try this: /********************/ /* MODIFY TO YOUR OWN VALUES */ /********************/ $mshost=""; // mysql host $mspass=""; // mysql super user password $msuser=""; //mysql super user $tbl_name=""; //Table name $part1=""; //column Name $part2=""; // What your wanting to select from the database $dbname=""; // Database name mysql_connect($mshost,$msuser,$mspass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $sql1=sprintf("SELECT * FROM $tbl_name WHERE $part1='$part2'"); $result1=mysql_query($sql1); $row=mysql_fetch_array($result1); echo "<a href \"http://www.yoursite.com/".$row[user_url]."\">".$row[user_name]."</a>"; ?> CODE NOT TESTED! Link to comment https://forums.phpfreaks.com/topic/56261-solved-need-a-second-pair-of-eyes/#findComment-277885 Share on other sites More sharing options...
RyanSF07 Posted June 19, 2007 Author Share Posted June 19, 2007 Thanks MikeDXUNL, I played around with the code you posted and got it to work just fine. Thanks for your help Ryan Link to comment https://forums.phpfreaks.com/topic/56261-solved-need-a-second-pair-of-eyes/#findComment-277894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.