trevorismethebest Posted February 14, 2015 Share Posted February 14, 2015 Hello I have this code : <?php $con=mysqli_connect("login info here"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT events.*, signup.status FROM events, signup "); //$result = mysqli_query($con,"SELECT events.*, signup.status FROM events, signup "); echo "<table class='TFtable'><tr><td>Name</td><td>Event ID</td><td>Location</td><td>Time / Date</td><td>Lead</td><td># Needed</td><td>Complete?</td><td>Materials</td><td>Teacher</td><td>Duration</td><td>Summary</td><td>Signed Up</td></tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['eventname'] . "</td>"; echo "<td>" . $row['eventid'] . "</td>"; echo "<td>" . $row['location'] . "</td>"; echo "<td>" . $row['time'] . "</td>"; echo "<td>" . $row['lead'] . "</td>"; echo "<td>" . $row['need'] . "</td>"; echo "<td>" . $row['complete'] . "</td>"; echo "<td>" . $row['materials'] . "</td>"; echo "<td>" . $row['teacher'] . "</td>"; echo "<td>" . $row['duration'] . "</td>"; echo "<td>" . $row['eventsummary'] . "</td>"; $row1 = mysqli_fetch_array(SELECT COUNT(status) FROM signup WHERE eventid='$row['eventid']' and status='yes';) echo "<td>" . $row1 . "</td>"; } echo "</tr>"; echo "</table>"; echo "<br><br><br><br>"; mysqli_close($con); ?> And I'm getting this error: Parse error: syntax error, unexpected 'COUNT' (T_STRING) in /home/howto570/public_html/dmcisc/home/index.php on line 55 Line 55 is: $row1 = mysqli_fetch_array(SELECT COUNT(status) FROM signup WHERE eventid='$row['eventid']' and status='yes';) Thanks Quote Link to comment https://forums.phpfreaks.com/topic/294597-my-sql-dual-table-display-error/ Share on other sites More sharing options...
requinix Posted February 14, 2015 Share Posted February 14, 2015 This is actually a PHP problem: you didn't put quotes around your query. Did you not notice that or were you not aware you have to use quotes in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/294597-my-sql-dual-table-display-error/#findComment-1505663 Share on other sites More sharing options...
Barand Posted February 14, 2015 Share Posted February 14, 2015 Also, mysqli_fetch_array() will not execute the query. 1 Quote Link to comment https://forums.phpfreaks.com/topic/294597-my-sql-dual-table-display-error/#findComment-1505681 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.