Name: PHP/Fail 2008-07-19 12:58
Could somebody please help me, I'm learning PHP at the moment and there seems to be a slight failure with MySQL:
<?php
(some code has been skipped, such as passwords and db names)
$csn = mysqli_connect($host,$user,$password,$dbname)
or die("Could not connect to sever.");
/* This query finds the limits of the post list */
$query = "SELECT MIN(postID) FROM first_post";
$result = mysqli_query($csn,$query)
or die("Couldn't retrieve post limit.");
$postmin = mysqli_fetch_assoc($result);
/* Continueing */
$query = "SELECT MAX(postID) FROM first_post";
$result = mysqli_query($csn,$query)
or die("Couldn't retrieve post limit.");
$postmax = mysqli_fetch_assoc($result);
mysqli_close($csn);
echo "Max: ";
echo $postmax['postID'];
echo "Min:";
echo $postmin['postID'];
echo "\n";
?>
The output for this is Max: Min: and not showing the arrays :-\
HALP?
<?php
(some code has been skipped, such as passwords and db names)
$csn = mysqli_connect($host,$user,$password,$dbname)
or die("Could not connect to sever.");
/* This query finds the limits of the post list */
$query = "SELECT MIN(postID) FROM first_post";
$result = mysqli_query($csn,$query)
or die("Couldn't retrieve post limit.");
$postmin = mysqli_fetch_assoc($result);
/* Continueing */
$query = "SELECT MAX(postID) FROM first_post";
$result = mysqli_query($csn,$query)
or die("Couldn't retrieve post limit.");
$postmax = mysqli_fetch_assoc($result);
mysqli_close($csn);
echo "Max: ";
echo $postmax['postID'];
echo "Min:";
echo $postmin['postID'];
echo "\n";
?>
The output for this is Max: Min: and not showing the arrays :-\
HALP?