FUNCION PHP CONSULTA BASE DATOS
Esta funcion realiza una con consulta a la base de datos y devuelve un variable global que contiene un array con el cual luego mediante un bucle imprimimos su contenido
include_once('conexion.php');
function getregisters($id){
global $result;
$result = mysql_query("SELECT * FROM qa_database");
}
getregisters($id)
while($row=mysql_fetch_array($result)) {
echo $row["project"] }
*****ACTUALIZACION*******
function getpost($id){
$result = mysql_query("SELECT * FROM qa_database WHERE id = '$id'");
global $datos2;
while($row=mysql_fetch_array($result)) {
$datos2[] = array(
'post_id' => $row['post_id'],
'ad_format' => $row['ad_format'],
'project' => $row['project'],
'script' => $row['script'],
'script2' => $row['script2'],
'height1' => $row['height1'],
'height2' => $row['height2'],
'width1' => $row['width1'],
'width2' => $row['width2'],
'vertical' => $row['vertical'],
'horizontal' => $row['horizontal'],
'post_date' => $row['post_date']);
}
}
//IMPRIMIMOS ASI
getpost($_GET['id']);
foreach($datos2 as $data2){$ad_format["ad_format"]; }
.
include_once('conexion.php');
function getregisters($id){
global $result;
$result = mysql_query("SELECT * FROM qa_database");
}
getregisters($id)
while($row=mysql_fetch_array($result)) {
echo $row["project"] }
*****ACTUALIZACION*******
function getpost($id){
$result = mysql_query("SELECT * FROM qa_database WHERE id = '$id'");
global $datos2;
while($row=mysql_fetch_array($result)) {
$datos2[] = array(
'post_id' => $row['post_id'],
'ad_format' => $row['ad_format'],
'project' => $row['project'],
'script' => $row['script'],
'script2' => $row['script2'],
'height1' => $row['height1'],
'height2' => $row['height2'],
'width1' => $row['width1'],
'width2' => $row['width2'],
'vertical' => $row['vertical'],
'horizontal' => $row['horizontal'],
'post_date' => $row['post_date']);
}
}
//IMPRIMIMOS ASI
getpost($_GET['id']);
foreach($datos2 as $data2){$ad_format["ad_format"]; }
.
Comentarios
Publicar un comentario