Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can not access mySql result in php

Tags:

php

select

mysql

I have this mySQL query:

Select MIN(A.product_id  + 1)
From   Tabel A Left Join Tabel B
On A.product_id = B.product_id - 1
Where  B.product_id Is NULL  

I run it on phpMyAdmin and this is the result:

phpMyAdmin screenshot

It returns the correct value (1803020005) but under the field 'MIN(a.product_id + 1)'.

How can I use it in php?

I use this but does not work:

$result = mysql_query ($select, $con);
$row = mysql_fetch_assoc($result);  

this is the result of $result = mysql_query ($select, $con); :

Resource id #6

and this is the result of $row = mysql_fetch_assoc($result); :

Array

like image 937
biji buji Avatar asked Feb 23 '26 13:02

biji buji


1 Answers

You want to SELECT MIN(a.product_id +1) AS min and then get it under $row['min'];

like image 105
Joe Majewski Avatar answered Feb 26 '26 02:02

Joe Majewski