mbrown Posted September 18, 2008 Share Posted September 18, 2008 <?php include 'dbconnect.php'; $Query = "SELECT ID, Age, Month, Day, Year, Hometown, State, Graduation, Certificate, Associates, Bachelors, Study, GPA FROM survey WHERE = Age = '21'"; $Result = mysqli_query ($db $Query) or die("<p>Unable to execute the query.</p>" . "<p>Error Code</p>" . mysqli_errno($db) . ": " . mysqli_error($db)) . "</p>"; echo "<p>Successfully executed the query.>/p>"; mysqli_close($db); ?> it is throwing this error: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\CIT250\Project\assignment3\age.php on line 15 All I want is to display the information in a table. Yes I know I dont have the table set up yet but thats life at the moment. One step at a time. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 It's in your WHERE clause: $Query = "SELECT ID, Age, Month, Day, Year, Hometown, State, Graduation, Certificate, Associates, Bachelors, Study, GPA FROM survey WHERE Age = '21'"; Quote Link to comment Share on other sites More sharing options...
troy_mccormick Posted September 18, 2008 Share Posted September 18, 2008 Don't know if this is it, but give it a shot: <?php include('dbconnect.php'); $Query = "SELECT ID, Age, Month, Day, Year, Hometown, State, Graduation, Certificate, Associates, Bachelors, Study, GPA FROM survey WHERE Age = '21'"; $Result = mysqli_query ($db $Query) or die("<p>Unable to execute the query.</p>" . "<p>Error Code</p>" . mysqli_errno($db) . ": " . mysqli_error($db) . "</p>"); echo "<p>Successfully executed the query.>/p>"; mysqli_close($db); ?> Quote Link to comment Share on other sites More sharing options...
mbrown Posted September 18, 2008 Author Share Posted September 18, 2008 It's in your WHERE clause: <?php include 'dbconnect.php'; $Query = "SELECT ID, Age, Month, Day, Year, Hometown, State, Graduation, Certificate, Associates, Bachelors, Study, GPA FROM survey WHERE Age = '21'"; $Result = mysqli_query ($db $Query) or die("<p>Unable to execute the query.</p>" . "<p>Error Code</p>" . mysqli_errno($db) . ": " . mysqli_error($db)) . "</p>"; echo "<p>Successfully executed the query.>/p>"; mysqli_close($db); ?> same error: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\CIT250\Project\assignment3\age.php on line 15 Yelling at the following code $Result = mysqli_query ($db $Query) or die("<p>Unable to execute the query.</p>" [code] [/code] Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 Yeah, there's a lot of typos and stuff in your code. You should really look more closely at it. Here's my fix: <?php include 'dbconnect.php'; $Query = "SELECT ID, Age, Month, Day, Year, Hometown, State, Graduation, Certificate, Associates, Bachelors, Study, GPA FROM survey WHERE Age = '21'"; $Result = mysql_query ($Query,$db) or die("<p>Unable to execute the query.</p>" . "<p>Error Code</p>" . mysql_error($db) . ": " . mysql_error($db) . "</p>"); echo "<p>Successfully executed the query.</p>"; mysql_close($db); ?> Quote Link to comment Share on other sites More sharing options...
troy_mccormick Posted September 18, 2008 Share Posted September 18, 2008 Sorry...use this... <?php include('dbconnect.php'); $Query = "SELECT ID, Age, Month, Day, Year, Hometown, State, Graduation, Certificate, Associates, Bachelors, Study, GPA FROM survey WHERE Age = '21'"; $Result = mysqli_query ($db, $Query) or die("<p>Unable to execute the query.</p>" . "<p>Error Code</p>" . mysqli_errno($db) . ": " . mysqli_error($db) . "</p>"); echo "<p>Successfully executed the query.>/p>"; mysqli_close($db); ?> Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 Here's a list of all the errors I saw: an extra "=" in the where clause using "mysqli_..." instead of "mysql_..." (added an "i") ")" in the wrong place in the die() statement used ">" instead of "<" in the successful echo statement Quote Link to comment Share on other sites More sharing options...
troy_mccormick Posted September 18, 2008 Share Posted September 18, 2008 You do know that mysqli are PHP functions, right? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted September 18, 2008 Share Posted September 18, 2008 Here's a list of all the errors I saw: an extra "=" in the where clause using "mysqli_..." instead of "mysql_..." (added an "i") ")" in the wrong place in the die() statement used ">" instead of "<" in the successful echo statement mysqli() is a new PHP extension. Look it up before you go correcting people. Quote Link to comment Share on other sites More sharing options...
mbrown Posted September 18, 2008 Author Share Posted September 18, 2008 Got everything working with troy_mccormick's help Now to make it look pretty Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 Interesting. I did a search for it before I posted, as you suggest, but it forwarded me to the regular mysql functions. My bad, and weird that it wouldn't have sent me to the mysqli. Again, my bad. Quote Link to comment Share on other sites More sharing options...
troy_mccormick Posted September 18, 2008 Share Posted September 18, 2008 Got everything working with troy_mccormick's help Now to make it look pretty Glad it worked out. Be sure to mark this post as solved (bottom left of the page) Quote Link to comment Share on other sites More sharing options...
DarkWater Posted September 18, 2008 Share Posted September 18, 2008 Interesting. I did a search for it before I posted, as you suggest, but it forwarded me to the regular mysql functions. My bad, and weird that it wouldn't have sent me to the mysqli. Again, my bad. K. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.