I've spent ages trying to figure this out but no joy, please help...
my test code reads
$mysqli = mysqli_connect("localhost","user","password","database");
$sql = "SELECT url FROM useful_urls WHERE urlName = 'redirect'";
if($res = mysqli_query($mysqli,$sql)){
while ($query_result = mysqli_fetch_field($res)) {
printf ("URL: %s\n", $query_result->url); //line 21
}
mysqli_free_result($res);
}
I get the following error message (and the url in question is not printed to the browser)
[Fri Mar 11 01:28:30 2011] [error] [client 127.0.0.1] PHP Notice: Undefined property: stdClass::$url in /var/www/delete.php on line 21, referer: http://localhost/index.php
If I change the code to use mysqli_fetch_array - it works perfectly!!
i.e. while ($query_result = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
printf ("URL: %s\n", $query_result['url']);
thanks.