Dear Friends,
I don't know I am not able to run this query. I am able to insert records but I don't know why I am not able to select and display the records....Plea se help me.......
[PHP]<?php
$hostname="mysq l3.secureserver .net";
$username="mydb ";
$password="mypa ssword";
$dbname="mydb";
mysql_connect($ hostname,$usern ame, $password) OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db ($dbname);
$numfiles = $_POST['numfiles'];
$queryIns = ("INSERT INTO numfile(numfile ) values('$numfil es')");
if(!@mysql_quer y ($queryIns)) {
echo mysql_error();
}
else{
$querySel = "SELECT * from numfile where id = (SELECT MAX(id) from numfile)"; // I am facing problem in this query
$result = mysql_query($qu erySel);
if($result)
{
while($row = mysql_fetch_arr ay($result)){
echo "maximum id is : ".$row['numfile'];
}
}
else
{
echo "no records selected";
}
}
?>[/PHP]
Thanks
Deepak
I don't know I am not able to run this query. I am able to insert records but I don't know why I am not able to select and display the records....Plea se help me.......
[PHP]<?php
$hostname="mysq l3.secureserver .net";
$username="mydb ";
$password="mypa ssword";
$dbname="mydb";
mysql_connect($ hostname,$usern ame, $password) OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db ($dbname);
$numfiles = $_POST['numfiles'];
$queryIns = ("INSERT INTO numfile(numfile ) values('$numfil es')");
if(!@mysql_quer y ($queryIns)) {
echo mysql_error();
}
else{
$querySel = "SELECT * from numfile where id = (SELECT MAX(id) from numfile)"; // I am facing problem in this query
$result = mysql_query($qu erySel);
if($result)
{
while($row = mysql_fetch_arr ay($result)){
echo "maximum id is : ".$row['numfile'];
}
}
else
{
echo "no records selected";
}
}
?>[/PHP]
Thanks
Deepak
Comment