mysql - How can I execute SQL and get results from PHP? -
mysql - How can I execute SQL and get results from PHP? -
i have code
$tnid = mysql_query("select trainingid training order trainingid desc limit 1");
the query above homecoming lastly row training table. if echo $tnid show 'resource id #5'. , if add
$d = mysql_fetch_array($tnid);
then echo $d, show error message
array string conversion in u:\xampp\htdocs\pds\action\doinsertschedule.php on line 32
how show exact result query? please help.
<?php $con=mysqli_connect("example.com","peter","abc123","my_db"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $result = mysqli_query($con,"select trainingid training order trainingid desc limit 1"); while($row = mysqli_fetch_array($result)) { echo " training id - " . $row['trainingid '] .; echo "<br>"; } mysqli_close($con); ?>
php mysql
Comments
Post a Comment