I really, really need help with the following code. I just can't figure out why it's not working.
There is a MySQL Table that I need to query and I simply need to return one row for a specific ID. However mysql_fetch_array only returns the first column from that table - and I'm dying from frustration...
$sqlCommand = "SELECT * FROM sqlInformationen WHERE ID = 2";
$sqlConn = mysql_connect($config['mysql_host'],$config['mysql_user'],$config['mysql_pass']);
mysql_select_db($config['db_name']) or die ("Fehler bei der Verbindungsaufnahme.");
$result = mysql_query($sqlCommand);
$row = mysql_fetch_array($result);
echo $row['infTitel'];
The database contains fields "ID", "infTitel", "infZusammenfassung", etc. However only echo $row['ID'] returns a value.
Would greatly appreciate help.
Thanks.
print_r($row);?mysql_*functions for new code. They are no longer maintained and the community has begun the deprecation process. See the red box? Instead you should learn about prepared statements and use either PDO or MySQLi. If you can't decide, try this article. If you care to learn, here is good PDO tutorial.var_dump($row)instead (right beforeecho $row['infTitel']line).