Windows vs Linux variable passing
| From: | Steve Stephens | Date: | Tue, 10 Dec 2002 19:48:39 +0000 |
| Subject: | Windows vs Linux variable passing | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24034@lists.php.net to get a copy of this message | ||
I'm REALLY new at this and someone else actually wrote the following but,
can anyone tem me why this works in Windows but not in Linux? It falls
through to the "NO, it's still not working" statement. If I remove the $ in
$con from $result = mysql_query("SELECT * FROM mytable WHERE myrow REGEXP
\"$con\"",$db) the nextpage.php will display the rows on the page but not in
the header.
I'm sure there is a better way to do all this but I don't know how. Any help
or suggestions would be greatly appreciated. Thanks, Steve
echo "<h1 ALIGN=\"CENTER\">First Page Title</h1><br>";
$db = mysql_pconnect("server", "", "");
mysql_select_db("db",$db);
// display individual record
if ($row)
{
$result = mysql_query("SELECT * FROM table WHERE row REGEXP \"$row\"", $db);
}
else
{
$result = mysql_query("SELECT * FROM table", $db);
}
if ($myrow = mysql_fetch_array($result))
{
do
{
$c = $myrow['row'];
$p = $myrow['table'];
$comp = strcmp ($c, $z);
if ($comp != 0)
{
printf("<h3 ALIGN=\"CENTER\"><a
href=\"nextpage.php?con=$c\">$c</a></h3>\n");
}
$z = $c;
} while ($myrow = mysql_fetch_array($result));
}
else
{
// no records to display
echo "Sorry, no records were found.";
}
?>
<br>
<B><I><FONT><P ALIGN="CENTER">Return to: </B></I><A
HREF="main.htm">
Home</A></P>
</body>
</html>
................................................
................................................
nextpage.php
<html>
<head>
<?php
echo "<title>Next Page -$con </title>";
echo "<link rel=\"stylesheet\" type=\"text/css\"
href=\"style.css\" />";
echo "</head>";
echo "<h1 ALIGN=\"CENTER\">$con</h1><br>";
$db = mysql_connect("myserver", "", "");
mysql_select_db("mydb",$db);
// display myrow from mytable
$result = mysql_query("SELECT * FROM mytable WHERE myrow REGEXP
\"$con\"",$db) or die ("NO, it's still not working");
.
.
.
.etc
----------------------------------------------------------------------------
----