Jump to content

Recommended Posts

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

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

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

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!

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.