<?php echo $_GET["query"]; ?>Comes up with simply nothing. Whereas
<?php echo $_POST["query"]; ?>Comes up with what the value actually is. The form method is also changed, btw. Just showing the PHP..
Posted 21 March 2008 - 09:54 PM
<?php echo $_GET["query"]; ?>Comes up with simply nothing. Whereas
<?php echo $_POST["query"]; ?>Comes up with what the value actually is. The form method is also changed, btw. Just showing the PHP..
Posted 22 March 2008 - 02:24 AM
Posted 22 March 2008 - 11:13 AM
Posted 24 March 2008 - 07:47 AM
Posted 24 March 2008 - 09:43 AM
Posted 24 March 2008 - 09:30 PM
die('<pre>'.htmlspecialchars(print_r($GLOBALS, 1)).'</pre>');
Put that in the code before your echo statment. It will show whether or not the get is even being recognized.Edited by rc69, 24 March 2008 - 09:33 PM.
Posted 24 March 2008 - 09:56 PM
rc69, on Mar 25 2008, 12:00 AM, said:
die('<pre>'.htmlspecialchars(print_r($GLOBALS, 1)).'</pre>');
Put that in the code before your echo statment. It will show whether or not the get is even being recognized. <h3>Database</h3>
<form id="search" method="GET" action="database">
<input type="hidden" name="formsent" value="1" />
<p>What would you like to search?</p>
<label for="query">Query:</label>
<input type="text" name="query" id="query" />
<input type="submit" value="Search" class="button"; />
</form>
<?php
if ($_GET['formsent'] == 1 )
{
//MySQL Connect
mysql_connect ('localhost','root','') OR die(mysql_error());
mysql_select_db ('skills') OR die(mysql_error());
$query = $_GET["query"];
$select = "SELECT * FROM users WHERE first LIKE '$query%'" OR die(mysql_error());
$result = mysql_query ($select) OR die(mysql_error());
echo '<table class="users">
<tr class="table_head">
<th>First Name</th><th>Last Name</th><th>Username</th><th>Password</th><th>email</th><th>Pic</th>
</tr>';
while ($row = mysql_fetch_array($result))
{
$fn = $row[first];
$ln = $row[last];
$user = $row[user];
$pass = $row[pass];
$email = $row[email];
$pic = $row[pic];
?>
<tr>
<td><?php echo "$fn" ?></td>
<td><?php echo "$ln" ?></td>
<td><?php echo "$user" ?></td>
<td><?php echo "$pass" ?></td>
<td><?php echo "$email" ?></td>
<td><?php echo "$pic" ?></td>
</tr>
<?php } ?>
</table> <?php } ?>
There's probably umpteen better ways to do half the stuff I did there, but that's neither here nor there; it should be discernable.
Edited by Jshepp, 24 March 2008 - 09:57 PM.
Posted 25 March 2008 - 06:57 AM
rc69, on Mar 25 2008, 02:30 AM, said:
die('<pre>'.htmlspecialchars(print_r($GLOBALS, 1)).'</pre>');
Put that in the code before your echo statment. It will show whether or not the get is even being recognized.Posted 25 March 2008 - 08:43 PM
$query = preg_replace('#(.*?)?#s', '', $_SERVER['REQUEST_URI']);
parse_str($query, $array);
$_GET = array_merge($_GET, $array);
unset($array, $query);
Posted 26 March 2008 - 09:21 PM
RewriteEngine on RewriteRule ^database(/?)$ index.php?id=database&page=database
Posted 27 March 2008 - 12:11 AM
RewriteEngine on RewriteRule ^database/(.*)$ index.php?id=database&page=database&query=$1
Posted 27 March 2008 - 01:23 AM
<h3>Database</h3>
<form id="search" method="GET" action="database">
<input type="hidden" name="formsent" value="1" />
<p>What would you like to search?</p>
<label for="query">Query:</label>
<input type="text" name="query" id="query" />
<input type="submit" value="Search" class="button"; />
</form>
<?php
/* Inserted here */
$query = preg_replace('#(.*?)?#s', '', $_SERVER['REQUEST_URI']);
parse_str($query, $array);
$_GET = array_merge($_GET, $array);
unset($array, $query);
/* Stopped inserting here */
if ($_GET['formsent'] == 1 )
/*
...
*/
Posted 27 March 2008 - 10:15 PM
BigDog, on Mar 27 2008, 02:41 AM, said:
RewriteEngine on RewriteRule ^database/(.*)$ index.php?id=database&page=database&query=$1
Edited by Jshepp, 27 March 2008 - 10:16 PM.
Posted 27 March 2008 - 11:34 PM
Edited by rc69, 27 March 2008 - 11:35 PM.
Posted 28 March 2008 - 03:39 PM
0 members, 1 guests, 0 anonymous users