http://www.thepastaboard.com/recipes...arch_main.php3
[I still haven't worked out the correct query code for the main search page!! - if you submit from the drop-down menu, it returns ALL results, no matter what you choose... But I digress...
Anyway - this is the code I have for the selected_recipe.php3:
PHP Code:
<?php
$name = 'name';
$description = 'description';
$fc = 'fc';
$source = 'source';
$submitted_by = 'submitted_by'; //I just added these for the heck of it
$yield = 'yield'; //to see if it would make any difference
$prep_time = 'prep_time'; // - it doesn't...
$ingredients = 'ingredients';
$instructions = 'instructions';
$nutritional_info = 'nutritional_info';
$page = isset($page) ? ($page) : '';
if (isset($page)) {
if ($page == 'search_results.php3') {
mysql_connect("", "name", "pass") or die("Could not connect: ". mysql_error());
mysql_select_db("recipes") or die("Could not select database");
But the error I get is:
parse error - unexpected $
that is referring to this line number:
<? include ('./footer2.inc'); ?>
-which is just an include file that seems to work fine in other pages (and incidentally, there is another include before this one in the code of selected_recipe.php3...
Ok, I implemented your suggestion (d'oh!!! )
however, while I am not getting error messages, I am getting no result... I don't understand why? here is the code I have now:
PHP Code:
<?
if ($page == 'search_results.php3') {
mysql_connect("", "name", "pass") or die("Could not connect: ". mysql_error());
mysql_select_db("recipes") or die("Could not select database");
$sql = "SELECT * FROM main";
$result = mysql_query($sql);
Is there something glaringly obvious that I am missing??? I can't figure out why it is not printing (echo-ing) the data in the specified fields in the table row for the current recipe found...
From what I can see, you are using variable names ($var_name) inside single quotation (after extracting them in the while() loop). This should print the var names as they are and not what's inside them. You should use double-quotation OR escape each var name if you don't want to literally print them.
HTH.
[EDIT]
Also, if you are not getting anything at all, then run your SQL statement directly at MySQL client and see if you are getting anything. If empty set, that means either your SQL is not retrieving what you are trying to or simply there is no data that matches your SQL condition.