Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question$sql1="SELECT id FROM table ORDER BY id D开发者_StackOverflowESC LIMIT 1";
echo '1234/' . $sql1 . "<br />";
Well the output is 1234/SELECT id FROM table ORDER BY id DESC LIMIT 1
but i want the output to be
1234/respective value
If possible give some explanation also
I am new to PHP ..
Thanks in advance
You have not actually done a query, only defined the SQL query you intend to run as a string variable.  You need to establish a database connection, perform the query, and retrieve the result before your respective value will be what you want.
Start reading the PHP MySQL manual here.
// Connect to your database
$conn = mysql_connect($host, $username, $password);
mysql_select_db("database_name");
// Perform the query
$sql1="SELECT id FROM table ORDER BY id DESC LIMIT 1";
$result = mysql_query($sql);
// Fetch the results - only one row in your case
$row = mysql_fetch_array($result);
// Use the $row result set to output your string.
echo '1234/' . $row['id'] . "<br />";
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论