0

help me please guys

I've searched and tried all the articles here

but still can not get results from INFORMATION_SCHEMA

I want to get a relationship between tables using KEY_COLUMN_USAGE but still not showing anything, just displaying a blank page

I do not understand what went wrong:

I've used the code I used to use, as below

$server = "localhost";
$user= "root";
$pass= "";
$db= "my_DB";
$conn = mysql_connect($server, $user, $pass) or die ("can't connect server" .mysql_error());
$openconn= mysql_select_db($db) or die ("can't open DB " .mysql_error());

$sql="using_select_command_here";
$query = mysql_query($sql) or die ("error:" .mysql_error());
while ($data = mysql_fetch_array($query)) { 

print_r($data);

}

from all sources are here like : How to find tables all relation in MySQL How to know relations between tables

the result still showing blank page: I do not understand if there are other factors? I am using php version 5.3.1 and mysql version 5.1.41 from xampp for windows ver1.7.3

Denis
  • 73
  • 13
  • You should be selecting the `information_schema` database, not `test`. – Barmar Dec 25 '17 at 08:01
  • 2
    Check for errors from `mysql_query()` just like you do from `mysql_connect`. – Barmar Dec 25 '17 at 08:02
  • Why are you using such horribly outdated versions of PHP and MySQL? – Nico Haase Dec 25 '17 at 08:14
  • @Barmar : okay, I've edited, but still blank no messages ^_^ – Denis Dec 25 '17 at 08:19
  • Then the query is probably not returning anything. What does `echo mysqli_num_rows($query);` show? Post your query. – Barmar Dec 25 '17 at 08:20
  • @NicoHaase :I've used the latest version, but many have problems because I use the old code for all ^_^ – Denis Dec 25 '17 at 08:21
  • @Barmar : using like this $check= mysql_num_rows($query); echo $check; i've added that but no message too – Denis Dec 25 '17 at 08:35
  • Did it echo more than 0? – Barmar Dec 25 '17 at 08:36
  • If you're not getting any output from that, there's probably a syntax error in the script. Check your PHP error log. – Barmar Dec 25 '17 at 08:37
  • @Barmar : i don't understand how to check PHP error log, if you have a better ways how to show that, example from MYSQLI, help me to show an example please, I think there is a problem with the old code that I used, hmm... I really feel newbe here, thanks before barmar I hope you're not upset to me – Denis Dec 25 '17 at 08:51
  • The answer you have linked to with the source you are copying has an issue with the query which might be sending you in the wrong direction and getting you 0 results. Where the offered solution says WHERE CONSTRAINT_SCHEMA = your_table_name, it should read WHERE CONSTRAINT_SCHEMA = your_schema_name. Better to look at the solutions in this question https://stackoverflow.com/questions/20855065/how-to-find-all-the-relations-between-all-mysql-tables which give the correct answer. – Paul Campbell Dec 27 '17 at 14:17

0 Answers0