I'm relatively new at PHP, and am trying to pull data from a mysql database. It should be noted before I ask this that I've got an Insert query working, so I know I'm logged into the database properly.
What I'm trying to do is pull an ID from the database and display it on screen. Eventually I'll be incrementing the ID and including it in my Insert statement, but for now I just want to know I'm getting the right number.
The code executes clean through, but the echo statement does not return anything. I've run the query in mysql workbench and it returns the value of 4. Anything jump out as incorrect?
What I'm trying to do is pull an ID from the database and display it on screen. Eventually I'll be incrementing the ID and including it in my Insert statement, but for now I just want to know I'm getting the right number.
Code:
$query="Select Max(OrderID) from database.orders"; $q=mysql_query($query) or die ('Error reading database' . mysql_error()); $qRow = mysql_fetch_array($q); $qvar = $qRow["OrderID"]; echo "$qvar";
Comment