I am trying to join two database tables, the tables are set up like this,

This is table fgusers3, which stores my users login information.

id_user  name    email     phone_number    username     password    confirmcode
   1    Bob     bob@email    000000          bob1         bobby            12345

This is table videos, which stores my users video upload information.

videoname   email       filename
Funny      bob@email    funny.mp4

Now this is the code which joins them together and is suppose to display the results on the page but I keep getting an error about the bool law.

<?php
session_start();
$email=$_SESSION['email_of_user'];
  $con = mysql_connect("localhost","root","root");
  if (!$con) {
  die('Could not connect: ' . mysql_error());
  }

  mysql_select_db("radhalfs", $con);
  $result = mysql_query("

SELECT videos.videoname
FROM videos,
fgusers3
WHERE videos.email='$email' AND fgusers3.email='$email'

  ");
  echo "<table border='1'>
  <tr>
  <th>Name</th>
  <th>Message</th>
  </tr>";
  while ($row = mysql_fetch_array($result)) {
  echo "<tr>";
  echo "<td>" . $row['videoname'] . "</td>";
  echo "</tr>";
  }
  echo "</table>";

  mysql_close($con);
?>
Member Avatar for LastMitch

@garyjohnson

bool law.

You mean Boolean?

Boolean valves are True or False.

I don't see any code regarding about True or False?

Here is an example what I am talking about:

These are the valves:

$true = 1;
$false = 0;

$true  = true;
$false = false;

This is the equation:

$true = 1;

if (!$true) {
print("that's true");
}
else {
print("that's not true");
}

The answer will print out "that's true"

Here is another equation:

$false = 0;

if ($false == 1) {
print("that's false");
}
else {
print("that's not false");
}

The answer will print out "that's not false"

Do you get it now?

Yes I get it now lol, I have fixed my code and it works properly. But I am curious if you know how to get the code on line 25 to be a hyperlink? I want the variable $row['videoname'] to be a link.

Member Avatar for LastMitch

@garyjohnson

I want the variable $row['videoname'] to be a link.

Your old code:

echo "<td>" . $row['videoname'] . "</td>";

Now your new code:

echo "<td><a href='" ."Your Link". $row['videoname'] . "'>File Name</a></td>";

Or another option:

echo "<td><a href='Your Link'>File Name</a></td>";  
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.