I wrote this code, but it was pointed out by people here at stackoverflow that these functions will deprecate. So I'm updating it with mysqli functions. The new one won't return the image url i want to show though.
Here's the old working code :
<html>
<head>
<title>My first PHP script</title>
</head>
<body>
<?php
$dbhost = 'access.website';
$dbname = 'my_db';
$dbuser = 'usr_nam';
$dbpass = 'passwrd';
$mysql_handle = mysql_connect($dbhost, $dbuser, $dbpass)
or die("Error Connecting To Database Server");
mysql_select_db($dbname, $mysql_handle)
or die("Error selecting database: $dbname");
$query = sprintf("SELECT image_url, Type FROM Pokemon
c WHERE c.name='%s'",
mysql_real_escape_string($_GET["fname"]));
$result = mysql_fetch_assoc(mysql_query($query));
echo '<img height="450" width="330" src="'.$result['image_url'].'" />';
mysql_close($mysql_handle);
?>
</body>
</html>
And here is my new code:
<html>
<head>
<title>My first PHP script</title>
</head>
<body>
<?php
$dbhost = 'access.website';
$dbname = 'my_db';
$dbuser = 'usr_nam';
$dbpass = 'passwrd';
$link = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
mysqli_select_db($link,$dbname);
$query = sprintf("SELECT image_url, Type FROM Pokemon
c WHERE c.name='%s'",
mysqli_real_escape_string($link,$_GET["fname"]));
$result = mysqli_query($link,$query);
echo '<img height="450" width="330" src="'.$result['image_url'].'" />';
mysqli_close($link);
?>
</body>
</html>