process form & mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eeau1973
Forum Commoner
Posts: 27
Joined: Sat Aug 19, 2006 4:49 pm

process form & mysql

Post by eeau1973 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi, i`m having trouble with this stuff .. i need to retrieve data from a record that match the search field.

this is the "part" where the user look for information ...

[syntax="html"]<html>
<body>
<form action=search.php method=GET>
please fill search data:
<p>
Nombre: <input type=text name=name size=25 maxlength=25>
<p>
<input type=submit>
</form>
</body>
</html>
and this is the search.php ...[/syntax]

Code: Select all

<html>
<body>
<?php 
mysql_pconnect("localhost","myuser","mypassword"); 
mysql_select_db("mydatabase"); 
if ($name == "")
{$name = '%';}
$result = mysql_query ("SELECT * FROM mytablename WHERE nombre LIKE '$name%'");
if ($row = mysql_fetch_array($result)) 
{
	do {
		print $row["name"];
		print (" ");
		print ("<p>");
		print $row["fiel2"];
		print ("<p>");
		print $row["field3"];
		print ("<p>");
	   } while($row = mysql_fetch_array($result));
} 
else {print "No records where found !";}
?>
</body>
</html>
My problem is that this code is not working ... when the php "runs" just appear a blank web page :( ...

thanks in advance .
greetings.
:D


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Three of the four posts you've made have needed editing to add/fix highlighting. Please use the correct tags.


Run the following in a new file and tell us the results please.

Code: Select all

<?php

$neg = array('off', 0, false, '', null);
$flags = array(
	'Register Globals' => 'register_globals',
	'Short Tags' => 'short_open_tag',
	'Display Errors' => 'display_errors',
	'Magic Quotes GPC' => 'magic_quotes_gpc',
	'Magic Quotes Runtime' => 'magic_quotes_runtime',
	'Magic Quotes Sybase' => 'magic_quotes_sybase',
);
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
foreach ($flags as $n => $v)
{
	$flags[$n] = (in_array(strtolower(ini_get($v)), $neg) ? 'Off' : 'On');
}
$cli = (php_sapi_name() == 'cli');
$eol = "\n";

$gle = get_loaded_extensions();
$rows = array();
$le = '';
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
	$le .= '   ' . implode('   ', array_slice($gle, $i, $wide)) . $eol;
}

$ec = array(
	'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
	'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
	'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
	'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);

$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
	if (($t & $v) == $v)
	{
		$e[] = $n;
		$t ^= $v;
	}
}
if (ceil(count($ec) / 2) + 1 < count($e))
{
	$e2 = array();
	foreach ($ec as $n => $v)
	{
		if (!in_array($n, $e) and $n != 'E_ALL')
		{
			$e2[] = $n;
		}
	}
	$er = $er . ' ((E_ALL | E_STRICT) ^ ' . implode(' ^ ', $e2) . '))';
}
else
{
	$er = $er . ' (' . implode(' | ', $e) . ')';
}

if (!$cli)
{
	echo '<html><head><title>quick info</title></head><body><pre>', $eol;
}

echo 'PHP Version: ', $ve, $eol;
echo 'PHP OS: ', $os, $eol;
echo 'Error Reporting: ', $er, $eol;
foreach ($flags as $n => $v)
{
	echo $n, ': ', $v, $eol;
}
echo 'Loaded Extensions:', $eol, $le, $eol;

if (!$cli)
{
	echo '</pre></body></html>', $eol;
}

?>
eeau1973
Forum Commoner
Posts: 27
Joined: Sat Aug 19, 2006 4:49 pm

results of php ..

Post by eeau1973 »

Here are the results ..

PHP Version: 4.3.9
PHP OS: Linux
Error Reporting: 2047 (E_ALL)
Register Globals: On
Short Tags: On
Display Errors: Off
Magic Quotes GPC: Off
Magic Quotes Runtime: Off
Magic Quotes Sybase: Off
Loaded Extensions:
yp xml wddx tokenizer
sysvshm sysvsem standard sockets
shmop session pspell posix
pcre overload mime_magic iconv
gmp gettext ftp exif
dio dbx dba curl
ctype calendar bz2 bcmath
zlib openssl apache2handler domxml
gd imap ldap mbstring
mysql odbc pgsql sitebuilder
zip ionCube Loader


Thanks !
:D
Post Reply