0

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);
?>
2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by garyjohnson
0

@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?

Edited by LastMitch: g

0

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.

0

@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>";  
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.