Can someone else see what I am obviously missing?
Parse error: parse error, unexpected T_STRING in /home/ppocd/www/ppocd/modules/Recipes/index.php on line 13
#12 /************************************************************************/
#13
#14 if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
So.. no missing semicolons on Line #12/13.
When I remove the calls to these two functions, the error goes away:
function listRecipes() {
$result = mysql_query("SELECT * FROM nuke_recipes ORDER BY name);
if(!$result) {
echo "No recipes in our database.";
$return;
} else {
$i=0;
while($row = mysql_fetch_array($result)) {
$i++;
echo "<a href=\"modules.php?name=Recipes&rid=".$row[id]."\">".$row[name]."</a>\n";
}
}
mysql_free_result($result);
}
function showRecipe($rid) {
$result = mysql_query("SELECT * FROM ".$prefix."_recipes WHERE rid = ".$rid);
$row = mysql_fetch_array($result);
echo "<b>Recipe Name:</b> ".$row[name]."<br>\n"
."<b>Instructions:</b><br>".$row[recipe]."<br>\n";
mysql_free_result($result);
}
Any ideas?
$result = mysql_query("SELECT * FROM nuke_recipes ORDER BY name);
should be:
$result = mysql_query("SELECT * FROM nuke_recipes ORDER BY name");
also the following line will not work:
$result = mysql_query("SELECT * FROM ".$prefix."_recipes WHERE rid = ".$rid);
You need to build the text of your query first and then feed mysql_query() a formatted query string. For example:
$table = $prefix."_recipes";
$sql = "SELECT * FROM $table WHERE rid = '$rid'";
mysql_query($sql);
If "rid" is a numeric field in the database, then remove the single quotes around $rid.
Hope that helps.
Parse error: parse error, unexpected T_STRING in /home/sites/home/web/p/processForm.php on line 14
Here is the code.
1 <html>
2 <head>
3 <title>Process Form Data</title>
4 </head>
5 <body>
6 <h3>Your information has been processed.</h3>
7
8 <?php
9
10 $linkID = mysql_connect("localhost", "root", "xxxx");
11
12 mysql_select_db("surplus", $linkID);
13
14 mysql query("INSERT INTO equipment (qty, model, descript, vendor, locale, date, price)
VALUES ($qty, $model, $descript, $vendor, $date, $price)", $linkID);
15
16 print "$qty, $model , $descript , $vendor , $locale , $date , $price<br>";
17
18 mysql_close($linkID);
19
20?>
21
22 </body>
23 </html>
Thanks!