I want to run the sql command DESC from within a php script. I'm new to this, and am not sure that this is possible. My attempt below runs with no errors, but gives no output. Can someone help me out with this? Any help is gratefully appreciated!
PV
<?php
// Thursday, August 14, 2008 6:43:54 PM
// Connect to port 4444 on vanderhaden.net.
$link = mysql_connect('vanderhaden.net:4444', 'peterv', 'testpw','testdb');
if (!$link) {
printf("Connect failed: %s\n", mysql_error());
exit();
} else {
// select the database
$db_selected = mysql_select_db('testdb', $link);
if (!$db_selected) {
die ('Can\'t use testdb: ' . mysql_error());
}
$query ="DESC leadsTable";
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
}
?>
PETERV
Syracuse, NY &
Boston, MA
PV
<?php
// Thursday, August 14, 2008 6:43:54 PM
// Connect to port 4444 on vanderhaden.net.
$link = mysql_connect('vanderhaden.net:4444', 'peterv', 'testpw','testdb');
if (!$link) {
printf("Connect failed: %s\n", mysql_error());
exit();
} else {
// select the database
$db_selected = mysql_select_db('testdb', $link);
if (!$db_selected) {
die ('Can\'t use testdb: ' . mysql_error());
}
$query ="DESC leadsTable";
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
}
?>
PETERV
Syracuse, NY &
Boston, MA