0

hi all ive got a file to display info from database and im trying some way to fetch username from another table for it i have put this at top of file.

<?php
$query          = mysqli_query($conn,"select * from user");
$fetch_user     = mysqli_fetch_array($query);
?>

and here is the section for displaying data

<?php
      $sql = "SELECT * FROM meets";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
echo "<table><tr><th>ID</th><th>Event Type</th><th>Event Date</th><th>Event Region</th><th>Event Postcode</th><th>Event Title</th><th>Event Description</th><th>Event Seeking</th></tr>";
    // output data of each row
   while($row = mysqli_fetch_assoc($result)) {
   echo "<tr><td>".$row["id"]."</td><td>".$row["event_type"]."</td><td>".$row["event_date"]."</td><td>".$row["event_country"]."</td><td>".$row["event_postcode"]."</td><td>".$row["event_title"]."</td><td>".$row["event_description"]."</td><td>".$row["event_ltm"]. "</td></tr>";
    }
    echo "</table>";
} else {
    echo "0 results";
}

mysqli_close($conn);
?>

and after ammending it by replacing id with the following

echo "<tr><td>".$rowucfirst($fetch_user['user_name']);."</td><td>".$row["event_type"]."</td><td>".$row["event_date"]."</td><td>".$row["event_country"]."</td><td>".$row["event_postcode"]."</td><td>".$row["event_title"]."</td><td>".$row["event_description"]."</td><td>".$row["event_ltm"]. "</td></tr>";

i am getting the following error

PHP Parse error:  syntax error, unexpected '.'

what is the best way around this many thanks in advance jan x

2
Contributors
4
Replies
36
Views
5 Months
Discussion Span
Last Post by janicemurby
0

done that now im getting the following :

PHP Fatal error:  Uncaught Error: Function name must be a string in
Stack trace:
#0 {main}
  thrown in

many thanks hun x

1

I don't think $rowucfirst is a function, and if it were it shouldn't start with a $. Were you trying to just do echo "<tr><td>".ucfirst($fetch_user['user_name']) perhaps?

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.