SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: $result = mysql_query...
-
Feb 3, 2005, 12:48 #1
- Join Date
- Jun 2004
- Location
- usa
- Posts
- 11
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
$result = mysql_query...
Below is a snip that I am playing with... everything appears to be working except:
$result = mysql_query ($query);
I get results from the $_POST and $query usig the print_r but nothing for the $results
Am I coding something wrong?
Code below:
if (isset($_POST['submit'])) {
require_once ('dbconnect.php'); // Connect to the database.
$query = "INSERT INTO patients (firstname, initial, lastname, dob, ) VALUES ('$firstname', '$initial', '$lastname', '$dob', NOW())";
$result = mysql_query ($query);
echo '<pre>';
print_r ($result);
echo '</pre>';
echo '<pre>';
print_r ($query);
echo '</pre>';
echo '<pre>';
print_r ($_POST);
echo '</pre>';
-
Feb 3, 2005, 12:55 #2
- Join Date
- Nov 2004
- Location
- Parry Sound, ON
- Posts
- 725
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by comtek
You should issue queries with
PHP Code:$result = mysql_query($query) or die(mysql_error());
-
Feb 3, 2005, 13:40 #3
- Join Date
- Aug 2004
- Location
- Madison, WI
- Posts
- 191
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
also, if you print_r on a query result, you'll only get a result ID
if you want to actually see the data you'll have to fetch from the result
Bookmarks