note 1941 deleted from mysql_db_query by danbeck
| From: | danbeck@php.net | Date: | Thu, 07 Sep 2000 15:28:49 +0000 |
| Subject: | note 1941 deleted from mysql_db_query by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4363@lists.php.net to get a copy of this message | ||
when trying to enter a query to the database with a php variable, setup the sting before hand as
follows:
<RPE>
$query_string = "SELECT * FROM <table> WHERE <col> = '$PHP_VAR'";
$result = mysql_db_query('database',$query_string);
$row = mysql_fetch_array($result);
// then you can display the query or check other rows:
echo $row['COL'] . " ";
/* print query */
if ($row['COL'] == $PHP_VAR2)
{ .... /* $PHP_VAR variable
true ... code here */
}
else
{
... /* PHP_VAR3 false code here */
}
<PRE>
it took me awhile to fiqure out how to send queries to the database,
without having PHP doing all of the work. Could'nt find an
example on this site, so I thought I would add it to help anyone else out there.
Helps if you read the post instructions, just cleaning it up.
H