PDA

View Full Version : No data output - HEEEEEEELP!


LostInPHP
01-05-2009, 04:33 PM
I have made the PHP search & result pages in CS4, but it's not showing ANY output. It connects the DB (it's populated) normally... Besides that, while testing in the "Recordset" everything works just fine...:(

edbr
01-05-2009, 11:58 PM
need some more info. when yo test are you entering a value ,if so how are you selecting the record set on your page? etc code usually helps :)

LostInPHP
01-06-2009, 01:40 AM
I am doing everything through the Recordset "visually" and while testing in the Recordset - it works great! But browser-testing fails. It keeps showing only table headers and nothing else...
That's what my (DW's generated) result page code looks like:


<?php require_once('Connections/Databas.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$maxRows_srResult = 10;
$pageNum_srResult = 0;
if (isset($_GET['pageNum_srResult'])) {
$pageNum_srResult = $_GET['pageNum_srResult'];
}
$startRow_srResult = $pageNum_srResult * $maxRows_srResult;

$varDelatnost_srResult = "%";
if (isset($_GET["Delatnost"])) {
$varDelatnost_srResult = $_GET["Delatnost"];
}
$varMesto_srResult = "%";
if (isset($_GET["Mesto"])) {
$varMesto_srResult = $_GET["Mesto"];
}
mysql_select_db($database_Databas, $Databas);
$query_srResult = sprintf("SELECT * FROM `firme` WHERE `Delatnost` LIKE %s AND `Mesto` LIKE %s ORDER BY ****v ASC", GetSQLValueString("%" . $varDelatnost_srResult . "%", "text"),GetSQLValueString("%" . $varMesto_srResult . "%", "text"));
$query_limit_srResult = sprintf("%s LIMIT %d, %d", $query_srResult, $startRow_srResult, $maxRows_srResult);
$srResult = mysql_query($query_limit_srResult, $Databas) or die(mysql_error());
$row_srResult = mysql_fetch_assoc($srResult);

if (isset($_GET['totalRows_srResult'])) {
$totalRows_srResult = $_GET['totalRows_srResult'];
} else {
$all_srResult = mysql_query($query_srResult);
$totalRows_srResult = mysql_num_rows($all_srResult);
}
$totalPages_srResult = ceil($totalRows_srResult/$maxRows_srResult)-1;
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000;
}
a {
font-family: Arial, Helvetica, sans-serif;
}
-->
</style></head>

<body text="#000000">

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>
<td height="30" valign="middle" bgcolor="#FFFF00" fontsize="10" face="Arial"><p><?php echo $row_Recordset1['****v']; ?></p></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['Delatnost']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['Adresa']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['Mesto']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['Tel:']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['Fax:']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['Mob:']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['E-mail:']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<?php do { ?>

<td height="30" bgcolor="#FFFF00"><?php echo $row_Recordset1['Web:']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($srResult);
?>

edbr
01-06-2009, 02:23 AM
you are selecting by $_GET['Delatnost'] and $_GET['Mesto'] as url so are these values being passed?

ie yourpage.php?Delatnost= & Mesto'=

you can test by adding to your page
<?php
echo $_GET["Mesto"];
echo $_GET['Delatnost'];
?>
this will print the values passed.

LostInPHP
01-06-2009, 04:39 AM
Yes, it is showing in the address bar Result.php?Delatnost= &Mesto= etc.
It also prints values for Delatnost & Mesto (it's Serbian lang.)
But still not printing the DB table's output...
THX a lot, any way!

edbr
01-06-2009, 04:49 AM
ORDER BY ****v ASC is that you editing or ..?

LostInPHP
01-06-2009, 04:57 AM
No. That's funny! It did it by itself, for some reason...:-D
It is supposed to say "****v" which means a name, such as company, business name. The editor probably recognized just "****" without "v"!:-D

edbr
01-06-2009, 04:58 AM
ah hold the phone a mi9n your select is bringing $row_srResult = mysql_fetch_assoc($srResult);
but you are echoing $row_Recordset1['Delatnost'] i cant see a recordset named $row_Recordset1

LostInPHP
01-06-2009, 05:01 AM
That's right! Just a minute ago it pulled my attention too!

LostInPHP
01-06-2009, 05:13 AM
It works, my friend! Only remaining thing I have to fix is lang. code... using latin-2 and, for some reason, itis not showing some letters properly.
THX A LOT!!!

LostInPHP2
03-01-2009, 04:06 PM
Having the same problem again!:(((( But this time is nothing from above.