 |
Publicité
|
PHP + MySQL 3.23.36
<HTML>
<BODY>
<?PHP
$dbconn = mysql_connect ("192.168.0.1", "root", "");
$template="idtest : <!--IDTEST--> - testchar : <!--TESTCHAR--> - testdate : <!--TESTDATE--> - ";
$template=$template . " testnum : <!--TESTNUM--> - testbool : <!--TESTBOOL--> - testvarchar : <!--TESTVARCHAR--><br>";
$Affiche="";
$cpt=0;
$sql="SELECT * FROM test ORDER BY idtest LIMIT 3000, 20";
$sqlok=mysql_db_query ("testapache", $sql, $dbconn) ;
if ($sqlok) {
while ($result=mysql_fetch_array ($sqlok, MYSQL_ASSOC)) {
$cpt++;
$templatetmp =$template;
foreach ($result as $key => $value) {
$templatetmp = eregi_replace("<!--".$key."-->",$value,$templatetmp);
}
$Affiche = $Affiche . "<li>Enregistrement " . $cpt . " : <br>" . $templatetmp;
}
}
echo $Affiche;
mysql_close ($dbconn);
?>
</BODY>
</HTML>
PHP + connexions persistantes + MySQL 3.23.36
<HTML>
<BODY>
<?PHP
$dbconn = mysql_pconnect ("192.168.0.1", "root", "");
$template="idtest : <!--IDTEST--> - testchar : <!--TESTCHAR--> - testdate : <!--TESTDATE--> - ";
$template=$template . " testnum : <!--TESTNUM--> - testbool : <!--TESTBOOL--> - testvarchar : <!--TESTVARCHAR--><br>";
$Affiche="";
$cpt=0;
$sql="SELECT * FROM test ORDER BY idtest LIMIT 3000, 20";
$sqlok=mysql_db_query ("testapache", $sql, $dbconn) ;
if ($sqlok) {
while ($result=mysql_fetch_array ($sqlok, MYSQL_ASSOC)) {
$cpt++;
$templatetmp =$template;
foreach ($result as $key => $value) {
$templatetmp = eregi_replace("<!--".$key."-->",$value,$templatetmp);
}
$Affiche = $Affiche . "<li>Enregistrement " . $cpt . " : <br>" . $templatetmp;
}
}
echo $Affiche;
mysql_close ($dbconn);
?>
</BODY>
</HTML>
PHP + PostgreSQL 7.03
<HTML>
<BODY>
<?PHP
$dbconn = pg_Connect ("host=192.168.0.1 port=5432 dbname=testapache user=postgres password=");
$template="idtest : <!--IDTEST--> - testchar : <!--TESTCHAR--> - testdate : <!--TESTDATE--> - ";
$template=$template . " testnum : <!--TESTNUM--> - testbool : <!--TESTBOOL--> - testvarchar : <!--TESTVARCHAR--><br>";
$Affiche="";
$cpt=0;
$sql="SELECT * FROM test order by idtest LIMIT 20, 3000";
$dbpg_num_row=0;
$sqlok=pg_exec ($dbconn, $sql);
if ($sqlok) {
while (pg_numrows($sqlok)>$dbpg_num_row) {
$result=pg_fetch_array ($sqlok, $dbpg_num_row, PGSQL_ASSOC);
$cpt++;
$templatetmp =$template;
foreach ($result as $key => $value) {
$templatetmp = eregi_replace("<!--" . strtoupper($key) . "-->",$value,$templatetmp);
}
$Affiche = $Affiche . "<li>Enregistrement " . $cpt . " : <br>" . $templatetmp;
$dbpg_num_row++;
}
}
echo $Affiche;
pg_close ($dbconn);
?>
</BODY>
</HTML>
PHP + connexions persistantes + PostgreSQL 7.03
<HTML>
<BODY>
<?PHP
$dbconn = pg_pConnect ("host=192.168.0.1 port=5432 dbname=testapache user=postgres password=");
$template="idtest : <!--IDTEST--> - testchar : <!--TESTCHAR--> - testdate : <!--TESTDATE--> - ";
$template=$template . " testnum : <!--TESTNUM--> - testbool : <!--TESTBOOL--> - testvarchar : <!--TESTVARCHAR--><br>";
$Affiche="";
$cpt=0;
$sql="SELECT * FROM test order by idtest LIMIT 20, 3000";
$dbpg_num_row=0;
$sqlok=pg_exec ($dbconn, $sql);
if ($sqlok) {
while (pg_numrows($sqlok)>$dbpg_num_row) {
$result=pg_fetch_array ($sqlok, $dbpg_num_row, PGSQL_ASSOC);
$cpt++;
$templatetmp =$template;
foreach ($result as $key => $value) {
$templatetmp = eregi_replace("<!--" . strtoupper($key) . "-->",$value,$templatetmp);
}
$Affiche = $Affiche . "<li>Enregistrement " . $cpt . " : <br>" . $templatetmp;
$dbpg_num_row++;
}
}
echo $Affiche;
pg_close ($dbconn);
?>
</BODY>
</HTML>
ASP + SQL Serveur 2000
<HTML>
<BODY>
<%
set MyCon = Server.CreateObject("ADODB.Connection")
MyCon.ConnectionTimeout = 1200
MyCon.ConnectionString = "DRIVER={SQL Server};DATABASE=testiis;SERVER=192.168.0.111;UID=root;PWD=root;"
MyCon.Open
template="idtest : <!--IDTEST--> - testchar : <!--TESTCHAR--> - testdate : <!--TESTDATE--> - "
template=template & " testnum : <!--TESTNUM--> - testbool : <!--TESTBOOL--> - testvarchar : <!--TESTVARCHAR--><br>"
Affiche=""
cpt=0
sql="select * from (select top 20 * from (select top 3020 * from test order by idtest) as t1 order by idtest DESC) as t2 order by idtest"
Set rs = MyCon.Execute(sql)
while not rs.eof
cpt = cpt + 1
templatetmp = template
for i=0 to rs.fields.count-1
templatetmp = Replace(templatetmp,"<!--" & UCase(rs.fields(i).name) & "-->",rs.fields(i).value)
next
Affiche = Affiche & "<li>Enregistrement " & cpt & " : <br>" & templatetmp
rs.MoveNext
Wend
rs.close
Set rs=Nothing
MyCon.Close
Set MyCon=Nothing
response.write Affiche
%>
</BODY>
</HTML>
La requête se trouvant dans ce script permet de simuler la fonction LIMIT de MySQL ou de PostgreSQL.
ASP + MyODBC 2.50.30 + MySQL 3.23.36
<HTML>
<BODY>
<%
set MyCon = Server.CreateObject("ADODB.Connection")
MyCon.ConnectionTimeout = 1200
MyCon.ConnectionString = "DRIVER={MySQL};DATABASE=testapache;SERVER=192.168.0.1;UID=root;PWD=;"
MyCon.Open
template="idtest : <!--IDTEST--> - testchar : <!--TESTCHAR--> - testdate : <!--TESTDATE--> - "
template=template & " testnum : <!--TESTNUM--> - testbool : <!--TESTBOOL--> - testvarchar : <!--TESTVARCHAR--><br>"
Affiche=""
cpt=0
sql="SELECT * FROM test order by idtest LIMIT 3000, 20"
Set rs = MyCon.Execute(sql)
while not rs.eof
cpt = cpt + 1
templatetmp = template
for i=0 to rs.fields.count-1
templatetmp = Replace(templatetmp,"<!--" & UCase(rs.fields(i).name) & "-->",rs.fields(i).value)
next
Affiche = Affiche & "<li>Enregistrement " & cpt & " : <br>" & templatetmp
rs.MoveNext
Wend
rs.close
Set rs=Nothing
MyCon.Close
Set MyCon=Nothing
response.write Affiche
%>
</BODY>
</HTML>
ASP + PgODBC 7.01 + PostreSQL 7.03
<HTML>
<BODY>
<%
set MyCon = Server.CreateObject("ADODB.Connection")
MyCon.ConnectionTimeout = 1200
MyCon.ConnectionString = "DRIVER={PostgreSQL};DATABASE=testapache;SERVER=192.168.0.1;UID=postgres;PWD=;"
MyCon.Open
template="idtest : <!--IDTEST--> - testchar : <!--TESTCHAR--> - testdate : <!--TESTDATE--> - "
template=template & " testnum : <!--TESTNUM--> - testbool : <!--TESTBOOL--> - testvarchar : <!--TESTVARCHAR--><br>"
Affiche=""
cpt=0
sql="SELECT * FROM test order by idtest LIMIT 20, 3000"
Set rs = MyCon.Execute(sql)
while not rs.eof
cpt = cpt + 1
templatetmp = template
for i=0 to rs.fields.count-1
templatetmp = Replace(templatetmp,"<!--" & UCase(rs.fields(i).name) & "-->",rs.fields(i).value)
next
Affiche = Affiche & "<li>Enregistrement " & cpt & " : <br>" & templatetmp
rs.MoveNext
Wend
rs.close
Set rs=Nothing
MyCon.Close
Set MyCon=Nothing
response.write Affiche
%>
</BODY>
</HTML>
|